mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-06 10:44:08 +00:00
Implement Buccaneer Valiant special ability
Adds the ability for the buccaneer valiant to spawn a ship that rams enemies and smashes them. Next to a script that triggers the ship skill a few other changes had to be made: - Force movement behavior server side calculation and sync - The ship has no physics volume so the FindValidTargets for behaviors had to be altered to allow ControllablePhysics entities to find entities within their area. The "target_self" AOE flag has been used to replicate the old behavior.
This commit is contained in:
24
dScripts/BuccaneerValiantShip.cpp
Normal file
24
dScripts/BuccaneerValiantShip.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "BuccaneerValiantShip.h"
|
||||
#include "SkillComponent.h"
|
||||
#include "dLogger.h"
|
||||
|
||||
void BuccaneerValiantShip::OnStartup(Entity* self) {
|
||||
const auto skill = 982;
|
||||
const auto behavior = 20577;
|
||||
const auto skillCastTimer = 1.0F;
|
||||
|
||||
self->AddCallbackTimer(skillCastTimer, [self]() {
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
auto* owner = self->GetOwner();
|
||||
|
||||
if (skillComponent != nullptr && owner != nullptr) {
|
||||
skillComponent->CalculateBehavior(skill, behavior, LWOOBJID_EMPTY, true, false, owner->GetObjectID());
|
||||
|
||||
// Kill self if missed
|
||||
const auto selfSmashTimer = 1.1F;
|
||||
self->AddCallbackTimer(selfSmashTimer, [self]() {
|
||||
self->Kill();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
6
dScripts/BuccaneerValiantShip.h
Normal file
6
dScripts/BuccaneerValiantShip.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class BuccaneerValiantShip : public CppScripts::Script {
|
||||
void OnStartup(Entity *self) override;
|
||||
};
|
@@ -261,6 +261,7 @@
|
||||
#include "PersonalFortress.h"
|
||||
#include "PropertyDevice.h"
|
||||
#include "ImaginationBackpackHealServer.h"
|
||||
#include "BuccaneerValiantShip.h"
|
||||
|
||||
// Survival scripts
|
||||
#include "AgSurvivalStromling.h"
|
||||
@@ -774,6 +775,8 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr
|
||||
script = new PropertyDevice();
|
||||
else if (scriptName == "scripts\\02_server\\Map\\General\\L_IMAG_BACKPACK_HEALS_SERVER.lua")
|
||||
script = new ImaginationBackpackHealServer();
|
||||
else if (scriptName == "scripts\\EquipmentScripts\\BuccaneerValiantShip.lua")
|
||||
script = new BuccaneerValiantShip();
|
||||
|
||||
//Ignore these scripts:
|
||||
else if (scriptName == "scripts\\02_server\\Enemy\\General\\L_SUSPEND_LUA_AI.lua")
|
||||
|
Reference in New Issue
Block a user