MCPcopy Create free account
hub / github.com/ElectroZybr/LatticeLab / parseSpawnOptions

Method parseSpawnOptions

Lattice/Scripting/ScriptAPI.cpp:84–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84SpawnOptions ScriptBatch::parseSpawnOptions(const sol::object& object) const {
85 const glm::vec3 worldSize = simulation_.world().getWorldSize();
86 SpawnOptions options;
87 options.max = worldSize;
88 if (!object.is<sol::table>()) {
89 return options;
90 }
91
92 const sol::table table = object.as<sol::table>();
93 if (const sol::object velocity = table["velocity"]; velocity.is<sol::table>()) {
94 options.velocity = readVec3Object(velocity);
95 }
96 if (const sol::object regionObject = table["region"]; regionObject.is<sol::table>()) {
97 const sol::table regionTable = regionObject.as<sol::table>();
98 options.min = readVec3Object(regionTable["min"], options.min);
99 options.max = readVec3Object(regionTable["max"], options.max);
100 }
101 options.temperature = table.get_or("temperature", options.temperature);
102 options.margin = table.get_or("margin", options.margin);
103 options.minDistance = table.get_or("min_distance", options.minDistance);
104 options.maxAttempts = table.get_or("attempts", options.maxAttempts);
105 options.randomRotation = table.get_or("random_rotation", options.randomRotation);
106 options.fixed = table.get_or("fixed", options.fixed);
107 return options;
108}
109
110void ScriptAPI::clear() { simulation_.clear(); }
111

Callers

nothing calls this directly

Calls 1

readVec3ObjectFunction · 0.85

Tested by

no test coverage detected