Drone 1984 (#7009)

This commit is contained in:
Rane
2022-03-07 06:46:36 -05:00
committed by GitHub
parent af1f99e564
commit f5fa1ac80d
30 changed files with 134 additions and 29 deletions

View File

@@ -13,5 +13,6 @@ namespace Content.Server.Drone.Components
[DataField("tools")] public List<EntitySpawnEntry> Tools = new(); [DataField("tools")] public List<EntitySpawnEntry> Tools = new();
public List<EntityUid> ToolUids = new(); public List<EntityUid> ToolUids = new();
public bool AlreadyAwoken = false; public bool AlreadyAwoken = false;
public float InteractionBlockRange = 2.5f;
} }
} }

View File

@@ -1,20 +1,21 @@
using Content.Shared.Drone; using Content.Shared.Drone;
using Content.Server.Drone.Components; using Content.Server.Drone.Components;
using Content.Shared.MobState; using Content.Shared.MobState;
using Content.Shared.MobState.Components;
using Content.Shared.Interaction.Events; using Content.Shared.Interaction.Events;
using Content.Shared.Interaction.Components; using Content.Shared.Interaction.Components;
using Content.Shared.Examine; using Content.Shared.Examine;
using Content.Server.Popups;
using Content.Server.Mind.Components;
using Content.Server.Ghost.Roles.Components;
using Content.Server.Hands.Components;
using Content.Shared.Body.Components;
using Content.Server.UserInterface;
using Content.Shared.Emoting;
using Robust.Shared.Player;
using Content.Shared.Tag; using Content.Shared.Tag;
using Content.Shared.Throwing; using Content.Shared.Throwing;
using Content.Shared.Item;
using Content.Shared.Emoting;
using Content.Shared.Body.Components;
using Content.Server.Popups;
using Content.Server.Mind.Components;
using Content.Server.Ghost.Components;
using Content.Server.Ghost.Roles.Components;
using Content.Server.Hands.Components;
using Content.Server.UserInterface;
using Robust.Shared.Player;
namespace Content.Server.Drone namespace Content.Server.Drone
{ {
@@ -22,6 +23,7 @@ namespace Content.Server.Drone
{ {
[Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly TagSystem _tagSystem = default!; [Dependency] private readonly TagSystem _tagSystem = default!;
[Dependency] private readonly EntityLookupSystem _lookup = default!;
public override void Initialize() public override void Initialize()
{ {
base.Initialize(); base.Initialize();
@@ -37,8 +39,12 @@ namespace Content.Server.Drone
private void OnInteractionAttempt(EntityUid uid, DroneComponent component, InteractionAttemptEvent args) private void OnInteractionAttempt(EntityUid uid, DroneComponent component, InteractionAttemptEvent args)
{ {
if (HasComp<MobStateComponent>(args.Target) && !HasComp<DroneComponent>(args.Target)) if (NonDronesInRange(uid, component))
args.Cancel();
if (HasComp<SharedItemComponent>(args.Target) && !HasComp<UnremoveableComponent>(args.Target))
{ {
if (!_tagSystem.HasAnyTag(args.Target.Value, "DroneUsable", "Trash"))
args.Cancel(); args.Cancel();
} }
} }
@@ -81,7 +87,6 @@ namespace Content.Server.Drone
private void OnMindAdded(EntityUid uid, DroneComponent drone, MindAddedMessage args) private void OnMindAdded(EntityUid uid, DroneComponent drone, MindAddedMessage args)
{ {
UpdateDroneAppearance(uid, DroneStatus.On); UpdateDroneAppearance(uid, DroneStatus.On);
_tagSystem.AddTag(uid, "DoorBumpOpener");
_popupSystem.PopupEntity(Loc.GetString("drone-activated"), uid, Filter.Pvs(uid)); _popupSystem.PopupEntity(Loc.GetString("drone-activated"), uid, Filter.Pvs(uid));
if (drone.AlreadyAwoken == false) if (drone.AlreadyAwoken == false)
@@ -108,7 +113,6 @@ namespace Content.Server.Drone
private void OnMindRemoved(EntityUid uid, DroneComponent drone, MindRemovedMessage args) private void OnMindRemoved(EntityUid uid, DroneComponent drone, MindRemovedMessage args)
{ {
UpdateDroneAppearance(uid, DroneStatus.Off); UpdateDroneAppearance(uid, DroneStatus.Off);
_tagSystem.RemoveTag(uid, "DoorBumpOpener");
EnsureComp<GhostTakeoverAvailableComponent>(uid); EnsureComp<GhostTakeoverAvailableComponent>(uid);
} }
@@ -130,5 +134,19 @@ namespace Content.Server.Drone
appearance.SetData(DroneVisuals.Status, status); appearance.SetData(DroneVisuals.Status, status);
} }
} }
private bool NonDronesInRange(EntityUid uid, DroneComponent component)
{
var xform = Comp<TransformComponent>(uid);
foreach (var entity in _lookup.GetEntitiesInRange(xform.MapID, xform.WorldPosition, component.InteractionBlockRange))
{
if (HasComp<MindComponent>(entity) && !HasComp<DroneComponent>(entity) && !HasComp<GhostComponent>(entity))
{
_popupSystem.PopupEntity(Loc.GetString("drone-too-close"), uid, Filter.Entities(uid));
return true;
}
}
return false;
}
} }
} }

View File

@@ -1,3 +1,4 @@
drone-active = A maintenance drone. It seems totally unconcerned with you. drone-active = A maintenance drone. It seems totally unconcerned with you.
drone-dormant = A dormant maintenance drone. Who knows when it will wake up? drone-dormant = A dormant maintenance drone. Who knows when it will wake up?
drone-activated = The drone whirrs to life! drone-activated = The drone whirrs to life!
drone-too-close = Too close to other beings!

View File

@@ -69,6 +69,9 @@
whitelist: whitelist:
components: components:
- LightBulb - LightBulb
- type: Tag
tags:
- DroneUsable
- type: entity - type: entity
name: PDA box name: PDA box

View File

@@ -8,6 +8,9 @@
- HEAD - HEAD
- type: Sprite - type: Sprite
state: icon state: icon
- type: Tag
tags:
- DroneUsable
- type: entity - type: entity
abstract: true abstract: true

View File

@@ -99,7 +99,27 @@
- type: MobState - type: MobState
thresholds: thresholds:
0: !type:NormalMobState {} 0: !type:NormalMobState {}
70: !type:DeadMobState {} 60: !type:DeadMobState {}
- type: Flashable
- type: NoSlip
- type: StatusEffects
allowed:
- Stun
- KnockedDown
- SlowedDown
- type: SlowOnDamage
speedModifierThresholds:
20: 0.8
30: 0.6
40: 0.4
50: 0.2
- type: Temperature
heatDamageThreshold: 5000
currentTemperature: 310.15
specificHeat: 42
heatDamage:
types:
Heat : 1 #per second, scales with temperature & other constants
- type: Sprite - type: Sprite
drawdepth: Mobs drawdepth: Mobs
netsync: false netsync: false

View File

@@ -9,3 +9,6 @@
- type: Sprite - type: Sprite
sprite: Objects/Misc/module.rsi sprite: Objects/Misc/module.rsi
state: id_mod state: id_mod
- type: Tag
tags:
- DroneUsable

View File

@@ -8,6 +8,9 @@
- type: Sprite - type: Sprite
sprite: Objects/Misc/module.rsi sprite: Objects/Misc/module.rsi
state: cpuboard state: cpuboard
- type: Tag
tags:
- DroneUsable
- type: entity - type: entity
parent: BaseComputerCircuitboard parent: BaseComputerCircuitboard

View File

@@ -8,3 +8,6 @@
sprite: Objects/Misc/module.rsi sprite: Objects/Misc/module.rsi
state: charger_APC state: charger_APC
netsync: false netsync: false
- type: Tag
tags:
- DroneUsable

View File

@@ -7,6 +7,7 @@
- type: Tag - type: Tag
tags: tags:
- AirAlarmElectronics - AirAlarmElectronics
- DroneUsable
- type: Sprite - type: Sprite
sprite: Objects/Misc/module.rsi sprite: Objects/Misc/module.rsi
state: airalarm_electronics state: airalarm_electronics
@@ -20,6 +21,7 @@
- type: Tag - type: Tag
tags: tags:
- FireAlarmElectronics - FireAlarmElectronics
- DroneUsable
- type: Sprite - type: Sprite
sprite: Objects/Misc/module.rsi sprite: Objects/Misc/module.rsi
state: airalarm_electronics state: airalarm_electronics

View File

@@ -7,6 +7,7 @@
- type: Tag - type: Tag
tags: tags:
- DoorElectronics - DoorElectronics
- DroneUsable
- type: Sprite - type: Sprite
sprite: Objects/Misc/module.rsi sprite: Objects/Misc/module.rsi
state: door_electronics state: door_electronics

View File

@@ -7,6 +7,7 @@
- type: Tag - type: Tag
tags: tags:
- FirelockElectronics - FirelockElectronics
- DroneUsable
- type: Sprite - type: Sprite
sprite: Objects/Misc/module.rsi sprite: Objects/Misc/module.rsi
state: mainboard state: mainboard

View File

@@ -7,3 +7,6 @@
- type: Sprite - type: Sprite
sprite: Objects/Misc/module.rsi sprite: Objects/Misc/module.rsi
state: generic state: generic
- type: Tag
tags:
- DroneUsable

View File

@@ -13,6 +13,7 @@
- type: Tag - type: Tag
tags: tags:
- Sheet - Sheet
- DroneUsable
- type: entity - type: entity
parent: SheetGlassBase parent: SheetGlassBase

View File

@@ -14,6 +14,7 @@
tags: tags:
- Sheet - Sheet
- Metal - Metal
- DroneUsable
- type: entity - type: entity
parent: SheetMetalBase parent: SheetMetalBase

View File

@@ -13,6 +13,7 @@
- type: Tag - type: Tag
tags: tags:
- Sheet - Sheet
- DroneUsable
- type: entity - type: entity
parent: SheetOtherBase parent: SheetOtherBase

View File

@@ -10,6 +10,9 @@
- type: Item - type: Item
sprite: Objects/Materials/materials.rsi sprite: Objects/Materials/materials.rsi
- type: ItemStatus - type: ItemStatus
- type: Tag
tags:
- DroneUsable
- type: entity - type: entity
parent: MaterialBase parent: MaterialBase

View File

@@ -10,6 +10,9 @@
- type: Item - type: Item
sprite: Objects/Materials/parts.rsi sprite: Objects/Materials/parts.rsi
- type: ItemStatus - type: ItemStatus
- type: Tag
tags:
- DroneUsable
- type: entity - type: entity
parent: PartBase parent: PartBase

View File

@@ -15,6 +15,9 @@
Blunt: 10 Blunt: 10
- type: Stack - type: Stack
count: 1 count: 1
- type: Tag
tags:
- DroneUsable
- type: entity - type: entity
name: steel tile name: steel tile

View File

@@ -16,6 +16,9 @@
solutions: solutions:
mop: mop:
maxVol: 50 maxVol: 50
- type: Tag
tags:
- DroneUsable #No bucket because it holds chems, they can drag the thing around instead
- type: entity - type: entity
name: mop bucket name: mop bucket

View File

@@ -58,6 +58,10 @@
reagents: reagents:
- ReagentId: SpaceCleaner - ReagentId: SpaceCleaner
Quantity: 100 Quantity: 100
- type: Tag
tags:
- Spray
- DroneUsable #They don't have any other chem stuff on their whitelist so they can't refill it
# Vapor # Vapor

View File

@@ -22,6 +22,7 @@
- type: Tag - type: Tag
tags: tags:
- TrashBag - TrashBag
- DroneUsable
- type: entity - type: entity
name: trash bag name: trash bag

View File

@@ -18,3 +18,6 @@
- type: GasAnalyzerVisualizer - type: GasAnalyzerVisualizer
state_off: icon state_off: icon
state_working: working state_working: working
- type: Tag
tags:
- DroneUsable

View File

@@ -12,6 +12,7 @@
- type: Tag - type: Tag
tags: tags:
- CableCoil - CableCoil
- DroneUsable
- type: Stack - type: Stack
stackType: Cable stackType: Cable
- type: Sprite - type: Sprite

View File

@@ -7,6 +7,7 @@
- type: Tag - type: Tag
tags: tags:
- Flashlight - Flashlight
- DroneUsable
- type: HandheldLight - type: HandheldLight
toggleAction: toggleAction:
name: action-name-toggle-light name: action-name-toggle-light

View File

@@ -21,6 +21,9 @@
doAfter: 1 doAfter: 1
removeOnInteract: true removeOnInteract: true
- type: Clickable - type: Clickable
- type: Tag
tags:
- DroneUsable
# - type: Appearance # TODO: Add stack sprites # - type: Appearance # TODO: Add stack sprites
# visuals: # visuals:
# - type: StackVisualizer # - type: StackVisualizer
@@ -52,6 +55,9 @@
doAfter: 1 doAfter: 1
removeOnInteract: true removeOnInteract: true
- type: Clickable - type: Clickable
- type: Tag
tags:
- DroneUsable
- type: entity - type: entity
parent: InflatableWallStack parent: InflatableWallStack

View File

@@ -17,3 +17,6 @@
- name: LightBulb - name: LightBulb
amount: 5 amount: 5
type: Bulb type: Bulb
- type: Tag
tags:
- DroneUsable

View File

@@ -19,3 +19,6 @@
states: states:
enum.TrayScannerVisual.On: tray-on enum.TrayScannerVisual.On: tray-on
enum.TrayScannerVisual.Off: tray-off enum.TrayScannerVisual.Off: tray-off
- type: Tag
tags:
- DroneUsable

View File

@@ -181,6 +181,9 @@
qualities: qualities:
- Pulsing - Pulsing
- type: SignalLinker - type: SignalLinker
- type: Tag
tags:
- DroneUsable
- type: entity - type: entity
name: power drill name: power drill

View File

@@ -117,6 +117,9 @@
- type: Tag - type: Tag
id: Donut id: Donut
- type: Tag
id: DroneUsable
- type: Tag - type: Tag
id: Egg id: Egg