X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=server%2Fnew_thing.py;fp=server%2Fnew_thing.py;h=84bc5917d15ec5abc385fd080579088e0c357504;hb=d29cadf50b9a1daed21fa1d68a5c86ca5d953856;hp=0000000000000000000000000000000000000000;hpb=1c3d2bf4aefbdb73b4932c1d158a77ada9643b4d;p=plomrogue diff --git a/server/new_thing.py b/server/new_thing.py new file mode 100644 index 0000000..84bc591 --- /dev/null +++ b/server/new_thing.py @@ -0,0 +1,21 @@ +# 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. + + +def new_Thing(_type, pos=(0, 0)): + """Return Thing of type T_TYPE, with fovmap if alive and world active.""" + from server.config.world_data import thing_defaults, world_db + from server.build_fov_map import build_fov_map + thing = {} + for key in thing_defaults: + thing[key] = thing_defaults[key] + if type(thing[key]) == list: + thing[key] = thing[key][:] + thing["T_LIFEPOINTS"] = world_db["ThingTypes"][_type]["TT_LIFEPOINTS"] + thing["T_TYPE"] = _type + thing["T_POSY"] = pos[0] + thing["T_POSX"] = pos[1] + if world_db["WORLD_ACTIVE"] and thing["T_LIFEPOINTS"]: + build_fov_map(thing) + return thing