diff --git a/src/world/Action/Action.cpp b/src/world/Action/Action.cpp index 3a6806b3..c75b9243 100644 --- a/src/world/Action/Action.cpp +++ b/src/world/Action/Action.cpp @@ -145,7 +145,7 @@ bool Sapphire::Action::Action::update() if( isInterrupted() ) { - onInterrupt(); + interrupt(); return true; } @@ -158,14 +158,14 @@ bool Sapphire::Action::Action::update() if( !hasCastTime() || std::difftime( currTime, m_startTime ) > m_castTime ) { - onExecute(); + execute(); return true; } return false; } -void Sapphire::Action::Action::onStart() +void Sapphire::Action::Action::start() { assert( m_pSource ); @@ -196,7 +196,7 @@ void Sapphire::Action::Action::onStart() if( !pScriptMgr->onStart( *this ) ) { // script not implemented - onInterrupt(); + interrupt(); if( player ) { @@ -209,10 +209,10 @@ void Sapphire::Action::Action::onStart() // instantly finish cast if there's no cast time if( !hasCastTime() ) - onExecute(); + execute(); } -void Sapphire::Action::Action::onInterrupt() +void Sapphire::Action::Action::interrupt() { assert( m_pSource ); @@ -249,7 +249,7 @@ void Sapphire::Action::Action::onInterrupt() pScriptMgr->onInterrupt( *this ); } -void Sapphire::Action::Action::onExecute() +void Sapphire::Action::Action::execute() { assert( m_pSource ); diff --git a/src/world/Action/Action.h b/src/world/Action/Action.h index af0928fc..6117ff69 100644 --- a/src/world/Action/Action.h +++ b/src/world/Action/Action.h @@ -61,21 +61,24 @@ namespace Sapphire::Action /*! * @brief Starts the cast. Finishes it immediately if there is no cast time (weaponskills). */ - virtual void onStart(); + virtual void start(); /*! * @brief Finishes the cast, effected targets are calculated here. */ - virtual void onExecute(); + virtual void execute(); /*! * @brief Called when a cast is interrupted for any reason * * m_interruptType will have the reason why the action was interrupted (eg. damage, movement, ...) */ - virtual void onInterrupt(); + virtual void interrupt(); - // update action, if returns true, action is done and has to be removed from the actor + /*! + * @brief Called on each player update tick + * @return true if a cast has finished and should be removed from the owning chara + */ virtual bool update(); protected: diff --git a/src/world/Action/EventAction.cpp b/src/world/Action/EventAction.cpp index 6773785d..806a0b90 100644 --- a/src/world/Action/EventAction.cpp +++ b/src/world/Action/EventAction.cpp @@ -35,7 +35,7 @@ Sapphire::Action::EventAction::EventAction( Entity::CharaPtr pActor, uint32_t ev Sapphire::Action::EventAction::~EventAction() = default; -void Sapphire::Action::EventAction::onStart() +void Sapphire::Action::EventAction::start() { if( !m_pSource ) return; @@ -54,7 +54,7 @@ void Sapphire::Action::EventAction::onStart() m_pSource->sendToInRangeSet( control ); } -void Sapphire::Action::EventAction::onExecute() +void Sapphire::Action::EventAction::execute() { if( !m_pSource ) return; @@ -90,7 +90,7 @@ void Sapphire::Action::EventAction::onExecute() } -void Sapphire::Action::EventAction::onInterrupt() +void Sapphire::Action::EventAction::interrupt() { if( !m_pSource ) return; diff --git a/src/world/Action/EventAction.h b/src/world/Action/EventAction.h index 898bf4b4..37987634 100644 --- a/src/world/Action/EventAction.h +++ b/src/world/Action/EventAction.h @@ -18,11 +18,11 @@ public: EventAction( Entity::CharaPtr pActor, uint32_t eventId, uint16_t action, ActionCallback finishRef, ActionCallback interruptRef, uint64_t additional, FrameworkPtr pFw ); - void onStart() override; + void start() override; - void onExecute() override; + void execute() override; - void onInterrupt() override; + void interrupt() override; private: uint32_t m_eventId; diff --git a/src/world/Actor/PlayerEvent.cpp b/src/world/Actor/PlayerEvent.cpp index 52c4d82e..281ea092 100644 --- a/src/world/Actor/PlayerEvent.cpp +++ b/src/world/Actor/PlayerEvent.cpp @@ -303,7 +303,7 @@ void Sapphire::Entity::Player::eventActionStart( uint32_t eventId, pEvent->setPlayedScene( true ); setCurrentAction( pEventAction ); - pEventAction->onStart(); + pEventAction->start(); } diff --git a/src/world/Manager/ActionMgr.cpp b/src/world/Manager/ActionMgr.cpp index 0dbc4931..ff53b13d 100644 --- a/src/world/Manager/ActionMgr.cpp +++ b/src/world/Manager/ActionMgr.cpp @@ -29,7 +29,7 @@ void World::Manager::ActionMgr::handleAoEPlayerAction( Entity::Player& player, u if( !actionData->targetArea ) { // not an action that has an aoe, cancel it - action->onInterrupt(); + action->interrupt(); return; } @@ -44,7 +44,7 @@ void World::Manager::ActionMgr::handleTargetedPlayerAction( Entity::Player& play // cancel any aoe actions casted with this packet if( actionData->targetArea ) { - action->onInterrupt(); + action->interrupt(); return; } @@ -102,7 +102,7 @@ void World::Manager::ActionMgr::bootstrapAction( Entity::Player& player, if( !currentAction->precheck() ) { // forcefully interrupt the action and reset the cooldown - currentAction->onInterrupt(); + currentAction->interrupt(); return; } @@ -113,7 +113,7 @@ void World::Manager::ActionMgr::bootstrapAction( Entity::Player& player, } // todo: what do in cases of swiftcast/etc? script callback? - currentAction->onStart(); + currentAction->start(); } void World::Manager::ActionMgr::handleItemActionVFX( Sapphire::Entity::Player& player, uint32_t itemId, uint16_t vfxId )