From 7cef367ab340e39afe69f9b61203e11bfd2dce44 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Fri, 25 Mar 2016 23:39:10 -0400 Subject: Updates to fences, and ai --- entities/entities/ws_npc_ambient/shared.lua | 8 +++++++- entities/entities/ws_researchtable/init.lua | 6 ++---- gamemode/itemsystem/items/fence.lua | 3 ++- gamemode/itemsystem/items/floor.lua | 1 + gamemode/itemsystem/items/ramp.lua | 1 + gamemode/npcsystem/npcs/antlion1.lua | 6 ++++++ gamemode/npcsystem/npcs/antlion2.lua | 6 ++++++ gamemode/npcsystem/npcs/zombie.lua | 6 ++++++ 8 files changed, 31 insertions(+), 6 deletions(-) diff --git a/entities/entities/ws_npc_ambient/shared.lua b/entities/entities/ws_npc_ambient/shared.lua index c4a91cf..e2f02ec 100644 --- a/entities/entities/ws_npc_ambient/shared.lua +++ b/entities/entities/ws_npc_ambient/shared.lua @@ -35,6 +35,10 @@ function ENT:DefaultBehaviour() local maxprioritytarget = nil for k,v in pairs(self.AwareEnemies) do local priority = self:AttackPriority(v) + if(priority == nil) then + print("Nill priority hit after ") + PrintTable(self) + end if(priority > maxpriority) then maxpriority = priority maxprioritytarget = v @@ -59,7 +63,9 @@ function ENT:DefaultBehaviour() end end if(closest > 4000) then - --print("Closes player is " .. closest .. " removeing self...") self:BecomeRagdoll(DamageInfo()) end + print("Closes player is " .. closest .. " removeing self...") + self:BecomeRagdoll(DamageInfo()) + end else --We have a target to attack! diff --git a/entities/entities/ws_researchtable/init.lua b/entities/entities/ws_researchtable/init.lua index 64596e4..f45ca61 100644 --- a/entities/entities/ws_researchtable/init.lua +++ b/entities/entities/ws_researchtable/init.lua @@ -5,8 +5,6 @@ include('shared.lua') --[[An item to give hints to players that are just starting out]] local PossibleRecipies = { - [1] = { [0]="Arrow", - [1]="Rock, Flint, Sap, and Wood"}, [2] = { [0]="Barrel", [1]="Planks and Sap"}, [3] = { [0]="Fence", @@ -23,8 +21,8 @@ local PossibleRecipies = { [1]="Wood, Rock, and Sap"}, [9] = { [0]="Stoneblock", [1]="Rock and Sap"}, - [10] = { [0]="Arrow", - [1]="Rock, Flint, Sap, and Wood"}, + [11] = { [0]="Vine", + [1]="Hitting an Antlion hill with a Sickle"}, } function ENT:Initialize() diff --git a/gamemode/itemsystem/items/fence.lua b/gamemode/itemsystem/items/fence.lua index 2f2c5bf..2d767d4 100644 --- a/gamemode/itemsystem/items/fence.lua +++ b/gamemode/itemsystem/items/fence.lua @@ -8,7 +8,8 @@ ITEM.Recipe = { Resources = { ["Plank"] = 2, ["Sap"] = 1, - } + }, + Tools = {}, } ITEM.Structure = { diff --git a/gamemode/itemsystem/items/floor.lua b/gamemode/itemsystem/items/floor.lua index af3a0fd..bef9ad4 100644 --- a/gamemode/itemsystem/items/floor.lua +++ b/gamemode/itemsystem/items/floor.lua @@ -10,6 +10,7 @@ ITEM.Recipe = { ["Wood"] = 3, ["Sap"] = 1, }, + Tools = {}, } ITEM.Structure = { diff --git a/gamemode/itemsystem/items/ramp.lua b/gamemode/itemsystem/items/ramp.lua index 10575e2..1b4a29f 100644 --- a/gamemode/itemsystem/items/ramp.lua +++ b/gamemode/itemsystem/items/ramp.lua @@ -10,6 +10,7 @@ ITEM.Recipe = { ["Log"] = 1, ["Sap"] = 1, }, + Tools = {}, } ITEM.Structure = { diff --git a/gamemode/npcsystem/npcs/antlion1.lua b/gamemode/npcsystem/npcs/antlion1.lua index 2c3d908..3e90e19 100644 --- a/gamemode/npcsystem/npcs/antlion1.lua +++ b/gamemode/npcsystem/npcs/antlion1.lua @@ -36,6 +36,12 @@ NPC.IdleSequences = { --Attacks should be formated as [i]={function (return int dammage) canattack(ply) = function doattack(ply)} --NPC will do the most dammage possible per attack local checkmele = function(self, ply) + if not self then + print("In antlion1, checkmele called with null self") + end + if not ply then + print("In antlion1, checkmele called with null ply") + end if(ply:GetPos():Distance(self:GetPos()) < 100) then return 20 end return -1 end diff --git a/gamemode/npcsystem/npcs/antlion2.lua b/gamemode/npcsystem/npcs/antlion2.lua index 5b53b8e..28154cc 100644 --- a/gamemode/npcsystem/npcs/antlion2.lua +++ b/gamemode/npcsystem/npcs/antlion2.lua @@ -36,6 +36,12 @@ NPC.IdleSequences = { --Attacks should be formated as [i]={function (return int dammage) canattack(ply) = function doattack(ply)} --NPC will do the most dammage possible per attack local checkmele = function(self, ply) + if not self then + print("In antlion2, checkmele called with null self") + end + if not ply then + print("In antlion2, checkmele called with null ply") + end if(ply:GetPos():Distance(self:GetPos()) < 100) then return 20 end return -1 end diff --git a/gamemode/npcsystem/npcs/zombie.lua b/gamemode/npcsystem/npcs/zombie.lua index 41dad0f..e62b833 100644 --- a/gamemode/npcsystem/npcs/zombie.lua +++ b/gamemode/npcsystem/npcs/zombie.lua @@ -37,6 +37,12 @@ NPC.IdleSequences = { --Attacks should be formated as [i]={function (return int dammage) canattack(ply) = function doattack(ply)} --NPC will do the most dammage possible per attack local checkmele = function(self, ply) + if not self then + print("In zombie, checkmele called with null self") + end + if not ply then + print("In zombie, checkmele called with null ply") + end if(ply:GetPos():Distance(self:GetPos()) < 100) then return 20 end return -1 end -- cgit v1.2.3-70-g09d2