chore:refactor RedianceWorld out of the test scene

This commit is contained in:
Kazhnuz 2019-07-26 20:22:18 +02:00
parent dc1d5b2f04
commit fb2600c363
9 changed files with 18 additions and 8 deletions

View file

@ -28,6 +28,8 @@ local Characters = require "game.characters"
local binser = require "core.modules.gamesystem.libs.binser"
Game.utils = require "game.modules.utils"
function Game:new()
self.slot = -1
self.gametime = 0

View file

@ -1,15 +1,14 @@
local gameutils = {}
function gameutils.getMapPath(maptype, mapname)
if (maptype ~= "battle") then
error("Map type " .. maptype .. " doesn't exist.")
end
return "datas.gamedata.maps." .. maptype .. "." .. mapname
local dir = gameutils.getMapDirectory(maptype, mapname)
local path = dir .. "map.lua"
core.debug:print("game/utils", "path is " .. path)
return path
end
function gameutils.getMapDirectory(maptype, mapname)
if (maptype ~= "battle") then
if (maptype ~= "battle") and (maptype ~= "sti") then
error("Map type " .. maptype .. " doesn't exist.")
end

View file

@ -0,0 +1,9 @@
local World3D = require "core.modules.world.world3D"
local RadianceWorld = World3D:extend()
function RadianceWorld:new(scene, maptype, mapname)
local mappath = game.utils.getMapPath(maptype, mapname)
RadianceWorld.super.new(self, scene, "game.modules.world.actors", mappath, maptype)
end
return RadianceWorld

View file

@ -24,7 +24,7 @@
local Scene = require "core.modules.scenes"
local MovePlayer = Scene:extend()
local World = require "core.modules.world.world3D"
local World = require "game.modules.world"
function MovePlayer:new(playerNumber, cameraMode)
local playerNumber = playerNumber or 1
@ -33,7 +33,7 @@ function MovePlayer:new(playerNumber, cameraMode)
MovePlayer.super.new(self)
self.assets:batchImport("scenes.test_scene.assets")
World(self, "scenes.test_scene.actors", "datas/gamedata/maps/sti/test/arena.lua")
World(self, "sti", "test")
self.world:setPlayerNumber(playerNumber)
self.world.cameras:setMode(cameraMode)