mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 22:57:45 +00:00
simplify action interface naming slightly - drops on prefix from vfuncs
This commit is contained in:
parent
9d6622b522
commit
fc62be84a2
6 changed files with 25 additions and 22 deletions
|
@ -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 );
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -303,7 +303,7 @@ void Sapphire::Entity::Player::eventActionStart( uint32_t eventId,
|
|||
pEvent->setPlayedScene( true );
|
||||
|
||||
setCurrentAction( pEventAction );
|
||||
pEventAction->onStart();
|
||||
pEventAction->start();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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 )
|
||||
|
|
Loading…
Add table
Reference in a new issue