Add functions to add volatile scripts to Creature.cpp.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-02-22 15:53:51 +01:00
parent 32584ac406
commit 142889ad8a
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
2 changed files with 8 additions and 0 deletions

View File

@ -185,3 +185,9 @@ void Battling::Creature::SetHeldItem(const std::string& itemName) {
} }
_heldItem = item; _heldItem = item;
} }
void Battling::Creature::AddVolatileScript(const std::string& name) {
auto script = this->_library->LoadScript(ScriptCategory::Creature, name);
_volatile.Add(script);
}
void Battling::Creature::AddVolatileScript(Script* script) { _volatile.Add(script); }

View File

@ -116,6 +116,8 @@ namespace CreatureLib::Battling {
void GetActiveScripts(std::vector<ScriptWrapper>& scripts) override; void GetActiveScripts(std::vector<ScriptWrapper>& scripts) override;
void ClearVolatileScripts(); void ClearVolatileScripts();
void AddVolatileScript(const std::string& name);
void AddVolatileScript(Script* script);
std::vector<LearnedAttack*>& GetAttacks() { return _attacks; } std::vector<LearnedAttack*>& GetAttacks() { return _attacks; }