Trigger OnRemove on a Creatures scripts when it gets switched out.
This commit is contained in:
parent
a570e90f67
commit
364bac7de7
|
@ -1,6 +1,7 @@
|
||||||
#include "BattleSide.hpp"
|
#include "BattleSide.hpp"
|
||||||
#include "../EventHooks/EventDataClasses.hpp"
|
#include "../EventHooks/EventDataClasses.hpp"
|
||||||
#include "Battle.hpp"
|
#include "Battle.hpp"
|
||||||
|
#include "../ScriptHandling/ScriptMacros.hpp"
|
||||||
|
|
||||||
using namespace CreatureLib::Battling;
|
using namespace CreatureLib::Battling;
|
||||||
|
|
||||||
|
@ -52,6 +53,7 @@ void BattleSide::SetChoice(BaseTurnChoice* choice) {
|
||||||
void BattleSide::SetCreature(ArbUt::OptionalBorrowedPtr<Creature> creature, uint8_t index) {
|
void BattleSide::SetCreature(ArbUt::OptionalBorrowedPtr<Creature> creature, uint8_t index) {
|
||||||
auto old = _creatures[index];
|
auto old = _creatures[index];
|
||||||
if (old.HasValue()) {
|
if (old.HasValue()) {
|
||||||
|
HOOK(OnRemove, this);
|
||||||
old.GetValue()->SetOnBattleField(false);
|
old.GetValue()->SetOnBattleField(false);
|
||||||
}
|
}
|
||||||
_creatures[index] = creature;
|
_creatures[index] = creature;
|
||||||
|
|
Loading…
Reference in New Issue