MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / ASCreateObject

Function ASCreateObject

Source/Scripting/angelscript/asfuncs.cpp:2558–2576  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2556}
2557
2558int ASCreateObject(const std::string& path, bool exclude_from_save) {
2559 int id = -1;
2560 EntityDescriptionList desc_list;
2561 std::string file_type;
2562 Path source;
2563 ActorsEditor_LoadEntitiesFromFile(path, desc_list, &file_type, &source);
2564 for (auto& i : desc_list) {
2565 Object* obj = MapEditor::AddEntityFromDesc(the_scenegraph, i, false);
2566 if (obj) {
2567 obj->exclude_from_undo = exclude_from_save;
2568 obj->exclude_from_save = exclude_from_save;
2569 obj->permission_flags = 0;
2570 id = obj->GetID();
2571 } else {
2572 LOGE << "Failed at creating object from: " << path << std::endl;
2573 }
2574 }
2575 return id;
2576}
2577
2578int ASCreateObject2(const std::string& path) {
2579 return ASCreateObject(path, true);

Callers 2

CUpdateShadowImplFunction · 0.85
ASCreateObject2Function · 0.85

Calls 2

GetIDMethod · 0.45

Tested by

no test coverage detected