Stunprod fixes & add new sprites (#334)
* - tweak: Cleanup snatcherprod and tentacle gun. * - fix: Cleanup StunprodSystem. * - add: Snatcherprod on inhand sprites.
This commit is contained in:
@@ -10,6 +10,7 @@ public sealed class SnatcherprodSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly SharedHandsSystem _hands = default!;
|
[Dependency] private readonly SharedHandsSystem _hands = default!;
|
||||||
[Dependency] private readonly SharedItemToggleSystem _itemToggle = default!;
|
[Dependency] private readonly SharedItemToggleSystem _itemToggle = default!;
|
||||||
|
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -18,7 +19,6 @@ public sealed class SnatcherprodSystem : EntitySystem
|
|||||||
SubscribeLocalEvent<SnatcherprodComponent, StaminaMeleeHitEvent>(OnHit);
|
SubscribeLocalEvent<SnatcherprodComponent, StaminaMeleeHitEvent>(OnHit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void OnHit(EntityUid uid, SnatcherprodComponent component, StaminaMeleeHitEvent args)
|
private void OnHit(EntityUid uid, SnatcherprodComponent component, StaminaMeleeHitEvent args)
|
||||||
{
|
{
|
||||||
if (!_itemToggle.IsActivated(uid) || args.HitList.Count == 0)
|
if (!_itemToggle.IsActivated(uid) || args.HitList.Count == 0)
|
||||||
@@ -29,28 +29,13 @@ public sealed class SnatcherprodSystem : EntitySystem
|
|||||||
if (entity == uid || !TryComp(entity, out HandsComponent? hands))
|
if (entity == uid || !TryComp(entity, out HandsComponent? hands))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EntityUid? heldEntity = null;
|
foreach (var heldEntity in _handsSystem.EnumerateHeld(entity, hands))
|
||||||
|
|
||||||
if (hands.ActiveHandEntity != null)
|
|
||||||
heldEntity = hands.ActiveHandEntity;
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
foreach (var hand in hands.Hands)
|
if (!_hands.TryDrop(entity, heldEntity, null, false, false, handsComp: hands))
|
||||||
{
|
continue;
|
||||||
if (hand.Value.HeldEntity == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
heldEntity = hand.Value.HeldEntity;
|
_hands.PickupOrDrop(args.User, heldEntity, false);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
if (heldEntity == null)
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_hands.TryDrop(entity, heldEntity.Value, null, false, false, handsComp: hands))
|
|
||||||
return;
|
|
||||||
|
|
||||||
_hands.PickupOrDrop(args.User, heldEntity.Value, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,16 +33,20 @@ public sealed class StunprodSystem : EntitySystem
|
|||||||
SubscribeLocalEvent<StunprodComponent, EntInsertedIntoContainerMessage>(OnEntInserted);
|
SubscribeLocalEvent<StunprodComponent, EntInsertedIntoContainerMessage>(OnEntInserted);
|
||||||
SubscribeLocalEvent<StunprodComponent, ItemToggleActivateAttemptEvent>(TryTurnOn);
|
SubscribeLocalEvent<StunprodComponent, ItemToggleActivateAttemptEvent>(TryTurnOn);
|
||||||
SubscribeLocalEvent<StunprodComponent, ItemToggledEvent>(ToggleDone);
|
SubscribeLocalEvent<StunprodComponent, ItemToggledEvent>(ToggleDone);
|
||||||
|
SubscribeLocalEvent<StunprodComponent, ComponentStartup>(OnStartup,
|
||||||
|
after: new[] {typeof(SharedItemToggleSystem)});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnStartup(Entity<StunprodComponent> ent, ref ComponentStartup args)
|
||||||
|
{
|
||||||
|
_appearance.SetData(ent, ToggleVisuals.Toggled, "nocell");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnEntInserted(EntityUid uid, StunprodComponent component, EntInsertedIntoContainerMessage args)
|
private void OnEntInserted(EntityUid uid, StunprodComponent component, EntInsertedIntoContainerMessage args)
|
||||||
{
|
{
|
||||||
_itemToggle.TryDeactivate(uid, predicted: false);
|
_itemToggle.TryDeactivate(uid, predicted: false);
|
||||||
|
|
||||||
if (TryComp<AppearanceComponent>(uid, out var appearance))
|
_appearance.SetData(uid, ToggleVisuals.Toggled, false);
|
||||||
{
|
|
||||||
_appearance.SetData(uid, ToggleVisuals.Toggled, false, appearance);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnEntRemoved(EntityUid uid, StunprodComponent component, EntRemovedFromContainerMessage args)
|
private void OnEntRemoved(EntityUid uid, StunprodComponent component, EntRemovedFromContainerMessage args)
|
||||||
@@ -50,15 +54,9 @@ public sealed class StunprodSystem : EntitySystem
|
|||||||
if (TerminatingOrDeleted(uid))
|
if (TerminatingOrDeleted(uid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!_itemToggle.IsActivated(uid))
|
_itemToggle.TryDeactivate(uid, predicted: false);
|
||||||
{
|
|
||||||
if (TryComp<AppearanceComponent>(uid, out var appearance))
|
_appearance.SetData(uid, ToggleVisuals.Toggled, "nocell");
|
||||||
{
|
|
||||||
_appearance.SetData(uid, ToggleVisuals.Toggled, "nocell", appearance);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
_itemToggle.TryDeactivate(uid, predicted: false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnStaminaHitAttempt(EntityUid uid, StunprodComponent component,
|
private void OnStaminaHitAttempt(EntityUid uid, StunprodComponent component,
|
||||||
@@ -72,9 +70,7 @@ public sealed class StunprodSystem : EntitySystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (battery.CurrentCharge < component.EnergyPerUse)
|
if (battery.CurrentCharge < component.EnergyPerUse)
|
||||||
{
|
|
||||||
_itemToggle.TryDeactivate(uid, predicted: false);
|
_itemToggle.TryDeactivate(uid, predicted: false);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnExamined(EntityUid uid, StunprodComponent comp, ExaminedEvent args)
|
private void OnExamined(EntityUid uid, StunprodComponent comp, ExaminedEvent args)
|
||||||
@@ -90,10 +86,8 @@ public sealed class StunprodSystem : EntitySystem
|
|||||||
if (entity.Comp.HasHeldPrefix && TryComp<ItemComponent>(entity, out var item))
|
if (entity.Comp.HasHeldPrefix && TryComp<ItemComponent>(entity, out var item))
|
||||||
_item.SetHeldPrefix(entity.Owner, args.Activated ? "on" : "off", component: item);
|
_item.SetHeldPrefix(entity.Owner, args.Activated ? "on" : "off", component: item);
|
||||||
|
|
||||||
if (TryGetBatteryComponent(entity, out _, out _) || !TryComp<AppearanceComponent>(entity, out var appearance))
|
if (!TryGetBatteryComponent(entity, out _, out _))
|
||||||
return;
|
_appearance.SetData(entity, ToggleVisuals.Toggled, "nocell");
|
||||||
|
|
||||||
_appearance.SetData(entity, ToggleVisuals.Toggled, "nocell", appearance);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TryTurnOn(Entity<StunprodComponent> entity, ref ItemToggleActivateAttemptEvent args)
|
private void TryTurnOn(Entity<StunprodComponent> entity, ref ItemToggleActivateAttemptEvent args)
|
||||||
@@ -104,10 +98,7 @@ public sealed class StunprodSystem : EntitySystem
|
|||||||
|
|
||||||
args.Cancelled = true;
|
args.Cancelled = true;
|
||||||
|
|
||||||
if (TryComp<AppearanceComponent>(entity, out var appearance))
|
_appearance.SetData(entity, ToggleVisuals.Toggled, battery == null ? "nocell" : false);
|
||||||
{
|
|
||||||
_appearance.SetData(entity, ToggleVisuals.Toggled, battery == null ? "nocell" : false, appearance);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.User != null)
|
if (args.User != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -143,8 +143,8 @@ public abstract class SharedTentacleGun : EntitySystem
|
|||||||
if(!TryComp<PhysicsComponent>(activeItem, out var physicsComponent))
|
if(!TryComp<PhysicsComponent>(activeItem, out var physicsComponent))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var coords = Transform(args.Embedded).Coordinates;
|
if (!_handsSystem.TryDrop(args.Embedded, activeItem))
|
||||||
_handsSystem.TryDrop(args.Embedded, activeItem, coords);
|
continue;
|
||||||
|
|
||||||
var force = physicsComponent.Mass * 2.5f / 2;
|
var force = physicsComponent.Mass * 2.5f / 2;
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
sound: /Audio/Weapons/egloves.ogg
|
sound: /Audio/Weapons/egloves.ogg
|
||||||
- type: UseDelay
|
- type: UseDelay
|
||||||
- type: Item
|
- type: Item
|
||||||
|
heldPrefix: off
|
||||||
size: Normal
|
size: Normal
|
||||||
- type: Clothing
|
- type: Clothing
|
||||||
quickEquip: false
|
quickEquip: false
|
||||||
@@ -70,7 +71,6 @@
|
|||||||
cell_slot: !type:ContainerSlot {}
|
cell_slot: !type:ContainerSlot {}
|
||||||
- type: Snatcherprod
|
- type: Snatcherprod
|
||||||
- type: Stunprod
|
- type: Stunprod
|
||||||
hasHeldPrefix: false
|
|
||||||
- type: Construction
|
- type: Construction
|
||||||
deconstructionTarget: cuffs
|
deconstructionTarget: cuffs
|
||||||
graph: StunprodGraph
|
graph: StunprodGraph
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"version": 1,
|
"version": 1,
|
||||||
"license": "CC-BY-SA-3.0",
|
"license": "CC-BY-SA-3.0",
|
||||||
"copyright": "Taken from tgstation at https://github.com/tgstation/ at d0dffe7ca643db2624424fdcebf45863f85c0448",
|
"copyright": "Taken from tgstation at https://github.com/tgstation/ at d0dffe7ca643db2624424fdcebf45863f85c0448, on inhand sprites by Aviu",
|
||||||
"size": {
|
"size": {
|
||||||
"x": 32,
|
"x": 32,
|
||||||
"y": 32
|
"y": 32
|
||||||
@@ -23,12 +23,56 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "inhand-left",
|
"name": "off-inhand-left",
|
||||||
"directions": 4
|
"directions": 4
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "inhand-right",
|
"name": "off-inhand-right",
|
||||||
"directions": 4
|
"directions": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "on-inhand-left",
|
||||||
|
"directions": 4,
|
||||||
|
"delays": [
|
||||||
|
[
|
||||||
|
0.1,
|
||||||
|
0.1
|
||||||
|
],
|
||||||
|
[
|
||||||
|
0.1,
|
||||||
|
0.1
|
||||||
|
],
|
||||||
|
[
|
||||||
|
0.1,
|
||||||
|
0.1
|
||||||
|
],
|
||||||
|
[
|
||||||
|
0.1,
|
||||||
|
0.1
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "on-inhand-right",
|
||||||
|
"directions": 4,
|
||||||
|
"delays": [
|
||||||
|
[
|
||||||
|
0.1,
|
||||||
|
0.1
|
||||||
|
],
|
||||||
|
[
|
||||||
|
0.1,
|
||||||
|
0.1
|
||||||
|
],
|
||||||
|
[
|
||||||
|
0.1,
|
||||||
|
0.1
|
||||||
|
],
|
||||||
|
[
|
||||||
|
0.1,
|
||||||
|
0.1
|
||||||
|
]
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 675 B After Width: | Height: | Size: 675 B |
|
Before Width: | Height: | Size: 692 B After Width: | Height: | Size: 692 B |
Binary file not shown.
|
After Width: | Height: | Size: 735 B |
Binary file not shown.
|
After Width: | Height: | Size: 730 B |
Reference in New Issue
Block a user