From 64571b36f7616ef541eb6a33e7fbd5bfa6bbdde3 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Sun, 29 May 2016 20:42:56 -0400 Subject: Changed if/then statements in antlions 1 and 2 to asserts --- gamemode/npcsystem/npcs/antlion1.lua | 8 ++------ gamemode/npcsystem/npcs/antlion2.lua | 8 ++------ 2 files changed, 4 insertions(+), 12 deletions(-) (limited to 'gamemode/npcsystem') diff --git a/gamemode/npcsystem/npcs/antlion1.lua b/gamemode/npcsystem/npcs/antlion1.lua index 259f108..10b9395 100644 --- a/gamemode/npcsystem/npcs/antlion1.lua +++ b/gamemode/npcsystem/npcs/antlion1.lua @@ -36,12 +36,8 @@ 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 self == nil then - print("In antlion1, checkmele called with null self") - end - if ply == nil then - print("In antlion1, checkmele called with null ply") - end + assert(self != nil, "checkmele called on nil npc!") + assert(ply != nil, "checkmelecalled for nil player!") 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 6c16c72..e60e517 100644 --- a/gamemode/npcsystem/npcs/antlion2.lua +++ b/gamemode/npcsystem/npcs/antlion2.lua @@ -36,12 +36,8 @@ 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 self == nil then - print("In antlion2, checkmele called with null self") - end - if ply == nil then - print("In antlion2, checkmele called with null ply") - end + assert(self != nil, "checkmele called on nil npc!") + assert(ply != nil, "checkmelecalled for nil player!") if(ply:GetPos():Distance(self:GetPos()) < 100) then return 20 end return -1 end -- cgit v1.2.3-70-g09d2