mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-01-25 14:17:00 +00:00
fix scripts
split speed out to use target as caster fix armor skill
This commit is contained in:
parent
bed269ffbe
commit
09e9bb2c15
@ -297,6 +297,7 @@
|
|||||||
// pickups
|
// pickups
|
||||||
#include "SpecialCoinSpawner.h"
|
#include "SpecialCoinSpawner.h"
|
||||||
#include "SpecialPowerupSpawner.h"
|
#include "SpecialPowerupSpawner.h"
|
||||||
|
#include "SpecialSpeedBuffSpawner.h"
|
||||||
|
|
||||||
// Wild Scripts
|
// Wild Scripts
|
||||||
#include "WildAndScared.h"
|
#include "WildAndScared.h"
|
||||||
@ -893,9 +894,9 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr
|
|||||||
else if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_LIFE-POWERUP-SPAWNER.lua")
|
else if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_LIFE-POWERUP-SPAWNER.lua")
|
||||||
script = new SpecialPowerupSpawner(5);
|
script = new SpecialPowerupSpawner(5);
|
||||||
else if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_ARMOR-POWERUP-SPAWNER.lua")
|
else if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_ARMOR-POWERUP-SPAWNER.lua")
|
||||||
script = new SpecialPowerupSpawner(80);
|
script = new SpecialPowerupSpawner(747);
|
||||||
else if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_SPEED_BUFF_SPAWNER.lua")
|
else if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_SPEED_BUFF_SPAWNER.lua")
|
||||||
script = new SpecialPowerupSpawner(500);
|
script = new SpecialSpeedBuffSpawner();
|
||||||
|
|
||||||
// Wild
|
// Wild
|
||||||
if (scriptName == "scripts\\ai\\WILD\\L_WILD_GF_RAT.lua" || scriptName == "scripts\\ai\\WILD\\L_WILD_GF_SNAIL.lua")
|
if (scriptName == "scripts\\ai\\WILD\\L_WILD_GF_RAT.lua" || scriptName == "scripts\\ai\\WILD\\L_WILD_GF_SNAIL.lua")
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
set(DSCRIPTS_SOURCES_AI_SPEC
|
set(DSCRIPTS_SOURCES_AI_SPEC
|
||||||
"SpecialCoinSpawner.cpp"
|
"SpecialCoinSpawner.cpp"
|
||||||
"SpecialPowerupSpawner.cpp"
|
"SpecialPowerupSpawner.cpp"
|
||||||
|
"SpecialSpeedBuffSpawner.cpp"
|
||||||
PARENT_SCOPE)
|
PARENT_SCOPE)
|
||||||
|
@ -17,8 +17,9 @@ void SpecialPowerupSpawner::OnProximityUpdate(Entity* self, Entity* entering, co
|
|||||||
|
|
||||||
GameMessages::SendPlayFXEffect(self, -1, u"pickup", "", LWOOBJID_EMPTY, 1, 1, true);
|
GameMessages::SendPlayFXEffect(self, -1, u"pickup", "", LWOOBJID_EMPTY, 1, 1, true);
|
||||||
|
|
||||||
SkillComponent* skillComponent;
|
auto skillComponent = self->GetComponent<SkillComponent>();
|
||||||
if (!self->TryGetComponent(eReplicaComponentType::SKILL, skillComponent)) return;
|
if (!skillComponent) return;
|
||||||
|
Game::logger->Log("SpecialPowerupSpawner", "cast skill %i on %llu", this->m_SkillId, entering->GetObjectID());
|
||||||
skillComponent->CastSkill(this->m_SkillId, entering->GetObjectID());
|
skillComponent->CastSkill(this->m_SkillId, entering->GetObjectID());
|
||||||
|
|
||||||
self->SetVar(u"bIsDead", true);
|
self->SetVar(u"bIsDead", true);
|
||||||
|
26
dScripts/ai/SPEC/SpecialSpeedBuffSpawner.cpp
Normal file
26
dScripts/ai/SPEC/SpecialSpeedBuffSpawner.cpp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#include "SpecialSpeedBuffSpawner.h"
|
||||||
|
|
||||||
|
#include "GameMessages.h"
|
||||||
|
#include "SkillComponent.h"
|
||||||
|
#include "EntityManager.h"
|
||||||
|
#include "eReplicaComponentType.h"
|
||||||
|
|
||||||
|
void SpecialSpeedBuffSpawner::OnStartup(Entity* self) {
|
||||||
|
self->SetProximityRadius(1.5f, "powerupEnter");
|
||||||
|
self->SetVar(u"bIsDead", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpecialSpeedBuffSpawner::OnProximityUpdate(Entity* self, Entity* entering, const std::string name, const std::string status) {
|
||||||
|
if (name != "powerupEnter" && status != "ENTER") return;
|
||||||
|
if (!entering->IsPlayer()) return;
|
||||||
|
if (self->GetVar<bool>(u"bIsDead")) return;
|
||||||
|
|
||||||
|
GameMessages::SendPlayFXEffect(self, -1, u"pickup", "", LWOOBJID_EMPTY, 1, 1, true);
|
||||||
|
|
||||||
|
auto skillComponent = entering->GetComponent<SkillComponent>();
|
||||||
|
if (!skillComponent) return;
|
||||||
|
skillComponent->CastSkill(this->m_SkillId, entering->GetObjectID());
|
||||||
|
|
||||||
|
self->SetVar(u"bIsDead", true);
|
||||||
|
self->Smash(entering->GetObjectID(), eKillType::SILENT);
|
||||||
|
}
|
10
dScripts/ai/SPEC/SpecialSpeedBuffSpawner.h
Normal file
10
dScripts/ai/SPEC/SpecialSpeedBuffSpawner.h
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "CppScripts.h"
|
||||||
|
|
||||||
|
class SpecialSpeedBuffSpawner : public CppScripts::Script {
|
||||||
|
public:
|
||||||
|
void OnStartup(Entity* self) override;
|
||||||
|
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override;
|
||||||
|
private:
|
||||||
|
uint32_t m_SkillId = 500;
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user