| 60 | } |
| 61 | |
| 62 | bool ScriptBatch::spawn(const std::string& speciesName, const sol::object& positionObject, const sol::object& optionsObject) { |
| 63 | const glm::vec3 position = readVec3Object(positionObject); |
| 64 | const SpawnOptions options = parseSpawnOptions(optionsObject); |
| 65 | if (const std::optional<AtomData::Type> atomType = findAtomTypeBySymbol(speciesName); atomType.has_value()) { |
| 66 | (void)simulation_.appendAtomFast(position, options.velocity, *atomType, options.fixed); |
| 67 | return true; |
| 68 | } |
| 69 | return simulation_.spawnMolecule(speciesName, position, std::nullopt, options.fixed); |
| 70 | } |
| 71 | |
| 72 | bool ScriptBatch::random_spawn(const std::string& speciesName, const sol::object& optionsObject) { |
| 73 | return simulation_.randomSpawn(speciesName, parseSpawnOptions(optionsObject)); |
nothing calls this directly
no test coverage detected