aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Pickering <Alexander.Pickering@anondomain.site90.net>2016-01-10 20:04:44 -0500
committerAlexander Pickering <Alexander.Pickering@anondomain.site90.net>2016-01-10 20:04:44 -0500
commitb192363394e3a9d9dcf8c182512fa4612c91fd00 (patch)
tree55ff956dd5b4878349953eede0f17b79810785c5
parent09fe7cf5fac36063bae4501a6030327ec7bf2c22 (diff)
parent7180aa15356188d11996f2f91f53c7cba4ad1470 (diff)
downloadwintersurvival2-b192363394e3a9d9dcf8c182512fa4612c91fd00.tar.gz
wintersurvival2-b192363394e3a9d9dcf8c182512fa4612c91fd00.tar.bz2
wintersurvival2-b192363394e3a9d9dcf8c182512fa4612c91fd00.zip
Merge branch 'development' of ssh://ssh.cogarr.org:43/home/git/wintersurvival2 into development
-rw-r--r--doc/website.txt4
-rw-r--r--entities/entities/ws_npc_ambient/init.lua6
-rw-r--r--entities/entities/ws_npc_ambient/shared.lua8
-rw-r--r--gamemode/npcsystem/aidirector.lua38
-rw-r--r--gamemode/shared/game_rounds.lua1
5 files changed, 51 insertions, 6 deletions
diff --git a/doc/website.txt b/doc/website.txt
index 611d80e..ee9f71f 100644
--- a/doc/website.txt
+++ b/doc/website.txt
@@ -1,3 +1,7 @@
There is a website that goes with the beta server currently located at cogarr.net
I am using lighttpd as the webserver, with mostly default setup. I am symlinking /var/www/html with a different folder to make the site easier to work with over git.
+
+I am using cgi module on lighthttpd to get all the shell scripts to run, most of the scripts are pretty simple, but be sure that your web server user has access to the appropriate files. Specifically:
+
+/home/steam/server_1/garrysmod/data/ws_recepiedata.txt
diff --git a/entities/entities/ws_npc_ambient/init.lua b/entities/entities/ws_npc_ambient/init.lua
index 523333c..1f08884 100644
--- a/entities/entities/ws_npc_ambient/init.lua
+++ b/entities/entities/ws_npc_ambient/init.lua
@@ -7,11 +7,15 @@ include('shared.lua')
function ENT:Initialize()
--print("NPC spawned!")
--self:SetMoveType(MOVETYPE_STEP)
- self:SetSolid(SOLID_NONE)
+ self:SetSolid(SOLID_OBB)
--self:SetCollisionGroup(COLLISION_GROUP_INTERACTIVE)
if(self.Model) then self:SetModel(self.Model)
else print("NPC created without model, this might be a bug!") end
+ if(not self.Stats) then
+ print("NPC created without any stats, this is a bug!")
+ return
+ end
if(self.Stats["Vitality"]) then
self:SetHealth(self.Stats["Vitality"])
print("Helath set to " .. self.Stats["Vitality"])
diff --git a/entities/entities/ws_npc_ambient/shared.lua b/entities/entities/ws_npc_ambient/shared.lua
index c84245c..c14de1e 100644
--- a/entities/entities/ws_npc_ambient/shared.lua
+++ b/entities/entities/ws_npc_ambient/shared.lua
@@ -19,7 +19,7 @@ end
function ENT:DefaultBehaviour()
while ( true ) do
--Main loop for ai
-
+ print("Going into behavior for " .. self.Name)
--Update aware enemies
local players = ents.FindByClass("Player")
for k,v in pairs(players) do
@@ -49,15 +49,17 @@ function ENT:DefaultBehaviour()
local randanim = math.Round(math.Rand(0,#self.IdleSequences))
self:PlaySequenceAndWait( self.IdleSequences[randanim] )
self:StartActivity( ACT_IDLE )
+ print("Acting idle")
--If there's noone within 4000 units, just remove ourselves to save server resources
local closest = 5000
for k,v in pairs(player.GetAll()) do
local thisdist = self:GetPos():Distance(v:GetPos())
- if(thisdist > closest) then
+ if(thisdist < closest) then
closest = thisdist
end
end
- if(closest > 4000) then self:BecomeRagdoll(DamageInfo()) end
+ if(closest > 4000) then
+ print("Closes player is " .. closest .. " removeing self...") self:BecomeRagdoll(DamageInfo()) end
else
--We have a target to attack!
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