abolished a need to pass world as parametre

+ simply changing the single variable (ingame.world) will update all the renderer's behaviour
+ somehow my git changelogs are exploding
This commit is contained in:
minjaesong
2018-10-05 23:40:03 +09:00
parent 5641910036
commit 83fd44df4c
36 changed files with 344 additions and 268 deletions

View File

@@ -29,8 +29,6 @@ object ImportLayerData : ConsoleCommand {
(Terrarum.ingame!!.world).spawnX * FeaturesDrawer.TILE_SIZE.toDouble()
)
IngameRenderer.
Echo("Successfully loaded ${args[1]}")
}

View File

@@ -13,9 +13,6 @@ import org.dyn4j.geometry.Vector2
internal object SpawnPhysTestBall : ConsoleCommand {
@Throws(Exception::class)
override fun execute(args: Array<String>) {
val world = (Terrarum.ingame!!.world)
val mouseX = Terrarum.mouseX
val mouseY = Terrarum.mouseY
@@ -25,7 +22,7 @@ internal object SpawnPhysTestBall : ConsoleCommand {
val xvel = args[2].toDouble()
val yvel = if (args.size >= 4) args[3].toDouble() else 0.0
val ball = PhysTestBall(world)
val ball = PhysTestBall()
ball.setPosition(mouseX, mouseY)
ball.elasticity = elasticity
ball.applyForce(Vector2(xvel, yvel))
@@ -35,7 +32,7 @@ internal object SpawnPhysTestBall : ConsoleCommand {
else if (args.size == 2) {
val elasticity = args[1].toDouble()
val ball = PhysTestBall(world)
val ball = PhysTestBall()
ball.setPosition(mouseX, mouseY)
ball.elasticity = elasticity

View File

@@ -13,7 +13,7 @@ internal object SpawnPhysTestLunarLander : ConsoleCommand {
override fun execute(args: Array<String>) {
val mouseX = Terrarum.mouseX
val mouseY = Terrarum.mouseY
val lander = PhysTestLuarLander((Terrarum.ingame!!.world))
val lander = PhysTestLuarLander()
lander.setPosition(mouseX, mouseY)

View File

@@ -11,7 +11,7 @@ import net.torvald.terrarum.modulebasegame.gameactors.FixtureTikiTorch
*/
internal object SpawnTikiTorch : ConsoleCommand {
override fun execute(args: Array<String>) {
val torch = FixtureTikiTorch((Terrarum.ingame!!.world))
val torch = FixtureTikiTorch()
torch.setPosition(Terrarum.mouseX, Terrarum.mouseY)
Terrarum.ingame!!.addNewActor(torch)