mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-01-30 23:10:14 -05:00
Additional Sail Commands.
Adds "SpawnEnemyWithOffset" and "SpawnActor" to Sail Functions.
This commit is contained in:
parent
83000e2f6a
commit
f0b596fabd
@ -640,4 +640,28 @@ namespace GameInteractionEffect {
|
|||||||
void SlipperyFloor::_Remove() {
|
void SlipperyFloor::_Remove() {
|
||||||
GameInteractor::State::SlipperyFloorActive = 0;
|
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]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -262,6 +262,14 @@ namespace GameInteractionEffect {
|
|||||||
void _Apply() override;
|
void _Apply() override;
|
||||||
void _Remove() 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 */
|
#endif /* __cplusplus */
|
||||||
|
@ -320,6 +320,20 @@ GameInteractionEffectBase* Sail::EffectFromJson(nlohmann::json payload) {
|
|||||||
return new GameInteractionEffect::PlayerInvincibility();
|
return new GameInteractionEffect::PlayerInvincibility();
|
||||||
} else if (name == "SlipperyFloor") {
|
} else if (name == "SlipperyFloor") {
|
||||||
return new GameInteractionEffect::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 {
|
} else {
|
||||||
SPDLOG_INFO("[Sail] Unknown effect name: {}", name);
|
SPDLOG_INFO("[Sail] Unknown effect name: {}", name);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user