|
|
|
|
@ -7,6 +7,7 @@
|
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
|
|
import "Components" for VelocityComponent, BlockOutComponent
|
|
|
|
|
import "CoreAPI" for CoreAPI
|
|
|
|
|
|
|
|
|
|
// Manages all of the EntityBehaviors
|
|
|
|
|
class WorldInterface {
|
|
|
|
|
@ -18,15 +19,12 @@ class WorldInterface {
|
|
|
|
|
|
|
|
|
|
static RegisterScript(entity_id, script_name, script_class) {
|
|
|
|
|
|
|
|
|
|
System.print(entity_id.type)
|
|
|
|
|
System.print(script_name.type)
|
|
|
|
|
System.print(script_class.type)
|
|
|
|
|
|
|
|
|
|
if (!__ScriptObjects.containsKey(entity_id)){
|
|
|
|
|
__ScriptObjects[entity_id] = {}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
__ScriptObjects[entity_id][script_name] = script_class.new(entity_id)
|
|
|
|
|
//System.print("Registered script: %(script_name) to entity: %(entity_id)")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
@ -76,10 +74,13 @@ class WorldInterface {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static GetScriptObject(entity_id, script_name) {
|
|
|
|
|
if (__ScriptObjects.containsKey(entity_id) && __ScriptObjects[entity_id].containsKey(script_name)) {
|
|
|
|
|
return __ScriptObjects[entity_id][script_name]
|
|
|
|
|
if (__ScriptObjects.containsKey(entity_id)) {
|
|
|
|
|
if (__ScriptObjects[entity_id].containsKey(script_name)) {
|
|
|
|
|
return __ScriptObjects[entity_id][script_name]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
System.print("Could not find script: %(script_name) for entity: %(entity_id)")
|
|
|
|
|
return null
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|