Additional Sail Commands.

Adds "SpawnEnemyWithOffset" and "SpawnActor" to Sail Functions.
This commit is contained in:
Xeokn 2025-01-30 00:44:39 +10:00
parent 83000e2f6a
commit f0b596fabd
3 changed files with 46 additions and 0 deletions

View File

@ -640,4 +640,28 @@ namespace GameInteractionEffect {
void SlipperyFloor::_Remove() {
GameInteractor::State::SlipperyFloorActive = 0;
}
// MARK: - SpawnEnemyWithOffset
GameInteractionEffectQueryResult SpawnEnemyWithOffset::CanBeApplied() {
if (!GameInteractor::IsSaveLoaded()) {
return GameInteractionEffectQueryResult::TemporarilyNotPossible;
}
return GameInteractor::RawAction::SpawnEnemyWithOffset(parameters[0], parameters[1]);
}
void SpawnEnemyWithOffset::_Apply() {
GameInteractor::RawAction::SpawnEnemyWithOffset(parameters[0], parameters[1]);
}
// MARK: - SpawnActor
GameInteractionEffectQueryResult SpawnActor::CanBeApplied() {
if (!GameInteractor::IsSaveLoaded()) {
return GameInteractionEffectQueryResult::TemporarilyNotPossible;
}
return GameInteractor::RawAction::SpawnActor(parameters[0], parameters[1]);
}
void SpawnActor::_Apply() {
GameInteractor::RawAction::SpawnActor(parameters[0], parameters[1]);
}
}

View File

@ -262,6 +262,14 @@ namespace GameInteractionEffect {
void _Apply() override;
void _Remove() override;
};
class SpawnEnemyWithOffset: public GameInteractionEffectBase, public ParameterizedGameInteractionEffect {
GameInteractionEffectQueryResult CanBeApplied() override;
void _Apply() override;
};
class SpawnActor: public GameInteractionEffectBase, public ParameterizedGameInteractionEffect {
GameInteractionEffectQueryResult CanBeApplied() override;
void _Apply() override;
};
}
#endif /* __cplusplus */

View File

@ -320,6 +320,20 @@ GameInteractionEffectBase* Sail::EffectFromJson(nlohmann::json payload) {
return new GameInteractionEffect::PlayerInvincibility();
} else if (name == "SlipperyFloor") {
return new GameInteractionEffect::SlipperyFloor();
} else if (name == "SpawnEnemyWithOffset") {
auto effect = new GameInteractionEffect::SpawnEnemyWithOffset();
if (payload.contains("parameters")) {
effect->parameters[0] = payload["parameters"][0].get<int32_t>();
effect->parameters[1] = payload["parameters"][1].get<int32_t>();
}
return effect;
} else if (name == "SpawnActor") {
auto effect = new GameInteractionEffect::SpawnActor();
if (payload.contains("parameters")) {
effect->parameters[0] = payload["parameters"][0].get<int32_t>();
effect->parameters[1] = payload["parameters"][1].get<int32_t>();
}
return effect;
} else {
SPDLOG_INFO("[Sail] Unknown effect name: {}", name);
return nullptr;