improvement(cbs): improve debugging

This commit is contained in:
Kazhnuz 2019-08-13 22:28:05 +02:00
parent 3a037e827d
commit a8bd55a2c2
3 changed files with 5 additions and 7 deletions

View file

@ -88,12 +88,12 @@ end
function BattleArena:getObjectInCase(x, y) function BattleArena:getObjectInCase(x, y)
for i,v in ipairs(self.entities) do for i,v in ipairs(self.entities) do
if (v.x == x) and (v.y == y) then if (v.x == x) and (v.y == y) then
print("one entity found in case " .. x .. ";" .. y) core.debug:print("cbs/battlearena", "one entity found in case <" .. x .. ";" .. y .. ">")
return v return v
end end
end end
print("no entity found in case " .. x .. ";" .. y) --core.debug:print("cbs/battlearena", "no entity found in case " .. x .. ";" .. y)
return nil return nil
end end

View file

@ -11,17 +11,15 @@ function Actor:new(controller, x, y, z)
end end
function Actor:setActive() function Actor:setActive()
print("actor " .. self.id .. " is active") core.debug:print("cbs/actor","actor " .. self.id .. " is active")
self.isActive = true self.isActive = true
self.debugActiveTimer = 0 self.debugActiveTimer = 0
print(self.debugActiveTimer)
end end
function Actor:update(dt) function Actor:update(dt)
if (self.isActive) then if (self.isActive) then
self.debugActiveTimer = self.debugActiveTimer + dt self.debugActiveTimer = self.debugActiveTimer + dt
print(math.floor(self.debugActiveTimer * 60)) if self.debugActiveTimer >= 0.5 then
if self.debugActiveTimer >= 1 then
self.controller.actormanager:switchActiveActor() self.controller.actormanager:switchActiveActor()
--self.controller.actormanager.turns.changeActor = false --self.controller.actormanager.turns.changeActor = false
self.isActive = false self.isActive = false

View file

@ -11,7 +11,7 @@ function Character:new(controller, x, y, charid)
self.directionPrevious = 1 self.directionPrevious = 1
if charid == nil then if charid == nil then
err("FATAL ERROR: charid not set") core.debug:error("FATAL ERROR: charid not set")
end end
self.charid = charid self.charid = charid
self.actionPerTurn = game.characters.list[self.charid].turns self.actionPerTurn = game.characters.list[self.charid].turns