| 1 | #include "MapObj/BarrelStack2D.h" |
| 2 | |
| 3 | #include "Library/LiveActor/ActorActionFunction.h" |
| 4 | #include "Library/LiveActor/ActorInitUtil.h" |
| 5 | #include "Library/LiveActor/ActorSensorUtil.h" |
| 6 | #include "Library/Nerve/NerveSetupUtil.h" |
| 7 | #include "Library/Nerve/NerveUtil.h" |
| 8 | |
| 9 | #include "Util/ActorDimensionKeeper.h" |
| 10 | |
| 11 | namespace { |
| 12 | NERVE_IMPL(BarrelStack2D, Wait) |
| 13 | NERVE_IMPL(BarrelStack2D, Break) |
| 14 | |
| 15 | NERVES_MAKE_NOSTRUCT(BarrelStack2D, Wait, Break) |
| 16 | } // namespace |
| 17 | |
| 18 | BarrelStack2D::BarrelStack2D(const char* name) : al::LiveActor(name) {} |
| 19 | |
| 20 | void BarrelStack2D::init(const al::ActorInitInfo& info) { |
| 21 | al::initActorWithArchiveName(actor: this, initInfo: info, archiveName: "BarrelStack2D" , suffix: nullptr); |
| 22 | al::initNerve(actor: this, nerve: &Wait, maxStates: 0); |
| 23 | |
| 24 | mDimensionKeeper = rs::createDimensionKeeper(actor: this); |
| 25 | |
| 26 | rs::updateDimensionKeeper(keeper: mDimensionKeeper); |
| 27 | |
| 28 | if (!rs::isIn2DArea(dimension: this)) |
| 29 | makeActorDead(); |
| 30 | |
| 31 | rs::snap2D(actor: this, dimension: this, unk_distance: 500.0f); |
| 32 | makeActorAlive(); |
| 33 | } |
| 34 | |
| 35 | bool BarrelStack2D::receiveMsg(const al::SensorMsg* message, al::HitSensor* other, |
| 36 | al::HitSensor* self) { |
| 37 | return al::isMsgPlayerDisregard(msg: message); |
| 38 | } |
| 39 | |
| 40 | void BarrelStack2D::doBreak() { |
| 41 | al::setNerve(user: this, nerve: &Break); |
| 42 | } |
| 43 | |
| 44 | void BarrelStack2D::exeWait() {} |
| 45 | |
| 46 | void BarrelStack2D::exeBreak() { |
| 47 | if (al::isFirstStep(user: this)) |
| 48 | al::startAction(actor: this, actionName: "Break" ); |
| 49 | |
| 50 | if (al::isActionEnd(actor: this)) |
| 51 | kill(); |
| 52 | } |
| 53 | |