diff --git a/localrunner/visualizer/index.html b/localrunner/visualizer/index.html index f4f4579..a034055 100644 --- a/localrunner/visualizer/index.html +++ b/localrunner/visualizer/index.html @@ -35,30 +35,38 @@
-
-
- +
+
+
+
+ +
+
+ +
+
+ x1 +
+
+ x2 +
+
+ x4 +
+
-
- +
+
+ Игрок слева: 0 очков,
+ Игрок справа: 0 очков,
+ Осталось: 02:00
+ Seed: +
-
- x1 -
-
- x2 -
-
- x4 -
-
-
-
- Игрок слева: 0 очков,
- Игрок справа: 0 очков,
- Осталось: 02:00
diff --git a/localrunner/visualizer/js/events.js b/localrunner/visualizer/js/events.js index 1ff74ef..0a5a4ec 100644 --- a/localrunner/visualizer/js/events.js +++ b/localrunner/visualizer/js/events.js @@ -24,6 +24,7 @@ define(['conf', 'underscore'], function (conf, _) { var currentSpan = $('.js-score-time-user'); var leftConsole = $('#left-console'); var rightConsole = $('#right-console'); + var seedSpan = $('.js-seed'); var visio = data; var config = visio.config; @@ -33,6 +34,7 @@ define(['conf', 'underscore'], function (conf, _) { conf.WIDTH = ww.width(); conf.FLOOR_HEIGHT *= conf.MULTIPL; conf.HEIGHT = (config.FLOORS_COUNT + 1) * conf.FLOOR_HEIGHT; + seedSpan.html(config.SEED || '—'); var renderer = new PIXI.autoDetectRenderer(conf.WIDTH, conf.HEIGHT); var world = init.initWorld(visio.game_data, config, renderer, scoreAndTimeSetter(currentSpan, visio.players), range, leftConsole, rightConsole); diff --git a/localrunner/world/core/game_objects/passenger.py b/localrunner/world/core/game_objects/passenger.py index e012ef4..a8ca91d 100644 --- a/localrunner/world/core/game_objects/passenger.py +++ b/localrunner/world/core/game_objects/passenger.py @@ -159,9 +159,7 @@ def on_tick(self): if self.state == self.PASSENGER_STATE['moving_to_elevator']: if self.elevator.floor == self.floor and self.elevator.is_filling(): - if self.elevator.x < 0 and self.x > self.elevator.x: - self.move(x=sign(self.elevator.x)) - elif self.elevator.x > 0 and self.x < self.elevator.x: + if abs(self.x - self.elevator.x) >= self.speed: self.move(x=sign(self.elevator.x)) elif self.elevator.floor == self.from_floor and self.elevator.can_enter(): self.elevator.enter(self) diff --git a/localrunner/world/core/settings.py b/localrunner/world/core/settings.py index 87e24b8..41918f3 100644 --- a/localrunner/world/core/settings.py +++ b/localrunner/world/core/settings.py @@ -1,4 +1,12 @@ -from random import randint +from random import randint, seed +import sys + +try: + sd = int(sys.argv[1]) +except (ValueError, TypeError, IndexError): + sd = randint(0, 10000000) + +seed(sd) PLAYERS = { "FIRST_PLAYER_KEY": "FIRST_PLAYER", @@ -20,6 +28,7 @@ 'FLOORS_COUNT': 9, 'FIRST_FLOOR': 1, 'INDICATOR_POSITION': 350, + 'SEED': sd } BUILDING.update(BUILDING_VISIO)