home · contact · privacy
Use temporary SpawnPoints to store logged-out players' positions for up to ten minutes.
[plomrogue2] / plomrogue / commands.py
index 921d6e011c498744bb64659925be7cce66ffb140..9cdab97a20963109c70460b6135c610b8cf94aaf 100644 (file)
@@ -414,3 +414,17 @@ cmd_THING_CRATE_ITEM.argtypes = 'int:pos int:pos'
 def cmd_MAP_CONTROL_PRESETS(game, draw_control_presets):
     game.draw_control_presets = draw_control_presets
 cmd_MAP_CONTROL_PRESETS.argtypes = 'bool'
+
+def cmd_THING_SPAWNPOINT_CREATED(game, spawnpoint_id, timestamp):
+    import datetime
+    spawnpoint = game.get_thing(spawnpoint_id)
+    if not spawnpoint:
+        raise GameError('thing of ID %s not found' % spawnpoint_id)
+    if spawnpoint.type_ != 'SpawnPoint':
+        raise GameError('thing of ID %s not a SpawnPoint' % spawnpoint_id)
+    if timestamp == 0:
+        spawnpoint.temporary = False
+    else:
+        spawnpoint.temporary = True
+        spawnpoint.created_at = datetime.datetime.fromtimestamp(timestamp)
+cmd_THING_SPAWNPOINT_CREATED.argtypes = 'int:pos int:nonneg'