Пример #1
0
 def ensure(cls, npc):
     data = utils_storage.obj_storage(npc).data
     ctrl = None
     if (cls.get_name() in data):
         ctrl = data[cls.get_name()]
     else:
         ctrl = cls()
         ctrl.created(npc)
         utils_storage.obj_storage(npc).data[cls.get_name()] = ctrl
     return ctrl
Пример #2
0
 def ensure(cls, npc):
     data = utils_storage.obj_storage(npc).data
     ctrl = None
     if (cls.get_name() in data):
         ctrl = data[cls.get_name()]
     else:
         ctrl = cls()
         ctrl.created(npc)
         utils_storage.obj_storage(npc).data[cls.get_name()] = ctrl
         map_default = ctrl.get_map_default()
         if (map_default):
             CtrlDaemon.set_daemon(npc.id, map_default)
     return ctrl
Пример #3
0
 def create_obj_and_class(cls, loc, call_created=1):
     protoid = cls.get_proto_id()
     npc = toee.game.obj_create(protoid, loc)
     ctrl = cls()
     o = utils_storage.obj_storage(npc)
     o.data[cls.get_name()] = ctrl
     o.alias = cls.get_alias()
     if (call_created):
         ctrl.created(npc)
     return npc, ctrl
Пример #4
0
 def get_from_obj(cls, npc):
     data = utils_storage.obj_storage(npc).data
     if (cls.get_name() in data):
         return data[cls.get_name()]
     return