diff options
| author | Alexander Pickering <Alexander.Pickering@anondomain.site90.net> | 2015-12-28 22:43:36 -0500 |
|---|---|---|
| committer | Alexander Pickering <Alexander.Pickering@anondomain.site90.net> | 2015-12-28 22:43:36 -0500 |
| commit | 789be4eda3dcac19eb9fe3a290b3283529277c9d (patch) | |
| tree | f135b7de8704dbc04472febfdea8d008971cb624 /gamemode | |
| parent | 5c4ebc932d8c02522802c842d43d863d89aca162 (diff) | |
| download | wintersurvival2-789be4eda3dcac19eb9fe3a290b3283529277c9d.tar.gz wintersurvival2-789be4eda3dcac19eb9fe3a290b3283529277c9d.tar.bz2 wintersurvival2-789be4eda3dcac19eb9fe3a290b3283529277c9d.zip | |
Updated to current
Diffstat (limited to 'gamemode')
| -rw-r--r-- | gamemode/init.lua | 42 | ||||
| -rw-r--r-- | gamemode/npcsystem/loadnpcs.lua | 36 | ||||
| -rw-r--r-- | gamemode/npcsystem/npcs/bird.lua | 18 | ||||
| -rw-r--r-- | gamemode/server/concommands.lua | 19 |
4 files changed, 87 insertions, 28 deletions
diff --git a/gamemode/init.lua b/gamemode/init.lua index 717a65c..d09a5b6 100644 --- a/gamemode/init.lua +++ b/gamemode/init.lua @@ -21,21 +21,21 @@ local models = { "models/player/Group03/male_08.mdl",
"models/player/Group03/male_09.mdl",
}
-
+
function GM:Initialize()
resource.AddDir("sound/wintersurvival2")
resource.AddDir("materials/wintersurvival2")
resource.AddDir("materials/settlement")
resource.AddDir("materials/mixerman3d")
resource.AddDir("materials/lam")
-
+
resource.AddDir("models/mixerman3d")
-
- resource.AddDir("materials/gearfox")
- resource.AddDir("materials/mawbase")
- resource.AddDir("models/gearfox")
- resource.AddDir("sound/mawbase")
-
+
+ resource.AddDir("materials/gearfox")
+ resource.AddDir("materials/mawbase")
+ resource.AddDir("models/gearfox")
+ resource.AddDir("sound/mawbase")
+
resource.AddFile("models/weapons/w_archersword/w_archersword.mdl")
resource.AddFile("materials/models/weapons/archersword.vmt")
end
@@ -50,22 +50,22 @@ function GM:PlayerInitialSpawn(pl) if (!self.CountDown and #player.GetAll() > 1) then self:StartCountDown() end
pl:SetHuman(false)
end
-
+
function GM:PlayerSpawn(pl)
pl:SetHeat(0)
pl:SetHunger(0)
pl:SetFatigue(0)
pl:SetWater(0)
-
+
if (pl:IsPigeon()) then
pl:SetNoDraw(true)
pl:SetNotSolid(true)
pl:SetMoveType(MOVETYPE_NONE)
-
+
pl:SpawnPigeon()
else
--hook.Call("PlayerSetModel",self,pl)
-
+
pl:SetModel(Model(models[math.random(#models)]))
pl:Give("hands")
pl:SelectWeapon("hands")
@@ -82,7 +82,7 @@ end local Up = Vector(0,0,20)
function GM:DoPlayerDeath( pl, attacker, dmginfo )
- if (!pl:IsPigeon()) then
+ if (!pl:IsPigeon()) then
if (#player.GetAllHumans() > 1) then
local a = ents.Create("ws_grave")
a:SetPos(pl:GetPos()+Up)
@@ -90,17 +90,17 @@ function GM:DoPlayerDeath( pl, attacker, dmginfo ) a:Spawn()
a:Activate()
a:AddItem("Meat",math.random(8,10))
-
+
for k,v in pairs(pl:GetInventory()) do
a:AddItem(v.Name,v.Quantity)
end
end
-
- pl:CreateRagdoll()
- pl:SetHuman(false)
- pl:ResetKnownRecipes()
+
+ pl:CreateRagdoll()
+ pl:SetHuman(false)
+ --pl:ResetKnownRecipes()
end
-
+
end
function GM:PlayerDeathSound()
@@ -113,8 +113,6 @@ function GM:PlayerShouldTakeDamage( pl, inf ) return false
end
end
-
+
return true
end
-
-
diff --git a/gamemode/npcsystem/loadnpcs.lua b/gamemode/npcsystem/loadnpcs.lua index 2db2aae..72a1511 100644 --- a/gamemode/npcsystem/loadnpcs.lua +++ b/gamemode/npcsystem/loadnpcs.lua @@ -2,6 +2,7 @@ local Folder = GM.Folder:gsub("gamemodes/","").."/gamemode/npcsystem/npcs" local insert = table.insert
function GM:LoadNPCS()
+ print("NPC's loaded")
local Items = file.Find(Folder.."/*.lua","LUA")
local BaseItem = {}
@@ -39,6 +40,41 @@ function GetNpcByName(name) return nil
end
+function GM:SpawnNPCByName(name,pos)
+ print("Server side, spawning bird!")
+
+ entdata = GetNpcByName(name)
+ if not entdata then
+ print("NPC not found!")
+ return
+ end
+ ent = ents.Create("ws_npc_ambient")
+ ent:SetPos(pos)
+
+
+ if(entdata.Speed) then
+ ent.Speed = entdata.Speed
+ end
+ if(entdata.Model) then
+ ent.Model = entdata.Model
+ end
+ if(entdata.vitality) then
+ ent:SetHealth(entdata.vitality)
+ end
+ if(entdata.Drops) then
+ ent.Drops = entdata.Drops
+ end
+ if(entdata.OnDammage) then
+ ent.OnDammage = entdata.OnDammage
+ end
+ if(entdata.Behave) then
+ ent.Behave = entdata.Behave
+ end
+ if(entdata.Act) then
+ ent.Act = entdata.Act
+ end
+ ent:Spawn()
+end
--[[
function GetRecipeForItem(name)
for k,v in pairs( GAMEMODE.Recipes ) do
diff --git a/gamemode/npcsystem/npcs/bird.lua b/gamemode/npcsystem/npcs/bird.lua index d5cd1e0..b1702d0 100644 --- a/gamemode/npcsystem/npcs/bird.lua +++ b/gamemode/npcsystem/npcs/bird.lua @@ -35,28 +35,34 @@ end function NPC:Behave()
print("Going into bird's custom behaviour")
while ( true ) do
- self:StartActivity( ACT_FLY ) -- walk anims
+ self:StartActivity( ACT_IDLE ) -- walk anims
self.loco:SetDesiredSpeed( 100 ) -- walk speeds
self:MoveToPos( self:GetPos() + Vector( math.Rand( -1, 1 ), math.Rand( -1, 1 ), 0 ) * 200 ) -- walk to a random place within about 200 units (yielding)
- self:StartActivity( ACT_IDLE ) -- revert to idle activity
+ -- revert to idle activity
self:PlaySequenceAndWait( "Idle01" ) -- Sit on the floor
--Check if there are any players nearby
local players = ents.FindByClass("Player")
for k,v in pairs(players) do
- print(k)
- print(v)
+ if(v:GetPos():Distance(self:GetPos()) < 300) then
+ self:StartActivity(ACT_FLY)
+ print("I should fly away")
+ self:SetSequence( "Fly01" )
+ local topos = self:GetPos() + Vector( math.Rand( -1, 1 ), math.Rand( -1, 1 ), 0 ) * 1000
+ self:MoveToPos(topos)
+ print("Flying to (" .. topos.x .. "," .. topos.y .. "," .. topos.z .. ")")
+ end
end
--self:SetSequence( "sit_ground" ) -- Stay sitting
--coroutine.wait( self:PlayScene( "scenes/eli_lab/mo_gowithalyx01.vcd" ) ) -- play a scene and wait for it to finish before progressing
- self:PlaySequenceAndWait( "Fly01" ) -- Get up
+ -- Get up
-- find the furthest away hiding spot
- local pos = self:FindSpot( "random", { type = 'hiding', radius = 5000 } )
+ --local pos = self:FindSpot( "random", { type = 'hiding', radius = 5000 } )
-- if the position is valid
diff --git a/gamemode/server/concommands.lua b/gamemode/server/concommands.lua index a6c891c..6506973 100644 --- a/gamemode/server/concommands.lua +++ b/gamemode/server/concommands.lua @@ -6,6 +6,25 @@ concommand.Add("ws_giveitem",function(pl,com,args) pl:AddItem(args[1],tonumber(args[2] or 1))
end)
+
+concommand.Add("ws_spawnbird",function(ply, cmd, args)
+ GAMEMODE:SpawnNPCByName("Bird",ply:GetPos())
+end)
+
+concommand.Add("ws_startnavgen",function(ply,cmd,args)
+ if (IsValid(pl) and !pl:IsAdmin()) then return end
+ Print("Starting nav generation")
+ local I = 0
+ navmesh.BeginGeneration()
+ while(navmesh.IsGenerating()) do
+ if(I % 100 == 0) then
+ print(I .. " iterations...")
+ end
+ I = I + 1
+ end
+ navmesh.Save()
+end)
+
concommand.Add("ws_revive",function(pl,com,args)
if (IsValid(pl) and !pl:IsAdmin()) then return end
if (!args[1]) then return end
|
