Nuke anchor fixes + cargo sell blacklist (#10286)

This commit is contained in:
Kara
2022-08-03 20:01:14 -07:00
committed by GitHub
parent 2a2ef4ac51
commit 5784c248ac
5 changed files with 27 additions and 4 deletions

View File

@@ -0,0 +1,9 @@
namespace Content.Server.Cargo.Components;
/// <summary>
/// Marks an entity as unable to be sold through the cargo shuttle.
/// </summary>
[RegisterComponent]
public sealed class CargoSellBlacklistComponent : Component
{
}

View File

@@ -317,10 +317,15 @@ public sealed partial class CargoSystem
// Don't re-sell anything, sell anything anchored (e.g. light fixtures), or anything blacklisted // Don't re-sell anything, sell anything anchored (e.g. light fixtures), or anything blacklisted
// (e.g. players). // (e.g. players).
if (toSell.Contains(ent) || if (toSell.Contains(ent) ||
(xformQuery.TryGetComponent(ent, out var xform) && xform.Anchored)) continue; (xformQuery.TryGetComponent(ent, out var xform) && xform.Anchored))
continue;
if (HasComp<CargoSellBlacklistComponent>(ent))
continue;
var price = _pricing.GetPrice(ent); var price = _pricing.GetPrice(ent);
if (price == 0) continue; if (price == 0)
continue;
toSell.Add(ent); toSell.Add(ent);
amount += price; amount += price;
} }

View File

@@ -140,6 +140,13 @@ namespace Content.Server.Nuke
private void OnAnchorChanged(EntityUid uid, NukeComponent component, ref AnchorStateChangedEvent args) private void OnAnchorChanged(EntityUid uid, NukeComponent component, ref AnchorStateChangedEvent args)
{ {
UpdateUserInterface(uid, component); UpdateUserInterface(uid, component);
if (args.Anchored == false && component.Status == NukeStatus.ARMED && component.RemainingTime > component.DisarmDoafterLength)
{
// yes, this means technically if you can find a way to unanchor the nuke, you can disarm it
// without the doafter. but that takes some effort, and it won't allow you to disarm a nuke that can't be disarmed by the doafter.
DisarmBomb(uid, component);
}
} }
#endregion #endregion

View File

@@ -1,5 +1,5 @@
- type: entity - type: entity
parent: BaseStructureDynamic parent: BaseStructure
id: NuclearBomb id: NuclearBomb
name: nuclear fission explosive name: nuclear fission explosive
description: You probably shouldn't stick around to see if this is armed. description: You probably shouldn't stick around to see if this is armed.
@@ -45,8 +45,9 @@
interfaces: interfaces:
- key: enum.NukeUiKey.Key - key: enum.NukeUiKey.Key
type: NukeBoundUserInterface type: NukeBoundUserInterface
- type: StaticPrice # TODO: Make absolutely certain cargo cannot sell this, that'd be horrible. Presumably, add an export ban component so only the yarrs get a deal here. - type: StaticPrice
price: 50000 # YOU STOLE A NUCLEAR FISSION EXPLOSIVE?! price: 50000 # YOU STOLE A NUCLEAR FISSION EXPLOSIVE?!
- type: CargoSellBlacklist
- type: entity - type: entity
parent: NuclearBomb parent: NuclearBomb

View File

@@ -11,6 +11,7 @@
state: icon state: icon
- type: StaticPrice - type: StaticPrice
price: 2000 price: 2000
- type: CargoSellBlacklist
- type: WarpPoint - type: WarpPoint
location: nuke disk location: nuke disk