Esempio n. 1
0
 def on_unbind_spawner(self, event):
     name = self.__get_selected_list_item( self.ID_Spawner )
     spawner = servers.get_world_interface().getgameentity( str(name) )
     if spawner is not None:
         self.entity.removespawner( spawner )
         index = self.__get_selected_list_index()
         self.list.DeleteItem( index )
         self.__update_binding_ctrls()
Esempio n. 2
0
 def on_unbind_spawner(self, event):
     name = self.__get_selected_list_item(self.ID_Spawner)
     spawner = servers.get_world_interface().getgameentity(str(name))
     if spawner is not None:
         self.entity.removespawner(spawner)
         index = self.__get_selected_list_index()
         self.list.DeleteItem(index)
         self.__update_binding_ctrls()
Esempio n. 3
0
 def on_select_spawner(self, event):
     name = self.__get_selected_list_item(self.ID_Spawner)
     spawner = servers.get_world_interface().getgameentity(str(name))
     if spawner is None:
         cjr.show_error_message("Spawner '" + name + "'  not found.")
     else:
         state = app.get_object_state()
         entity_id = spawner.getid()
         state.addentitytoselection(entity_id)
Esempio n. 4
0
 def __update_binding_ctrls(self):
     name = self.__get_selected_list_item( self.ID_Spawner )
     spawner = servers.get_world_interface().getgameentity( str(name) )
     enable = spawner is not None
     self.button_unbind.Enable( enable )
     self.button_select.Enable( enable )
     self.float_probability.Enable( enable )
     if enable:
         probability = self.entity.getspawnerprobability( spawner )
         self.float_probability.set_value( probability )
Esempio n. 5
0
 def __update_binding_ctrls(self):
     name = self.__get_selected_list_item(self.ID_Spawner)
     spawner = servers.get_world_interface().getgameentity(str(name))
     enable = spawner is not None
     self.button_unbind.Enable(enable)
     self.button_select.Enable(enable)
     self.float_probability.Enable(enable)
     if enable:
         probability = self.entity.getspawnerprobability(spawner)
         self.float_probability.set_value(probability)
Esempio n. 6
0
 def on_select_spawner(self, event):
     name = self.__get_selected_list_item( self.ID_Spawner )
     spawner = servers.get_world_interface().getgameentity( str(name) )
     if spawner is None:
         cjr.show_error_message(
             "Spawner '" + name + "'  not found."
             )
     else:
         state = app.get_object_state()
         entity_id = spawner.getid()
         state.addentitytoselection( entity_id )
Esempio n. 7
0
 def on_change_probability(self, event):
     name = self.__get_selected_list_item(self.ID_Spawner)
     spawner = servers.get_world_interface().getgameentity(str(name))
     if spawner is None:
         cjr.show_error_message("Spawner '" + name + "'  not found.")
     else:
         probability = self.float_probability.get_value()
         self.entity.setprobability(spawner, probability)
         index = self.__get_selected_list_index()
         self.list.SetStringItem(index, self.ID_Probability,
                                 str(probability))
Esempio n. 8
0
 def on_change_probability(self, event):
     name = self.__get_selected_list_item( self.ID_Spawner )
     spawner = servers.get_world_interface().getgameentity( str(name) )
     if spawner is None:
         cjr.show_error_message(
             "Spawner '" + name + "'  not found."
             )
     else:
         probability = self.float_probability.get_value()
         self.entity.setprobability( spawner, probability )
         index = self.__get_selected_list_index()
         self.list.SetStringItem( index, self.ID_Probability, str(probability) )
Esempio n. 9
0
 def unpackEntitiesAndAddToWorld(self):
     entity_server = servers.get_entity_object_server()
     world_server = servers.get_world_interface()
     number_of_elements = self.containerObject.size()
     for index in range(number_of_elements):
         entity = self.containerObject.at(index)
         original_id = self.containerObject.getobjectnameatindex(index)
         #check if the entity already exists
         match = entity_server.getentityobject( int(original_id) )
         if not match == None:
             result = cjr.confirm_yes_no(
                             self.parentView, 
                             "This entity already exists. "\
                             "Do you want to overwrite it?"
                             )
             wantsToOverwrite = (result == wx.ID_YES)
             if wantsToOverwrite:
                 entity_server.swapentityobjectids(match, entity)
                 entity_server.removeentityobject(match)
         entity.setlayerid(self.targetLayerId)
         world_server.addtoworld(entity)
Esempio n. 10
0
 def on_create_and_attach_entity(self, event):
     # Show a grimoire browser to let the user choose an entity class
     dlg = grimoire.create_dialog( self )
     ok = dlg.ShowModal() == wx.ID_OK
     class_name = dlg.GetTitle()
     dlg.Destroy()
     if not ok:
         return
     
     # Create an instance of the selected class
     # position (1, 1, 1) is used just to pass the spatial search cell check
     # it is not important, since the attachment is always linked to the entity pos
     entity = servers.get_world_interface().newentity( str(class_name), 1, 1, 1 )
     if entity is None:
         cjr.show_error_message(
             "Unknown error.\nCouldn't create an instance of" \
             "the entity class '" + class_name + "'."
             )
         return
     
     # Attach the new entity to the selected slot
     self.__attach_entity_to_current_slot( entity )
Esempio n. 11
0
    def on_create_and_plug_entity(self, event):
        # Show a grimoire browser to let the user choose an entity class
        dlg = grimoire.create_dialog(self)
        ok = dlg.ShowModal() == wx.ID_OK
        class_name = dlg.GetTitle()
        dlg.Destroy()
        if not ok:
            return

        # Create an instance of the selected class
        # position (1, 1, 1) is used just to pass the spatial search cell check
        # it is not important, since the plug is always linked to the entity pos
        entity = servers.get_world_interface().newentity(
            str(class_name), 1, 1, 1)
        if entity is None:
            cjr.show_error_message(
                "Unknown error.\nCouldn't create an instance of" \
                "the entity class '" + class_name + "'."
                )
            return

        # Plug the new entity to the selected slot
        self.__plug_entity_to_current_slot(entity)