blob: 3a2ac4f8107b096ef9b20518bdb6fe6dc70474d4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
--[[
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")
|