diff options
Diffstat (limited to 'source/game/interfaces/StarScriptedEntity.hpp')
-rw-r--r-- | source/game/interfaces/StarScriptedEntity.hpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/source/game/interfaces/StarScriptedEntity.hpp b/source/game/interfaces/StarScriptedEntity.hpp new file mode 100644 index 0000000..40aa552 --- /dev/null +++ b/source/game/interfaces/StarScriptedEntity.hpp @@ -0,0 +1,25 @@ +#ifndef STAR_SCRIPTED_ENTITY_HPP +#define STAR_SCRIPTED_ENTITY_HPP + +#include "StarEntity.hpp" +#include "StarLua.hpp" + +namespace Star { + +STAR_CLASS(ScriptedEntity); + +// All ScriptedEntity methods should only be called on master entities +class ScriptedEntity : public virtual Entity { +public: + // Call a script function directly with the given arguments, should return + // nothing only on failure. + virtual Maybe<LuaValue> callScript(String const& func, LuaVariadic<LuaValue> const& args) = 0; + + // Execute the given code directly in the underlying context, return nothing + // on failure. + virtual Maybe<LuaValue> evalScript(String const& code) = 0; +}; + +} + +#endif |