The station AI can be destroyed (#39588)

* Initial commit

* Fixing merge conflict

* Merge conflict fixed

* Anchorable entities can now be marked as 'unanchorable'

* Revert "Anchorable entities can now be marked as 'unanchorable'"

This reverts commit 6a502e62a703cf06bd36ed3bdefe655fc074cfc5

This functionality will be made into a separate PR

* Error sprite

* Update AI core appearance with sustained damage, spawn scrap on destroyed

* Added intellicard sprite

* AI damage overlays

* Added fixtures

* AI core accent changes when damaged or low on power

* Bug fix and pop up messages for inserting AIs into inoperable cores

* Updated 'dead' sprite

* Destroying the AI core reduces the number of AI job slots available

* AI battery duration set to 10 minutes

* Initial commit

* Allow MMIs used in the construction of AI cores to take them over

* Initial resources commit

* Initial code commit

* Sprite update

* Bug fixes and updates

* Basic console UI

* Code refactor

* Added lock screen

* Added all outstanding UI features

* Added purge sprites

* Better appearance handling

* Fixed issue with purge sprite

* Finalized UI design

* Major components finalized

* Bit of clean up

* Removed some code that was used for testing

* Tweaked some text

* Removed extra space

* Added the circuitboard to the RD's locker

* Addressed reviewer comments plus tweaks

* Addressed reviewer comments plus tweaks

* Removed instances of granular damage

* Various improvements

* Removed testing code

* Fixed issue with disabled buttons

* Finalized code

* Addressed review comments

* Added a spare Station AI core electronics to the research director's locker

* Fixing build failure

* Addressed review comments

* Addressed review comments

* Added reverse path for construction graph

* Removed unneeded reference

* Parts can be purchased through cargo

* Fixing merge conflict

* Merge conflict resolved

* Fixing merge conflict

* Code update

* Code updates

* Increased AI core health and gave it a sell price to fix test fail

* Added screen static sprite

* Added better support for ghosted AI players plus code tweaks

* Various improvements and clean up

* Increased purge duration to 60 seconds

* Fixed needless complication

* Addressed reviewer comments part 1

* Addressed reviewer comments part 2

* Further fixes

* Trying lower battery values to see if it fixes the test fail

* Adjusted power values again

* Addressed review comments

* Addressed review comments

* Fixed test fail

* Fixed bug with endless rebooting. Using rejuvenation on an AI core revives the AI inside.

* Added pop up text

* Bug fix

* Tweaks and fixes

* Fixed restoration console not updating when the AI finishes rebooting

* Update SharedStationAiSystem.Held.cs

---------

Co-authored-by: ScarKy0 <scarky0@onet.eu>
This commit is contained in:
chromiumboy
2025-09-15 09:18:32 -05:00
committed by GitHub
parent e0fd44da66
commit 7444c8ea4a
72 changed files with 2553 additions and 133 deletions

View File

@@ -144,10 +144,12 @@
- type: Appearance
- type: GenericVisualizer
visuals:
enum.StationAiVisualState.Key:
enum.StationAiVisualLayers.Icon:
unshaded:
Empty: { state: empty }
Occupied: { state: full }
Rebooting: { state: dead }
Dead: { state: dead }
- type: Intellicard
- type: entity
@@ -161,6 +163,7 @@
- state: ai
shader: unshaded
# Empty AI core
- type: entity
id: PlayerStationAiEmpty
name: AI Core
@@ -178,23 +181,69 @@
blacklist:
tags:
- GhostOnlyWarp
- type: Fixtures
fixtures:
fix1:
shape:
!type:PhysShapeAabb
bounds: "-0.5,-0.5,0.5,0.5"
mask:
- MachineMask
layer:
- MachineLayer
density: 200
- type: ContainerComp
proto: AiHeld
container: station_ai_mind_slot
- type: Damageable
damageModifierSet: StrongMetallic
- type: Repairable
doAfterDelay: 10
allowSelfRepair: false
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 100
damage: 400
behaviors:
- !type:PlaySoundBehavior
sound:
collection: MetalBreak
- !type:DoActsBehavior
acts: [ "Destruction" ]
acts: [ "Breakage" ]
- trigger:
!type:DamageTrigger
damage: 800
behaviors:
- !type:PlaySoundBehavior
sound:
collection: MetalBreak
- !type:SpawnEntitiesBehavior
spawn:
ShardGlassReinforced:
min: 1
max: 2
SheetPlasteel:
min: 2
max: 2
- !type:DoActsBehavior
acts: ["Destruction"]
- type: DamageVisuals
thresholds: [25, 50, 75, 100, 125, 150, 175]
damageDivisor: 4
trackAllDamage: true
damageOverlay:
sprite: Mobs/Silicon/station_ai_cracks.rsi
- type: ApcPowerReceiver
powerLoad: 1000
needsPower: false
powerLoad: 500
- type: ExtensionCableReceiver
- type: Battery
maxCharge: 300000
startingCharge: 300000
- type: ApcPowerReceiverBattery
idleLoad: 500
batteryRechargeRate: 1000
batteryRechargeEfficiency: 0 # Setting to zero until the light flickering issue associated with dynamic power loads is fixed
- type: StationAiCore
- type: StationAiVision
- type: InteractionOutline
@@ -204,12 +253,26 @@
layers:
- state: base
- state: ai_empty
map: ["enum.StationAiVisualLayers.Base"]
shader: unshaded
- state: ai
map: ["enum.StationAiVisualState.Key"]
map: ["enum.StationAiVisualLayers.Icon"]
shader: unshaded
visible: false
- state: ai_unpowered
map: ["enum.PowerDeviceVisualLayers.Powered"]
visible: false
- type: Appearance
- type: GenericVisualizer
visuals:
enum.PowerDeviceVisuals.Powered:
enum.PowerDeviceVisualLayers.Powered:
False: { visible: true }
True: { visible: false }
enum.StationAiVisuals.Broken:
enum.StationAiVisualLayers.Base:
False: { state: ai_empty }
True: { state: ai_error }
- type: InteractionPopup
interactSuccessString: petting-success-station-ai
interactFailureString: petting-failure-station-ai
@@ -234,7 +297,22 @@
type: HolopadBoundUserInterface
enum.StationAiCustomizationUiKey.Key:
type: StationAiCustomizationBoundUserInterface
- type: Construction
graph: StationAiCore
node: stationAiCore
- type: ContainerContainer
containers:
board: !type:Container
station_ai_brain_slot: !type:Container
station_ai_mind_slot: !type:ContainerSlot
showEnts: true
- type: ContainerFill
containers:
board:
- StationAiCoreElectronics
- type: StaticPrice
price: 5000
# The job-ready version of an AI spawn.
- type: entity
id: PlayerStationAi
@@ -245,6 +323,77 @@
containerId: station_ai_mind_slot
job: StationAi
# The station AI core assembly
- type: entity
parent: BaseStructure
id: PlayerStationAiAssembly
name: AI Core Assembly
description: An unfinished computer core for housing an artifical intelligence.
components:
- type: Anchorable
flags:
- Anchorable
- type: Rotatable
- type: Sprite
snapCardinals: true
sprite: Mobs/Silicon/station_ai.rsi
layers:
- state: frame_0
map: [ "enum.ConstructionVisuals.Layer" ]
- type: Appearance
- type: GenericVisualizer
visuals:
enum.ConstructionVisuals.Key:
enum.ConstructionVisuals.Layer:
frame: { state: frame_0 }
frameWithElectronics: { state: frame_1 }
frameWithSecuredElectronics: { state: frame_2 }
frameWithWires: { state: frame_3 }
frameWithBrain: { state: frame_3b }
frameWithBrainFinished: { state: frame_4 }
frameWithoutBrainFinished: { state: frame_4 }
- type: InteractionOutline
- type: Fixtures
fixtures:
fix1:
shape:
!type:PhysShapeAabb
bounds: "-0.5,-0.5,0.5,0.5"
mask:
- MachineMask
layer:
- MachineLayer
density: 200
- type: Damageable
damageModifierSet: StrongMetallic
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 400
behaviors:
- !type:PlaySoundBehavior
sound:
collection: MetalBreak
- !type:SpawnEntitiesBehavior
spawn:
SheetPlasteel:
min: 2
max: 4
- !type:EmptyContainersBehaviour
containers:
- station_ai_brain_slot
- board
- !type:DoActsBehavior
acts: ["Destruction"]
- type: Construction
graph: StationAiCore
node: frame
- type: ContainerContainer
containers:
board: !type:Container
station_ai_brain_slot: !type:Container
# The actual brain inside the core
- type: entity
id: StationAiBrain
@@ -254,8 +403,6 @@
- type: Sprite
# Once it's in a core it's pretty much an abstract entity at that point.
visible: false
- type: BlockMovement
blockInteraction: false
- type: SiliconLawProvider
laws: Crewsimov
- type: SiliconLawBound
@@ -277,9 +424,16 @@
drawFov: false
- type: Examiner
- type: InputMover
- type: BlockMovement
blockInteraction: false
- type: GhostOnMove
mustBeDead: true
- type: Speech
speechVerb: Robotic
speechSounds: Borg
- type: DamagedSiliconAccent
startPowerCorruptionAtCharIdx: 4
maxPowerCorruptionAtCharIdx: 20
- type: Tag
tags:
- HideContextMenu

View File

@@ -554,9 +554,20 @@
parent: BaseComputerCircuitboard
id: StationAiUploadCircuitboard
name: AI upload console board
description: A computer printed circuit board for a AI upload console.
description: A computer printed circuit board for an AI upload console.
components:
- type: Sprite
state: cpu_science
- type: ComputerBoard
prototype: StationAiUploadComputer
- type: entity
parent: BaseComputerCircuitboard
id: StationAiFixerCircuitboard
name: AI restoration console
description: A computer printed circuit board for an AI restoration console console.
components:
- type: Sprite
state: cpu_science
- type: ComputerBoard
prototype: StationAiFixerComputer

View File

@@ -0,0 +1,14 @@
- type: entity
id: StationAiCoreElectronics
parent: BaseElectronics
name: station AI core electronics
description: An electronics board used in station AI cores.
components:
- type: Sprite
sprite: Objects/Misc/module.rsi
state: mainboard
- type: Tag
tags:
- StationAiCoreElectronics
- type: StaticPrice
price: 404

View File

@@ -115,9 +115,11 @@
proto: robot
- type: Speech
speechSounds: Pai
- type: Alerts
- type: MobState
allowedStates:
- Alive
- Dead
- type: Appearance
- type: Tag
tags:

View File

@@ -125,7 +125,7 @@
fireCost: 100
- type: Battery
maxCharge: 2000
startingCharge: 0
startingCharge: 2000
- type: ApcPowerReceiverBattery
idleLoad: 5
batteryRechargeRate: 200
@@ -136,3 +136,5 @@
- type: HTN
rootTask:
task: EnergyTurretCompound
- type: StaticPrice
price: 200

View File

@@ -1636,3 +1636,86 @@
containers:
circuit_holder: !type:ContainerSlot
board: !type:Container
- type: entity
id: StationAiFixerComputer
parent: BaseComputer
name: AI restoration console
description: Used to repair damaged artifical intelligences.
components:
- type: Sprite
layers:
- map: [ "computerLayerBody" ]
state: computer
- map: [ "computerLayerKeyboard" ]
state: generic_keyboard
- map: [ "computerLayerScreen" ]
state: ai-fixer-empty
- map: [ "computerLayerKeys" ]
state: rd_key
- map: [ "enum.WiresVisualLayers.MaintenancePanel" ]
state: generic_panel_open
- type: Appearance
- type: GenericVisualizer
visuals:
enum.ComputerVisuals.Powered:
computerLayerScreen:
True: { visible: true, shader: unshaded }
False: { visible: false }
computerLayerKeys:
True: { visible: true, shader: unshaded }
False: { visible: true, shader: shaded }
enum.StationAiFixerConsoleVisuals.Key:
computerLayerScreen:
Repair0: { state: ai-fixer-progress-0 }
Repair1: { state: ai-fixer-progress-1 }
Repair2: { state: ai-fixer-progress-2 }
Repair3: { state: ai-fixer-progress-3 }
Purge0: { state: ai-fixer-purge-0 }
Purge1: { state: ai-fixer-purge-1 }
Purge2: { state: ai-fixer-purge-2 }
Purge3: { state: ai-fixer-purge-3 }
Empty: { state: ai-fixer-empty }
Occupied: { state: ai-fixer-full }
Rebooting: { state: ai-fixer-404 }
Dead: { state: ai-fixer-404 }
enum.WiresVisuals.MaintenancePanelState:
enum.WiresVisualLayers.MaintenancePanel:
True: { visible: false }
False: { visible: true }
- type: ApcPowerReceiver
powerLoad: 1000
- type: Computer
board: StationAiFixerCircuitboard
- type: AccessReader
access: [ [ "ResearchDirector" ] ]
- type: Lock
unlockOnClick: false
- type: StationAiFixerConsole
- type: ItemSlotsLock
slots:
- station_ai_holder
- type: ItemSlotRequiresPower
- type: ItemSlots
slots:
station_ai_holder:
ejectOnBreak: true
lockedFailPopup: station-ai-fixer-console-is-locked
whitelistFailPopup: station-ai-fixer-console-station-ai-holder-required
whitelist:
requireAll: true
components:
- StationAiHolder
- Item
- type: ContainerContainer
containers:
station_ai_holder: !type:ContainerSlot
board: !type:Container
- type: ActivatableUI
key: enum.StationAiFixerConsoleUiKey.Key
- type: UserInterface
interfaces:
enum.StationAiFixerConsoleUiKey.Key:
type: StationAiFixerConsoleBoundUserInterface
enum.WiresUiKey.Key:
type: WiresBoundUserInterface