Drone Tweaks (#7024)

This commit is contained in:
Rane 2022-03-13 05:53:01 -04:00 committed by GitHub
parent e3ead6a3ba
commit ec1160c01d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 64 additions and 6 deletions

View File

@ -8,6 +8,14 @@ namespace Content.Server.Drone.Components
[DataField("tools")] public List<EntitySpawnEntry> Tools = new();
public List<EntityUid> ToolUids = new();
public bool AlreadyAwoken = false;
public float InteractionBlockRange = 2.5f;
public float InteractionBlockRange = 2.15f;
/// <summary>
/// If you are using drone component for
/// something that shouldn't have restrictions set this to
/// false.
/// </summary>
[DataField("applyLaws")]
public bool ApplyLaws = true;
}
}

View File

@ -1,5 +1,7 @@
using Content.Shared.Drone;
using Content.Server.Drone.Components;
using Content.Shared.Actions;
using Content.Server.Light.Components;
using Content.Shared.MobState;
using Content.Shared.Interaction.Events;
using Content.Shared.Interaction.Components;
@ -16,6 +18,7 @@ using Content.Server.Ghost.Roles.Components;
using Content.Server.Hands.Components;
using Content.Server.UserInterface;
using Robust.Shared.Player;
using Robust.Shared.Timing;
namespace Content.Server.Drone
{
@ -24,6 +27,9 @@ namespace Content.Server.Drone
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly TagSystem _tagSystem = default!;
[Dependency] private readonly EntityLookupSystem _lookup = default!;
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
public override void Initialize()
{
base.Initialize();
@ -39,7 +45,9 @@ namespace Content.Server.Drone
private void OnInteractionAttempt(EntityUid uid, DroneComponent component, InteractionAttemptEvent args)
{
if (NonDronesInRange(uid, component))
if (!component.ApplyLaws)
return;
if (args.Target != null && !HasComp<UnremoveableComponent>(args.Target) && NonDronesInRange(uid, component))
args.Cancel();
if (HasComp<SharedItemComponent>(args.Target) && !HasComp<UnremoveableComponent>(args.Target))
@ -51,6 +59,8 @@ namespace Content.Server.Drone
private void OnActivateUIAttempt(EntityUid uid, DroneComponent component, UserOpenActivatableUIAttemptEvent args)
{
if (!component.ApplyLaws)
return;
if (!_tagSystem.HasTag(args.Target, "DroneUsable"))
{
args.Cancel();
@ -109,6 +119,11 @@ namespace Content.Server.Drone
}
}
if (TryComp<ActionsComponent>(uid, out var actions) && TryComp<UnpoweredFlashlightComponent>(uid, out var flashlight))
{
_actionsSystem.AddAction(uid, flashlight.ToggleAction, null, actions);
}
drone.AlreadyAwoken = true;
}
}
@ -145,7 +160,8 @@ namespace Content.Server.Drone
{
if (HasComp<MindComponent>(entity) && !HasComp<DroneComponent>(entity) && !HasComp<GhostComponent>(entity))
{
_popupSystem.PopupEntity(Loc.GetString("drone-too-close"), uid, Filter.Entities(uid));
if (_gameTiming.IsFirstTimePredicted)
_popupSystem.PopupEntity(Loc.GetString("drone-too-close", ("being", entity)), uid, Filter.Entities(uid));
return true;
}
}

View File

@ -1,4 +1,4 @@
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-activated = The drone whirrs to life!
drone-too-close = Too close to other beings!
drone-too-close = Your laws prevent this action near {THE($being)}.

View File

@ -27,6 +27,9 @@
whitelist:
components:
- LightBulb
- type: Tag
tags:
- DroneUsable
- type: entity
name: lighttube box
@ -47,6 +50,9 @@
whitelist:
components:
- LightBulb
- type: Tag
tags:
- DroneUsable
- type: entity
name: mixed lights box
@ -180,6 +186,9 @@
layers:
- state: box
- state: writing
- type: Tag
tags:
- DroneUsable
- type: entity
@ -229,3 +238,6 @@
layers:
- state: box
- state: writing
- type: Tag
tags:
- DroneUsable

View File

@ -87,7 +87,7 @@
- type: GhostTakeoverAvailable
makeSentient: true
name: Maintenance Drone
description: Maintain the station. Ignore organics.
description: Maintain the station. Ignore other beings except drones.
rules: |
You are bound by these laws both in-game and out-of-character:
1. You may not involve yourself in the matters of another being, even if such matters conflict with Law Two or Law Three, unless the other being is another Drone.
@ -151,6 +151,20 @@
- type: Repairable
fuelcost: 15
doAfterDelay: 8
- type: Actions
- type: UnpoweredFlashlight
toggleAction:
name: action-name-toggle-light
description: action-description-toggle-light
icon: Objects/Tools/flashlight.rsi/flashlight.png
iconOn: Objects/Tools/flashlight.rsi/flashlight-on.png
event: !type:ToggleActionEvent
- type: PointLight
enabled: false
radius: 2.5
softness: 5
mask: /Textures/Effects/LightMasks/cone.png
autoRot: true
- type: entity
name: onestar mecha
@ -158,6 +172,7 @@
parent: PlayerSiliconBase
components:
- type: Drone
applyLaws: false
tools:
- id: Minigun
- id: EnergySword
@ -206,6 +221,6 @@
visuals:
- type: DamageStateVisualizer
rotate: true
normal: onestar_boss
normal: onestar_boss
dead: onestar_boss_wrecked
- type: CombatMode

View File

@ -52,6 +52,7 @@
- type: Tag
tags:
- RodMetal1
- DroneUsable
- type: Sprite
state: rods
- type: Stack

View File

@ -23,6 +23,9 @@
reagents:
- ReagentId: Licoxide
Quantity: 5
- type: Tag
tags:
- DroneUsable
- type: entity
id: PowerCellMediumBase

View File

@ -19,6 +19,9 @@
Blunt: 10
hitSound:
path: "/Audio/Weapons/smash.ogg"
- type: Tag
tags:
- DroneUsable
- type: entity
name: emergency toolbox