| 70 | } |
| 71 | |
| 72 | CreateResult CompScriptCreate(const ComponentCreateParams& params) |
| 73 | { |
| 74 | HScript script = (HScript)params.m_Resource; |
| 75 | CompScriptWorld* script_world = (CompScriptWorld*)params.m_World; |
| 76 | if (script_world->m_Instances.Full()) |
| 77 | { |
| 78 | dmLogError("Could not create script component, out of resources. Increase the 'collection.max_instances' value in [game.project](defold://open?path=/game.project)"); |
| 79 | return CREATE_RESULT_UNKNOWN_ERROR; |
| 80 | } |
| 81 | |
| 82 | HScriptInstance script_instance = NewScriptInstance(script_world, script, params.m_Instance, params.m_ComponentIndex); |
| 83 | SetPropertySet(script_instance->m_Properties, PROPERTY_LAYER_PROTOTYPE, params.m_PropertySet); |
| 84 | if (script_instance == 0x0) |
| 85 | { |
| 86 | dmLogError("Could not create script component, out of memory."); |
| 87 | return CREATE_RESULT_UNKNOWN_ERROR; |
| 88 | } |
| 89 | |
| 90 | script_world->m_Instances.Push(script_instance); |
| 91 | *params.m_UserData = (uintptr_t)script_instance; |
| 92 | return CREATE_RESULT_OK; |
| 93 | } |
| 94 | |
| 95 | struct RunScriptParams |
| 96 | { |
nothing calls this directly
no test coverage detected