feat(scripts): turret enemies are immovable as L_TURRET makes them

L_TURRET (LOTs 12286 and 13093, e.g. the Crux Prime auto turrets) had no script, so these turrets could be stunned,
knocked back and pulled. They now push the same immunities the live script does. Check: stun and knock back a
Crux Prime auto turret: nothing happens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-29 09:27:48 -05:00
parent f35862b596
commit 22f6a76f46
4 changed files with 27 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ add_subdirectory(Hatchlings)
set(DSCRIPTS_SOURCES_02_SERVER_OBJECTS
"AgSurvivalBuffStation.cpp"
"ImmovableTurret.cpp"
"StinkyFishTarget.cpp")
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_OBJECTS_HATCHLINGS})

View File

@@ -0,0 +1,16 @@
#include "ImmovableTurret.h"
#include "ControllablePhysicsComponent.h"
#include "DestroyableComponent.h"
#include "Entity.h"
#include "eStateChangeType.h"
void ImmovableTurret::OnStartup(Entity* self) {
// SetStunImmunity (attack, interrupt) and SetStatusImmunity (pull to point, knockback); DLU keeps interrupt with the status ones
if (auto* controllablePhysics = self->GetComponent<ControllablePhysicsComponent>()) {
controllablePhysics->SetStunImmunity(eStateChangeType::PUSH, self->GetObjectID(), true, false, false, false, false, false, false);
}
if (auto* destroyable = self->GetComponent<DestroyableComponent>()) {
destroyable->SetStatusImmunity(eStateChangeType::PUSH, false, false, true, true, false, false, false, false, true);
}
}

View File

@@ -0,0 +1,8 @@
#pragma once
#include "CppScripts.h"
// L_TURRET: turret enemies can't be stunned, interrupted, knocked back or pulled
class ImmovableTurret : public CppScripts::Script {
public:
void OnStartup(Entity* self) override;
};

View File

@@ -76,6 +76,7 @@
#include "NsConcertInstrument.h"
#include "NsJohnnyMissionServer.h"
#include "StinkyFishTarget.h"
#include "ImmovableTurret.h"
#include "ZoneNsProperty.h"
#include "ZoneNsMedProperty.h"
#include "NsTokenConsoleServer.h"
@@ -434,6 +435,7 @@ namespace {
{"scripts\\ai\\NS\\L_NS_CONCERT_INSTRUMENT_QB.lua", []() {return new NsConcertInstrument();}},
{"scripts\\ai\\NS\\L_NS_JONNY_FLAG_MISSION_SERVER.lua", []() {return new NsJohnnyMissionServer();}},
{"scripts\\02_server\\Objects\\L_STINKY_FISH_TARGET.lua", []() {return new StinkyFishTarget();}},
{"scripts\\02_server\\Objects\\L_TURRET.lua", []() {return new ImmovableTurret();}},
{"scripts\\02_server\\Objects\\Hatchlings\\L_HATCHLING_PETS.lua", []() {return new HatchlingPets();}},
{"scripts\\zone\\PROPERTY\\NS\\L_ZONE_NS_PROPERTY.lua", []() {return new ZoneNsProperty();}},
{"scripts\\02_server\\Map\\Property\\NS_Med\\L_ZONE_NS_MED_PROPERTY.lua", []() {return new ZoneNsMedProperty();}},