def get_current_daemon():
		sglobal = utils_storage.obj_storage_by_id("global")
		if (sglobal):
			daemon_id = sglobal.get_data("daemon-{}".format(toee.game.leader.map))
			if (daemon_id):
				daemon_storage = utils_storage.obj_storage_by_id(daemon_id)
				if (daemon_storage and daemon_storage.data):
					for ctrl in daemon_storage.data.itervalues():
						if ("can_sleep" in dir(ctrl)):
							return ctrl
		return None
Beispiel #2
0
def get_ctrl(id):
    assert isinstance(id, str)
    ctrl = None
    storage = utils_storage.obj_storage_by_id(id)
    if (storage):
        for t in storage.data.iteritems():
            if (issubclass(type(t[1]), CtrlBehaviour)):
                ctrl = t[1]
                break
    return ctrl
Beispiel #3
0
def san_dying(attachee, triggerer):
    assert isinstance(attachee, toee.PyObjHandle)
    c = cs()
    if (c):
        c.critter_dying(attachee, triggerer)
    storage = utils_storage.obj_storage_by_id(attachee.id)
    if (storage):
        cb = storage.get_data(ctrl_behaviour.CtrlBehaviour.get_name())
        if ("dying" in dir(cb)):
            cb.dying(attachee, triggerer)
    return toee.RUN_DEFAULT
def cs():
	#print("CtrlShatteredLab.get_name(): {}".format(CtrlShatteredLab.get_name()))
	o = utils_storage.obj_storage_by_id(CASTLE_DUNGEON_DAEMON_ID)
	#print("utils_storage.obj_storage(): {}".format(o))
	if (not o): return None
	if (CtrlCastleDungeon.get_name() in o.data):
		result = o.data[CtrlCastleDungeon.get_name()]
	else: return None
	#print("data: {}".format(result))
	#debugg.breakp("csl")
	return result
Beispiel #5
0
def cs():
    #print("CtrlShatteredLab.get_name(): {}".format(CtrlShatteredLab.get_name()))
    o = utils_storage.obj_storage_by_id(CRYPT_LV1_DAEMON_ID)
    #print("utils_storage.obj_storage(): {}".format(o))
    if (not o): return None
    if (CtrlCryptLv1.get_name() in o.data):
        result = o.data[CtrlCryptLv1.get_name()]
    else:
        return None
    #print("data: {}".format(result))
    #debugg.breakp("csl")
    return result
Beispiel #6
0
 def set_daemon(deamon_id, map_id):
     sglobal = utils_storage.obj_storage_by_id("global")
     if (sglobal):
         sglobal.data["daemon-{}".format(map_id)] = deamon_id
     return None