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
56
57
58
59
|
if engine.ActiveGamemode() ~= "sandbox" then return end
AddCSLuaFile( "cl_init.lua" ) -- Make sure clientside
AddCSLuaFile( "shared.lua" ) -- and shared scripts are sent.
include('shared.lua')
ENT.default_data = {
Model = "models/humans/Group02/Male_03.mdl",
NavNodes = {},
Pos = nil
}
ENT.edit_data = {
Size = HULL_HUMAN,
Type = "npc",
Model = "models/editor/playerstart.mdl",
get_default_code = function(who)
local default_townie = [[
local npc = {
["Pos"] = Vector(%f,%f,%f),
["Model"] = %q,
["Name"] = "%s",
["NavNodes"] = {},
["OnSpawn"] = function(nnpc)
print("At time onspawn was called, nnpc was",nnpc)
nnpc:StartActivity(ACT_IDLE)
end
}
npc.shopitems = {
{"Scrap Hammer",10}, --Items of the form {string_itemname,number_cost}
{"Rat Meat",5},
}
nrequire("sv_npcsystem.lua").CreateShop(npc)
]]
local pos = who:GetPos()
local model = "models/humans/Group02/Male_03.mdl"
local name = "Default Shopkeep"
return string.format(default_townie,pos.x,pos.y,pos.z,model,name,"{}",name)
end
}
--[[
local init = ENT.Initalize
function ENT:Initalize()
print("In towniespawn's initalize")
init(self)
end
]]
hook.Add("OnPhysgunFreeze",function(wep,phys,ent,ply)
print("Detected freeze")
--See if we should update position and andgle
end)
|