chore(cbs/heroactor): first round of dead code cleanup

This commit is contained in:
Kazhnuz 2020-07-24 20:04:12 +02:00
parent 799a532523
commit bb3d823404

View file

@ -1,8 +1,6 @@
local Battler = require("scenes.battlesystem.actors.battler") local Battler = require("scenes.battlesystem.actors.battler")
local Hero = Battler:extend() local Hero = Battler:extend()
local gui = require "game.modules.gui"
local ChoregraphySystem = require "scenes.battlesystem.actors.systems.choregraphy" local ChoregraphySystem = require "scenes.battlesystem.actors.systems.choregraphy"
-- INIT FUNCTIONS -- INIT FUNCTIONS
@ -15,67 +13,25 @@ function Hero:new(world, x, y, owner, charnumber)
self:initMovementSystem() self:initMovementSystem()
--self:initCharacter(charid)
self:initSprite() self:initSprite()
self:initChoregraphySystem() self:initChoregraphySystem()
self.side = "heroes" self.side = "heroes"
end end
-- CHARACTER FUNCTIONS
-- All functions related to character handling
function Hero:initCharacter(charid)
if charid == nil then
core.debug:error("FATAL ERROR: charid not set")
end
self.owner.name = charid
self.turnAction = nil
end
-- ACTIVITY FUNCTION
-- Function to set or unset activity to the character
function Hero:setActive()
core.debug:print("cbs/hero", "hero " .. self.owner.name .. " is now active")
local gridsize = game.characters.list[self.owner.name].move
if (gridsize == nil) then
gridsize = 3
core.debug:warning("cbs/character", "move value is nil")
end
self.world.cursor:setGrid(self.x, self.y, "circle", gridsize, 1, self)
self.x, self.y = utils.math.round(self.x), utils.math.round(self.y)
self.startx, self.starty = self.x, self.y
self.world.cursor:set(self.startx, self.starty, "cursorMove")
self.directionPrevious = self.direction
end
-- UPDATE FUNCTION -- UPDATE FUNCTION
-- Update the hero -- Update the hero
function Hero:update(dt) function Hero:update(dt)
Hero.super.update(self, dt) Hero.super.update(self, dt)
-- Get keys to have some keyboard functions
self.keys = self.scene:getKeys(1)
-- Calculate speed to calculate animation speed -- Calculate speed to calculate animation speed
self:updateSpeed(dt) self:updateSpeed(dt)
self:updateChoregraphy(dt) self:updateChoregraphy(dt)
if (self.scene:haveMenus()) then
self:changeDirection(dt)
end
self.xprevious = self.x self.xprevious = self.x
self.yprevious = self.y self.yprevious = self.y
self.zprevious = self.z self.zprevious = self.z
--self.statusbar:update(dt)
end end
-- MOVE FUNCTIONS -- MOVE FUNCTIONS
@ -153,15 +109,6 @@ function Hero:updateSpeed(dt)
self:setCustomSpeed(self.gspeed * 320) self:setCustomSpeed(self.gspeed * 320)
end end
function Hero:changeDirection(dt)
-- Change direction by pressing left or right when selecting the next action
if (self.keys["left"].isPressed) then
self.direction = -1
elseif (self.keys["right"].isPressed) then
self.direction = 1
end
end
function Hero:initJump() function Hero:initJump()
self.jump = {} self.jump = {}
self.jump.spin = false self.jump.spin = false
@ -315,13 +262,6 @@ function Hero:unblockChoregraphy()
self.blockingChoregraphy = "" self.blockingChoregraphy = ""
end end
-- INFO FUNCTIONS
-- Getting info about the actor
function Hero:getCharacterData()
return game.characters.list[self.owner.name]
end
-- ASSETS FUNCTIONS -- ASSETS FUNCTIONS
-- Load and play assets needed by the character -- Load and play assets needed by the character