-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sentry turrets - Part 2: Basic prototype (#35031)
- Loading branch information
1 parent
b742afb
commit 066c773
Showing
8 changed files
with
500 additions
and
263 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
Content.Server/Power/Components/ApcPowerReceiverBatteryComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using Content.Server.Power.EntitySystems; | ||
using Content.Shared.Power.EntitySystems; | ||
|
||
namespace Content.Server.Power.Components; | ||
|
||
/// <summary> | ||
/// Attached to APC powered entities that possess a rechargeable internal battery. | ||
/// If external power is interrupted, the entity will draw power from this battery instead. | ||
/// Requires <see cref="ApcPowerReceiverComponent"/> and <see cref="BatteryComponent"/> to function. | ||
/// </summary> | ||
[RegisterComponent] | ||
[Access([typeof(PowerNetSystem), typeof(SharedPowerReceiverSystem)])] | ||
public sealed partial class ApcPowerReceiverBatteryComponent : Component | ||
{ | ||
/// <summary> | ||
/// Indicates whether power is currently being drawn from the battery. | ||
/// </summary> | ||
[DataField] | ||
public bool Enabled = false; | ||
|
||
/// <summary> | ||
/// The passive load the entity places on the APC power network. | ||
/// If not connected to an active APC power network, this amount | ||
/// of power is drained from the battery every second. | ||
/// </summary> | ||
[DataField] | ||
public float IdleLoad { get; set; } = 5f; | ||
|
||
/// <summary> | ||
/// Determines how much battery charge the entity's battery gains | ||
/// per second when connected to an active APC power network. | ||
/// </summary> | ||
[DataField] | ||
public float BatteryRechargeRate { get; set; } = 50f; | ||
|
||
/// <summary> | ||
/// While the battery is being recharged, the load this entity places on the APC | ||
/// power network is increased by the <see cref="BatteryRechargeRate"/> multiplied | ||
/// by this factor. | ||
/// </summary> | ||
[DataField] | ||
public float BatteryRechargeEfficiency { get; set; } = 1f; | ||
} | ||
|
||
/// <summary> | ||
/// Raised whenever an ApcPowerReceiverBattery starts / stops discharging | ||
/// </summary> | ||
[ByRefEvent] | ||
public readonly record struct ApcPowerReceiverBatteryChangedEvent(bool Enabled); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
138 changes: 138 additions & 0 deletions
138
Resources/Prototypes/Entities/Objects/Weapons/Guns/Turrets/turrets_ballistic.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
- type: entity | ||
parent: [BaseWeaponBallisticTurret, BaseSyndicateContraband] | ||
id: WeaponTurretSyndicate | ||
suffix: Syndicate | ||
components: | ||
- type: NpcFactionMember | ||
factions: | ||
- Syndicate | ||
|
||
- type: entity | ||
parent: BaseWeaponBallisticTurret | ||
id: WeaponTurretSyndicateDisposable | ||
name: disposable ballistic turret | ||
suffix: Syndicate, Disposable | ||
components: | ||
- type: NpcFactionMember | ||
factions: | ||
- Syndicate | ||
- type: Destructible | ||
thresholds: | ||
- trigger: | ||
!type:DamageTrigger | ||
damage: 600 | ||
behaviors: | ||
- !type:DoActsBehavior | ||
acts: [ "Destruction" ] | ||
- trigger: | ||
!type:DamageTrigger | ||
damage: 100 | ||
behaviors: | ||
- !type:DoActsBehavior | ||
acts: [ "Destruction" ] | ||
- !type:TriggerBehavior | ||
- type: Gun | ||
fireRate: 2 | ||
selectedMode: FullAuto | ||
availableModes: | ||
- FullAuto | ||
soundGunshot: /Audio/Weapons/Guns/Gunshots/gun_sentry.ogg | ||
- type: BallisticAmmoProvider | ||
proto: CartridgePistol | ||
capacity: 50 | ||
- type: Construction | ||
deconstructionTarget: null | ||
graph: WeaponTurretSyndicateDisposable | ||
node: disposableTurret | ||
- type: Repairable | ||
qualityNeeded: "Anchoring" | ||
doAfterDelay: 3 | ||
- type: TriggerWhenEmpty | ||
- type: ExplodeOnTrigger | ||
- type: Explosive | ||
explosionType: Default | ||
maxIntensity: 10 | ||
intensitySlope: 1.5 | ||
totalIntensity: 30 | ||
canCreateVacuum: false | ||
|
||
- type: entity | ||
parent: BaseWeaponBallisticTurret | ||
id: WeaponTurretNanoTrasen | ||
suffix: NanoTrasen | ||
components: | ||
- type: NpcFactionMember | ||
factions: | ||
- NanoTrasen | ||
|
||
- type: entity | ||
parent: BaseWeaponBallisticTurret | ||
id: WeaponTurretHostile | ||
suffix: Hostile | ||
components: | ||
- type: NpcFactionMember | ||
factions: | ||
- SimpleHostile | ||
|
||
- type: entity | ||
parent: BaseWeaponBallisticTurret | ||
id: WeaponTurretAllHostile | ||
suffix: All hostile | ||
components: | ||
- type: NpcFactionMember | ||
factions: | ||
- AllHostile | ||
|
||
- type: entity | ||
parent: BaseWeaponBallisticTurret | ||
id: WeaponTurretXeno | ||
name: xeno turret | ||
suffix: Xeno | ||
description: Shoots 9mm acid projectiles. | ||
components: | ||
- type: NpcFactionMember | ||
factions: | ||
- Xeno | ||
- type: Sprite | ||
sprite: Objects/Weapons/Guns/Turrets/xenoturret.rsi | ||
noRot: true | ||
layers: | ||
- state: acid_turret | ||
- type: BallisticAmmoProvider | ||
proto: BulletAcid | ||
capacity: 500 | ||
- type: Gun | ||
fireRate: 1 | ||
selectedMode: FullAuto | ||
soundGunshot: /Audio/Weapons/Xeno/alien_spitacid.ogg | ||
- type: HTN | ||
rootTask: | ||
task: TurretCompound | ||
blackboard: | ||
SoundTargetInLOS: !type:SoundPathSpecifier | ||
path: /Audio/Animals/snake_hiss.ogg | ||
- type: Damageable | ||
damageContainer: Biological | ||
- type: Destructible | ||
thresholds: | ||
- trigger: | ||
!type:DamageTrigger | ||
damage: 100 | ||
behaviors: | ||
- !type:DoActsBehavior | ||
acts: [ "Destruction" ] | ||
- !type:PlaySoundBehavior | ||
sound: | ||
path: /Audio/Effects/gib1.ogg | ||
- !type:SpawnEntitiesBehavior | ||
spawn: | ||
FoodMeatXeno: | ||
min: 3 | ||
max: 5 | ||
- type: InteractionPopup | ||
interactDelay: 1.0 | ||
successChance: 0.8 | ||
interactSuccessString: petting-success-generic | ||
interactFailureString: petting-failure-generic | ||
interactSuccessSound: | ||
path: /Audio/Animals/snake_hiss.ogg |
Oops, something went wrong.