--[[ This entity gives townies things to do ]] if not nrequire then return end AddCSLuaFile( "cl_init.lua" ) AddCSLuaFile( "shared.lua" ) print("Hello from art_shipyardcontrol init.lua!") local ENT = nrequire("sh_ent_shipyardcontrol.lua") function ENT:Initialize( ) self.Entity:SetModel("models/props/cs_militia/sawhorse.mdl") self.Entity:PhysicsInit( SOLID_VPHYSICS ) self.Entity:SetMoveType( MOVETYPE_VPHYSICS ) self.Entity:SetSolid( SOLID_VPHYSICS ) self.Entity:Activate() local phys = self.Entity:GetPhysicsObject() if (phys:IsValid()) then phys:Wake() phys:SetMass(100) end self.selfPos = self.Entity self:SetUseType(SIMPLE_USE) end util.AddNetworkString("art_shipyard_open") util.AddNetworkString("art_shipyard_finalize") util.AddNetworkString("art_shipyard_close") function ENT:Use(a,c,u,v) net.Start("art_shipyard_open") net.WriteEntity(self) net.Send(c) end net.Receive("art_shipyard_finalize",function(ln,ply) print("Finalizing ship...") local area = net.ReadEntity() local name = net.ReadString() print("Name will be", name) print(area,area.Zone) local zone = zones.List[area.Zone] local bounds = zone.bounds local allents = ents.FindInBox(bounds.mins,bounds.maxs) duplicator.SetLocalPos( ply:GetPos()) local boat = duplicator.Copy(allents[1]) duplicator.SetLocalPos(Vector(0,0,0)) print("Got boat") PrintTable(boat) end) scripted_ents.Register(ENT,"art_shipyardcontrol")