Add from_ssc command for CEL scripts

pull/123/head
Hleb Valoshka 2018-11-17 20:53:36 +03:00
parent deeca96ddb
commit 9d25ab249f
4 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,3 @@
{
from_ssc { fragment "Modify \"433 Eros:Eros:1898 DQ\" \"Sol\" {UniformRotation {Period 0.01}}" }
}

View File

@ -895,6 +895,12 @@ Command* CommandParser::parseCommand()
paramList->getString("path", path);
cmd = new CommandSetRingsTexture(object, texture, path);
}
else if (commandName == "from_ssc")
{
string fragment;
paramList->getString("fragment", fragment);
cmd = new CommandFromSSC(fragment);
}
else
{
error("Unknown command name '" + commandName + "'");

View File

@ -1175,3 +1175,20 @@ void CommandSetRingsTexture::process(ExecutionEnvironment& env)
sel.body()->getRings()->texture = MultiResTexture(textureName, path);
}
}
///////////////
// FromSSC command
CommandFromSSC::CommandFromSSC(string _fragment) :
fragment(_fragment)
{
}
void CommandFromSSC::process(ExecutionEnvironment& env)
{
Universe* u = env.getSimulation()->getUniverse();
if (u == nullptr)
return;
istringstream in(fragment);
LoadSolarSystemObjects(in, *u, "");
}

View File

@ -813,4 +813,15 @@ class CommandSetRingsTexture : public InstantaneousCommand
std::string object, textureName, path;
};
class CommandFromSSC : public InstantaneousCommand
{
public:
CommandFromSSC(std::string);
void process(ExecutionEnvironment&);
private:
std::string fragment;
};
#endif // _COMMAND_H_