mirror of
https://github.com/metrostroi-repo/MetrostroiAddon.git
synced 2026-05-02 00:42:29 +00:00
init
This commit is contained in:
53
lua/entities/gmod_track_controller/cl_init.lua
Normal file
53
lua/entities/gmod_track_controller/cl_init.lua
Normal file
@@ -0,0 +1,53 @@
|
||||
include("shared.lua")
|
||||
local frame = nil
|
||||
function CreateFrame()
|
||||
if !frame or !frame:IsValid() then
|
||||
local self = net.ReadEntity()
|
||||
local Map = game.GetMap() or ""
|
||||
if Map:find("gm_metrostroi") and Map:find("lite") then
|
||||
Map = "gm_metrostroi_lite"
|
||||
elseif Map:find("gm_metrostroi") then
|
||||
Map = "gm_metrostroi"
|
||||
elseif Map:find("gm_mus_orange_line") and Map:find("long") then
|
||||
Map = "gm_orange"
|
||||
elseif Map:find("gm_mus_orange_line") then
|
||||
Map = "gm_orange_lite"
|
||||
end
|
||||
frame = vgui.Create("DFrame")
|
||||
frame:SetDeleteOnClose(true)
|
||||
frame:SetTitle("Dispatch control")
|
||||
--frame:SetSize(275, 34+24*17)
|
||||
frame:SetDraggable(false)
|
||||
frame:SetSizable(false)
|
||||
frame:MakePopup()
|
||||
|
||||
frame:SetSize(ScrW()-40,ScrH()-40)
|
||||
frame:Center()
|
||||
local StationChoose = vgui.Create( "DComboBox",frame )
|
||||
StationChoose:SetPos( 5, 30 )
|
||||
StationChoose:SetSize( 250, 20 )
|
||||
StationChoose:SetValue( "Choose station" )
|
||||
for k,v in pairs(Metrostroi.WorkingStations[Map][1]) do
|
||||
if Metrostroi.AnnouncerData[v] then StationChoose:AddChoice(Metrostroi.AnnouncerData[v][1]) end
|
||||
end
|
||||
|
||||
local PlayerChoose = vgui.Create( "DComboBox",frame )
|
||||
PlayerChoose:SetPos( ScrW()-300,30 )
|
||||
PlayerChoose:SetSize( 250, 20 )
|
||||
PlayerChoose:SetValue( "Choose player" )
|
||||
for i = 1,20 do
|
||||
PlayerChoose:AddChoice(i)
|
||||
end
|
||||
|
||||
local Main = vgui.Create( "DPanel",frame )
|
||||
Main:SetPos(0,60)
|
||||
Main:SetSize(frame:GetWide(),frame:GetTall()-60)
|
||||
Main.Paint = function(self,w,h)
|
||||
surface.DrawRect(5, 0, w-10, h-5)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
function ENT:Initialize()
|
||||
end
|
||||
net.Receive("TrackController",CreateFrame)
|
||||
29
lua/entities/gmod_track_controller/init.lua
Normal file
29
lua/entities/gmod_track_controller/init.lua
Normal file
@@ -0,0 +1,29 @@
|
||||
AddCSLuaFile("cl_init.lua")
|
||||
AddCSLuaFile("shared.lua")
|
||||
include("shared.lua")
|
||||
util.AddNetworkString("TrackController")
|
||||
local function ShowWindowOnCL(ply,ent)
|
||||
net.Start("TrackController")
|
||||
net.WriteEntity(ent)
|
||||
net.Send(ply)
|
||||
end
|
||||
function ENT:Initialize()
|
||||
self:SetModel("models/metrostroi/signals/clock_time.mdl")
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
end
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
|
||||
if ( !tr.Hit ) then return end
|
||||
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 16
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( SpawnPos )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
ShowWindowOnCL(ply,ent)
|
||||
return ent
|
||||
|
||||
end
|
||||
6
lua/entities/gmod_track_controller/shared.lua
Normal file
6
lua/entities/gmod_track_controller/shared.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
ENT.Type = "anim"
|
||||
|
||||
ENT.Category = "Metrostroi (utility)"
|
||||
|
||||
ENT.Spawnable = false
|
||||
ENT.AdminSpawnable = false
|
||||
Reference in New Issue
Block a user