home · contact · privacy
Server, plugin: Refactor make_world modularity.
[plomrogue] / server / world_makable.py
1 # This file is part of PlomRogue. PlomRogue is licensed under the GPL version 3
2 # or any later version. For details on its copyright, license, and warranties,
3 # see the file NOTICE in the root directory of the PlomRogue source package.
4
5
6 def world_makable():
7     from server.config.world_data import world_db
8     if world_db["MAP_LENGTH"] < 1:
9         print("Ignoring: No map length >= 1 defined.")
10         return -1 
11     player_will_be_generated = False
12     playertype = world_db["PLAYER_TYPE"]
13     for ThingType in world_db["ThingTypes"]:
14         if playertype == ThingType:
15             if 0 < world_db["ThingTypes"][ThingType]["TT_START_NUMBER"]:
16                 player_will_be_generated = True
17             break
18     if not player_will_be_generated:
19         print("Ignoring: No player type with start number >0 defined.")
20         return -1 
21     wait_action = False
22     for ThingAction in world_db["ThingActions"]:
23         if "wait" == world_db["ThingActions"][ThingAction]["TA_NAME"]:
24             wait_action = True
25     if not wait_action:
26         print("Ignoring beyond SEED_MAP: " +
27               "No thing action with name 'wait' defined.")
28         return -1 
29     return playertype