Sentry turrets - Part 4: The sentry turret and its primary systems (#35123)

* Initial commit

* Removed mention of StationAiTurretComponent (for now)

* Prep for moving out of draft

* Fixing merge conflict

* Re-added new net frequencies to AI turrets

* Removed turret control content

* Removed unintended change

* Final tweaks

* Fixed incorrect file name

* Improvement to fire mode handling

* Addressed review comments

* Updated how turret wire panel auto-closing is handled

* Ranged NPCs no longer waste shots on stunned targets

* Fixed bug in tracking broken state

* Addressed review comments

* Bug fix

* Removed unnecessary event call
This commit is contained in:
chromiumboy
2025-03-29 12:55:58 -05:00
committed by GitHub
parent 587afe7598
commit dfd3e36a0a
24 changed files with 1005 additions and 30 deletions

View File

@@ -87,6 +87,30 @@
name: device-frequency-prototype-name-cyborg-control
frequency: 1292
# Turret controllers send data to their turrets on this frequency
- type: deviceFrequency
id: TurretControl
name: device-frequency-prototype-name-turret-control
frequency: 2151
# Turrets send data to their controllers on this frequency
- type: deviceFrequency
id: Turret
name: device-frequency-prototype-name-turret
frequency: 2152
# AI turret controllers send data to their turrets on this frequency
- type: deviceFrequency
id: TurretControlAI
name: device-frequency-prototype-name-turret-control
frequency: 2153
# AI turrets send data to their controllers on this frequency
- type: deviceFrequency
id: TurretAI
name: device-frequency-prototype-name-turret
frequency: 2154
# This frequency will likely have a LARGE number of listening entities. Please don't broadcast on this frequency.
- type: deviceFrequency
id: SmartLight #used by powered lights.

View File

@@ -0,0 +1,36 @@
- type: entity
id: WeaponEnergyTurretStationMachineCircuitboard
parent: BaseMachineCircuitboard
name: sentry turret machine board
description: A machine printed circuit board for a sentry turret.
components:
- type: Sprite
sprite: Objects/Misc/module.rsi
state: security
- type: MachineBoard
prototype: WeaponEnergyTurretStation
tagRequirements:
TurretCompatibleWeapon:
amount: 1
defaultPrototype: WeaponLaserCannon
examineName: construction-insert-info-examine-name-laser-cannon
ProximitySensor:
amount: 1
defaultPrototype: ProximitySensor
componentRequirements:
PowerCell:
amount: 1
defaultPrototype: PowerCellMedium
examineName: construction-insert-info-examine-name-power-cell
- type: entity
id: WeaponEnergyTurretAIMachineCircuitboard
parent: WeaponEnergyTurretStationMachineCircuitboard
name: AI sentry turret machine board
description: A machine printed circuit board for an AI sentry turret.
components:
- type: Sprite
sprite: Objects/Misc/module.rsi
state: command
- type: MachineBoard
prototype: WeaponEnergyTurretAI

View File

@@ -371,6 +371,9 @@
- type: HitscanBatteryAmmoProvider
proto: RedHeavyLaser
fireCost: 100
- type: Tag
tags:
- TurretCompatibleWeapon
- type: entity
name: portable particle decelerator

View File

@@ -127,9 +127,12 @@
maxCharge: 2000
startingCharge: 0
- type: ApcPowerReceiverBattery
idlePowerUse: 5
idleLoad: 5
batteryRechargeRate: 200
batteryRechargeEfficiency: 1.225
- type: ApcPowerReceiver
powerLoad: 5
- type: ExtensionCableReceiver
- type: ExtensionCableReceiver
- type: HTN
rootTask:
task: EnergyTurretCompound

View File

@@ -0,0 +1,182 @@
- type: entity
parent: [BaseWeaponEnergyTurret, ConstructibleMachine]
id: WeaponEnergyTurretStation
name: sentry turret
description: A high-tech autonomous weapons system designed to keep unauthorized personnel out of sensitive areas.
components:
# Physics
- type: Fixtures
fixtures:
body:
shape:
!type:PhysShapeCircle
radius: 0.45
density: 60
mask:
- Impassable
turret:
shape:
!type:PhysShapeCircle
radius: 0.45
density: 60
mask:
- MachineMask
layer:
- MachineLayer
hard: false
# Sprites and appearance
- type: Sprite
sprite: Objects/Weapons/Guns/Turrets/sentry_turret.rsi
drawdepth: FloorObjects
granularLayersRendering: true
layers:
- state: support
renderingStrategy: NoRotation
- state: base_shadow
map: [ "shadow" ]
- state: base
map: [ "base" ]
- state: stun
map: [ "enum.DeployableTurretVisuals.Weapon" ]
shader: "unshaded"
visible: false
- state: cover_closed
map: [ "enum.DeployableTurretVisuals.Turret" ]
renderingStrategy: NoRotation
- state: cover_light_on
map: [ "enum.PowerDeviceVisualLayers.Powered" ]
shader: "unshaded"
renderingStrategy: NoRotation
visible: false
- state: panel
map: [ "enum.WiresVisualLayers.MaintenancePanel" ]
renderingStrategy: NoRotation
visible: false
- type: AnimationPlayer
- type: Appearance
- type: GenericVisualizer
visuals:
enum.BatteryWeaponFireModeVisuals.State:
enum.DeployableTurretVisuals.Weapon:
BulletEnergyTurretDisabler: { state: stun }
BulletEnergyTurretLaser: { state: lethal }
enum.DeployableTurretVisuals.Broken:
base:
True: { state: destroyed }
False: { state: base }
enum.WiresVisuals.MaintenancePanelState:
enum.WiresVisualLayers.MaintenancePanel:
True: { visible: false }
False: { visible: true }
# HTN
- type: HTN
enabled: false
# Faction / control
- type: StationAiWhitelist
- type: NpcFactionMember
factions:
- AllHostile
- type: AccessReader
access: [["Security"]]
# Weapon systems
- type: ProjectileBatteryAmmoProvider
proto: BulletEnergyTurretDisabler
fireCost: 100
- type: BatteryWeaponFireModes
fireModes:
- proto: BulletEnergyTurretDisabler
fireCost: 100
- proto: BulletEnergyTurretLaser
fireCost: 100
- type: TurretTargetSettings
exemptAccessLevels:
- Security
- Borg
- BasicSilicon
# Defenses / destruction
- type: DeployableTurret
retractedDamageModifierSetId: Metallic
deployedDamageModifierSetId: FlimsyMetallic
- type: Damageable
damageModifierSet: Metallic
- type: Repairable
doAfterDelay: 10
allowSelfRepair: false
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 300
behaviors:
- !type:PlaySoundBehavior
sound:
collection: MetalBreak
- !type:DoActsBehavior
acts: [ "Breakage" ]
- trigger:
!type:DamageTrigger
damage: 600
behaviors:
- !type:PlaySoundBehavior
sound:
collection: MetalBreak
- !type:ChangeConstructionNodeBehavior
node: machineFrame
- !type:DoActsBehavior
acts: ["Destruction"]
# Device network
- type: DeviceNetwork
deviceNetId: Wired
receiveFrequencyId: TurretControl
transmitFrequencyId: Turret
sendBroadcastAttemptEvent: true
prefix: device-address-prefix-turret
examinableAddress: true
- type: DeviceNetworkRequiresPower
- type: WiredNetworkConnection
# Wires
- type: UserInterface
interfaces:
enum.WiresUiKey.Key:
type: WiresBoundUserInterface
- type: WiresPanel
- type: WiresVisuals
- type: Wires
boardName: wires-board-name-weapon-energy-turret
layoutId: WeaponEnergyTurret
- type: Lock
locked: true
unlockOnClick: false
- type: LockedWiresPanel
# General properties
- type: Machine
board: WeaponEnergyTurretStationMachineCircuitboard
- type: UseDelay
delay: 1.2
- type: entity
parent: WeaponEnergyTurretStation
id: WeaponEnergyTurretAI
name: AI sentry turret
description: A high-tech autonomous weapons system under the direct control of a local artifical intelligence.
components:
- type: AccessReader
access: [["StationAi"]]
- type: TurretTargetSettings
exemptAccessLevels:
- Borg
- BasicSilicon
- type: Machine
board: WeaponEnergyTurretAIMachineCircuitboard
- type: DeviceNetwork
receiveFrequencyId: TurretControlAI
transmitFrequencyId: TurretAI

View File

@@ -190,6 +190,8 @@
curve: !type:BoolCurve
- !type:TargetIsCritCon
curve: !type:InverseBoolCurve
- !type:TargetIsStunnedCon
curve: !type:InverseBoolCurve
- !type:TurretTargetingCon
curve: !type:BoolCurve
- !type:TargetDistanceCon

View File

@@ -204,4 +204,25 @@
wires:
- !type:PowerWireAction
- !type:AiInteractWireAction
- !type:AccessWireAction
- !type:AccessWireAction
- type: wireLayout
id: WeaponEnergyTurret
dummyWires: 4
wires:
- !type:PowerWireAction
- !type:PowerWireAction
pulseTimeout: 15
- !type:AiInteractWireAction
- !type:AccessWireAction
- type: wireLayout
id: TurretControls
dummyWires: 2
wires:
- !type:PowerWireAction
- !type:PowerWireAction
pulseTimeout: 15
- !type:AiInteractWireAction
- !type:AccessWireAction

View File

@@ -1317,6 +1317,12 @@
- type: Tag
id: Truncheon
- type: Tag
id: TurretCompatibleWeapon # Used in the construction of sentry turrets
- type: Tag
id: TurretControlElectronics # Used in the construction of sentry turret control panels
- type: Tag
id: Unimplantable