diff options
| author | Alexander Pickering <Alexander.Pickering@anondomain.site90.net> | 2016-01-10 20:04:44 -0500 |
|---|---|---|
| committer | Alexander Pickering <Alexander.Pickering@anondomain.site90.net> | 2016-01-10 20:04:44 -0500 |
| commit | b192363394e3a9d9dcf8c182512fa4612c91fd00 (patch) | |
| tree | 55ff956dd5b4878349953eede0f17b79810785c5 /gamemode | |
| parent | 09fe7cf5fac36063bae4501a6030327ec7bf2c22 (diff) | |
| parent | 7180aa15356188d11996f2f91f53c7cba4ad1470 (diff) | |
| download | wintersurvival2-b192363394e3a9d9dcf8c182512fa4612c91fd00.tar.gz wintersurvival2-b192363394e3a9d9dcf8c182512fa4612c91fd00.tar.bz2 wintersurvival2-b192363394e3a9d9dcf8c182512fa4612c91fd00.zip | |
Merge branch 'development' of ssh://ssh.cogarr.org:43/home/git/wintersurvival2 into development
Diffstat (limited to 'gamemode')
| -rw-r--r-- | gamemode/npcsystem/aidirector.lua | 38 | ||||
| -rw-r--r-- | gamemode/shared/game_rounds.lua | 1 |
2 files changed, 37 insertions, 2 deletions
diff --git a/gamemode/npcsystem/aidirector.lua b/gamemode/npcsystem/aidirector.lua index 04e645d..fb85b2d 100644 --- a/gamemode/npcsystem/aidirector.lua +++ b/gamemode/npcsystem/aidirector.lua @@ -15,8 +15,28 @@ concommand.Add("ws_spawnnpc",function(ply,cmd,args) local npc = GetNpcByName(args[1])
if(npc == nil) then print("Not a valid name!")
return end
+ print("attempting to spawn npc...")
SpawnNpcByName(args[1],ply:GetPos())
-end)
+ print("NPC spawned!")
+end, function(cmd,stringargs)
+ print(cmd, stringargs)
+ local tbl = {}
+ stringargs = string.sub(stringargs,2)
+ if(stringargs == " ") then
+ for k,v in pairs(GAMEMODE.Npcs) do
+ table.insert(tbl,cmd .. " \"" .. v.Name .. "\"")
+ end
+ return tbl
+ end
+ for k,v in pairs(GAMEMODE.Npcs) do
+ if(string.find(string.lower(v.Name),stringargs)) then
+ table.insert(tbl,cmd .. " \"" .. v.Name .. "\"")
+ else
+ print("Could not find " .. stringargs .. " in " .. string.lower(v.Name))
+ end
+ end
+ return tbl
+end, "Spawns an NPC from winter survival, useage: ws_spawnnpc <name>")
function SpawnNpcByName(name, position)
if(CLIENT) then return end
@@ -25,9 +45,21 @@ function SpawnNpcByName(name, position) print("Could not find npc data for name " .. name)
return
end
+ if not position then
+ print("Invalid position:")
+ print(position)
+ return
+ end
ent = ents.Create("ws_npc_ambient")
+ if(not ent) then
+ print("Could not spawn npc ws_npc_ambient")
+ return
+ end
ent:SetPos(position)
-
+ print("From server!")
+ if(entdata.Name) then
+ ent.Name = entdata.Name
+ end
if(entdata.Model) then
ent.Model = entdata.Model
end
@@ -61,7 +93,9 @@ function SpawnNpcByName(name, position) if(entdata.OnSpawn) then
ent.OnSpawn = entdata.OnSpawn
end
+ print("NPC created")
ent:Spawn()
+ print("NPC spawned")
end
local random = math.random
diff --git a/gamemode/shared/game_rounds.lua b/gamemode/shared/game_rounds.lua index 9ca4adf..0333679 100644 --- a/gamemode/shared/game_rounds.lua +++ b/gamemode/shared/game_rounds.lua @@ -12,6 +12,7 @@ if (SERVER) then "ws_arrow",
"ws_campfire",
"ws_grave",
+ "ws_item",
"ws_rune",
}
for k,v in pairs(cleanup) do
|
