danni.coy Posted November 22, 2012 Share Posted November 22, 2012 It would be nice to have some sort of hook in the editor plugins that detects when a new world is loaded... is this currently possible? Link to comment
ulf.schroeter Posted November 22, 2012 Share Posted November 22, 2012 Hi Danni, just a quick idea /******************************************************************************\ * * Plugin * \******************************************************************************/ string plugin_world_name = "no_world"; /* this function should return plugin namespace name */ string getName() { return "Your plugin name"; } /* plugin init */ void init() { } /* plugin shutdown */ void shutdown() { } /* plugin update, need_reload flag indicates that the editor resources should be updated */ void update(int need_reload) { string world_name = engine.world.getName(); if( world_name != plugin_world_name ) { // initial of new world loaded ..... // actions on world_load } plugin_world_name = world_name; ... } Link to comment
danni.coy Posted November 28, 2012 Author Share Posted November 28, 2012 actually that will only work if the world actually changes, but not on a world refresh Link to comment
danni.coy Posted November 28, 2012 Author Share Posted November 28, 2012 my solution was to add code to the world init function that checks whether the editor is loaded (this is only true on a world reload) and send a signal to the editor. Link to comment
frustum Posted November 28, 2012 Share Posted November 28, 2012 Another workaround is to check the game time. If the game time value is small that means we have a new world loaded. Link to comment
Recommended Posts