# see the file NOTICE in the root directory of the PlomRogue source package.
-import server.thingproliferation_helpers
+from server.config.world_data import symbols_passable
-field_spreadable = server.thingproliferation_helpers.field_spreadable
+field_spreadable = lambda x, y: x in symbols_passable
thingprol_plugin_conditions = lambda x: True
thingprol_plugin_post_create_hook = lambda x: None
from server.config.world_data import directions_db, world_db
from server.config.thingproliferation import field_spreadable, \
thingprol_plugin_conditions, thingprol_plugin_post_create_hook
- from server.utils import mv_yx_in_dir_legal, rand
+ from server.utils import mv_yx_in_dir_legal, rand, id_setter
from server.new_thing import new_Thing
prolscore = world_db["ThingTypes"][t["T_TYPE"]]["TT_PROLIFERATE"]
if prolscore and (1 == prolscore or 1 == (rand.next() % prolscore)) and \
thingprol_plugin_conditions(t):
candidates = []
- for dir in [directions_db[key] for key in sorted(directions_db.keys())]:
- mv_result = mv_yx_in_dir_legal(dir, t["T_POSY"], t["T_POSX"])
- c = str(prol_map[mv_result[1] + world_db["MAP_LENGTH"]
- + mv_result[2]])
+ for key in sorted(directions_db.keys()):
+ mv_result = mv_yx_in_dir_legal(directions_db[key], t["T_POSY"],
+ t["T_POSX"])
+ c = chr(prol_map[mv_result[1] * world_db["MAP_LENGTH"]
+ + mv_result[2]])
if mv_result[0] and field_spreadable(c, t):
+ from server.io import log
+ log("PROL")
candidates.append((mv_result[1], mv_result[2]))
if len(candidates):
i = rand.next() % len(candidates)
- id = id_setter(-1, "Things")
+ tid = id_setter(-1, "Things")
newT = new_Thing(t["T_TYPE"], (candidates[i][0], candidates[i][1]))
- world_db["Things"][id] = newT
+ world_db["Things"][tid] = newT
thingprol_plugin_post_create_hook(t)
+++ /dev/null
-# This file is part of PlomRogue. PlomRogue is licensed under the GPL version 3
-# or any later version. For details on its copyright, license, and warranties,
-# see the file NOTICE in the root directory of the PlomRogue source package.
-
-
-from server.config.world_data import symbols_passable
-
-
-def field_spreadable(field_type, ignore):
- return field_type in symbols_passable
id = 0
while world_db["Things"][0]["T_LIFEPOINTS"]:
proliferable_map = world_db["MAP"][:]
- for id in [id for id in world_db["Things"]
- if not world_db["Things"][id]["carried"]]:
- y = world_db["Things"][id]["T_POSY"]
- x = world_db["Things"][id]["T_POSX"]
+ for tid in [tid for tid in world_db["Things"]
+ if not world_db["Things"][tid]["carried"]]:
+ y = world_db["Things"][tid]["T_POSY"]
+ x = world_db["Things"][tid]["T_POSX"]
proliferable_map[y * world_db["MAP_LENGTH"] + x] = ord('X')
for id in [id for id in world_db["Things"]]: # Only what's from start!
if not id in world_db["Things"] or \