Skip to content

Commit

Permalink
Proximity fuse (#191)
Browse files Browse the repository at this point in the history
* Proximity fuse

* Proximity fuse is now purchasable

* Fix "PS" not being "PF"
  • Loading branch information
Just-a-Unity-Dev authored Nov 10, 2023
1 parent c8fb819 commit e7b8e58
Show file tree
Hide file tree
Showing 10 changed files with 391 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Content.Server._FTL.TriggerOnEnterGrid;

[RegisterComponent]
public sealed partial class TriggerOnEnterGridComponent : Component
{
public bool ReadyToTrigger = false;
}
35 changes: 35 additions & 0 deletions Content.Server/_FTL/TriggerOnEnterGrid/TriggerOnEnterGridSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using Content.Server.Explosion.EntitySystems;

namespace Content.Server._FTL.TriggerOnEnterGrid;

/// <summary>
/// This handles...
/// </summary>
public sealed class TriggerOnEnterGridSystem : EntitySystem
{
public override void Update(float frameTime)
{
base.Update(frameTime);

var query = EntityQueryEnumerator<TriggerOnEnterGridComponent, TransformComponent>();
while (query.MoveNext(out var entity, out var component, out var xform))
{
switch (component.ReadyToTrigger)
{
case true when xform.GridUid.HasValue:
Trigger(entity);
break;
case false when !xform.GridUid.HasValue:
component.ReadyToTrigger = true;
break;
}
}
}

public bool Trigger(EntityUid trigger, EntityUid? user = null)
{
var triggerEvent = new TriggerEvent(trigger, user);
EntityManager.EventBus.RaiseLocalEvent(trigger, triggerEvent, true);
return triggerEvent.Handled;
}
}
24 changes: 21 additions & 3 deletions Resources/Locale/en-US/_ftl/crates.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ ent-120mmAmmoAP = { ent-Crate120mmAmmoAP }
ent-140mmAmmoAP = { ent-Crate140mmAmmoAP }
.desc = { ent-Crate140mmAmmoAP.desc }
ent-105mmAmmoPS = { ent-Crate105mmAmmoPS }
.desc = { ent-Crate105mmAmmoPS.desc }
ent-120mmAmmoPS = { ent-Crate120mmAmmoPS }
.desc = { ent-Crate120mmAmmoPS.desc }
ent-140mmAmmoPS = { ent-Crate140mmAmmoPS }
.desc = { ent-Crate140mmAmmoPS.desc }
# crates
# missiles
ent-CrateT1Missiles = structural damage missiles
Expand All @@ -50,13 +59,13 @@ ent-CrateT3Missiles = total area destruction missiles
# ammo
ent-Crate20mmAmmo = 20mm mixed ammo crate
.desc = This crate contains 20 boxes of 20mm, both HE and AP.
.desc = This crate contains 30 boxes of 20mm of several types of ammunition.
ent-Crate53mmAmmo = 53mm mixed ammo crate
.desc = This crate contains 10 boxes of 53mm, both HE and AP.
.desc = This crate contains 15 boxes of 53mm of several types of ammunition.
ent-Crate80mmAmmo = 80mm mixed ammo crate
.desc = This crate contains 6 boxes of 80mm, both HE and AP.
.desc = This crate contains 9 boxes of 80mm of several types of ammunition.
ent-Crate105mmAmmoHE = 105mm ammo crate (HE)
.desc = This crate contains 30 shells of high-explosive 105mm.
Expand All @@ -75,3 +84,12 @@ ent-Crate120mmAmmoAP = 120mm ammo crate (AP)
ent-Crate140mmAmmoAP = 140mm ammo crate (AP)
.desc = This crate contains 10 shells of armor-piercing 140mm.
ent-Crate105mmAmmoPS = 105mm ammo crate (PF)
.desc = This crate contains 30 shells of proximity-fuse 105mm.
ent-Crate120mmAmmoPS = 120mm ammo crate (PF)
.desc = This crate contains 20 shells of proximity-fuse 120mm.
ent-Crate140mmAmmoPS = 140mm ammo crate (PF)
.desc = This crate contains 10 shells of proximity-fuse 140mm.
30 changes: 30 additions & 0 deletions Resources/Prototypes/_FTL/Catalog/Cargo/cargo_security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,33 @@
cost: 30000
category: Security
group: market

- type: cargoProduct
id: 105mmAmmoPF
icon:
sprite: _FTL/Structures/Weapons/silo.rsi
state: closed
product: Crate105mmAmmoPF
cost: 10000
category: Security
group: market

- type: cargoProduct
id: 120mmAmmoPF
icon:
sprite: _FTL/Structures/Weapons/silo.rsi
state: closed
product: Crate120mmAmmoPF
cost: 10000
category: Security
group: market

- type: cargoProduct
id: 140mmAmmoPF
icon:
sprite: _FTL/Structures/Weapons/silo.rsi
state: closed
product: Crate140mmAmmoPF
cost: 30000
category: Security
group: market
33 changes: 33 additions & 0 deletions Resources/Prototypes/_FTL/Catalog/Fills/Crates/ammo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
amount: 10
- id: MagazineBox20mmAP
amount: 10
- id: MagazineBox20mmPF
amount: 10

- type: entity
id: Crate53mmAmmo
Expand All @@ -19,6 +21,8 @@
amount: 5
- id: MagazineBox53mmAP
amount: 5
- id: MagazineBox53mmPF
amount: 5

- type: entity
id: Crate80mmAmmo
Expand All @@ -30,6 +34,8 @@
amount: 3
- id: MagazineBox80mmAP
amount: 3
- id: MagazineBox80mmPF
amount: 3

- type: entity
id: Crate105mmAmmoHE
Expand Down Expand Up @@ -84,3 +90,30 @@
contents:
- id: Cartridge140mmAP
amount: 10

- type: entity
id: Crate105mmAmmoPF
parent: CrateGenericSteel
components:
- type: StorageFill
contents:
- id: Cartridge105mmPF
amount: 30

- type: entity
id: Crate120mmAmmoPF
parent: CrateGenericSteel
components:
- type: StorageFill
contents:
- id: Cartridge120mmPF
amount: 20

- type: entity
id: Crate140mmAmmoPF
parent: CrateGenericSteel
components:
- type: StorageFill
contents:
- id: Cartridge140mmPF
amount: 10
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- type: entity
id: MagazineBox20mm
name: ammo box (20mm)
name: ammo box (20mm high-explosive)
parent: BaseMagazineBox
components:
- type: Tag
Expand All @@ -16,7 +16,7 @@

- type: entity
id: MagazineBox53mm
name: ammo box (53mm)
name: ammo box (53mm high-explosive)
parent: BaseMagazineBox
components:
- type: Tag
Expand All @@ -32,7 +32,7 @@

- type: entity
id: MagazineBox80mm
name: ammo box (80mm)
name: ammo box (80mm high-explosive)
parent: BaseMagazineBox
components:
- type: Tag
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
- type: entity
id: MagazineBox20mmPF
name: ammo box (20mm proximity fuse)
parent: BaseMagazineBox
components:
- type: Tag
tags:
- Magazine20mm
- type: BallisticAmmoProvider
mayTransfer: true
whitelist:
tags:
- Cartridge20mm
proto: Cartridge20mmPF
capacity: 500

- type: entity
id: MagazineBox53mmPF
name: ammo box (53mm proximity fuse)
parent: BaseMagazineBox
components:
- type: Tag
tags:
- Magazine53mm
- type: BallisticAmmoProvider
mayTransfer: true
whitelist:
tags:
- Cartridge53mm
proto: Cartridge53mmPF
capacity: 500

- type: entity
id: MagazineBox80mmPF
name: ammo box (80mm proximity fuse)
parent: BaseMagazineBox
components:
- type: Tag
tags:
- Magazine80mm
- type: BallisticAmmoProvider
mayTransfer: true
whitelist:
tags:
- Cartridge80mm
proto: Cartridge80mmPF
capacity: 250
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
- type: entity
id: Cartridge20mmPF
name: cartridge (20mm proximity fuse)
parent: BaseCartridge
components:
- type: Tag
tags:
- Cartridge
- Cartridge20mm
- type: Sprite
sprite: _FTL/Objects/Weapons/Guns/Ammunition/Explosives/explosives.rsi
layers:
- state: 20mm
- type: Appearance
- type: CartridgeAmmo
deleteOnSpawn: true
proto: Bullet20mmPF
- type: entity
id: Cartridge53mmPF
name: cartridge (53mm proximity fuse)
parent: BaseCartridge
components:
- type: Tag
tags:
- Cartridge
- Cartridge53mm
- type: Sprite
sprite: _FTL/Objects/Weapons/Guns/Ammunition/Explosives/explosives.rsi
layers:
- state: 53mm
- type: Appearance
- type: CartridgeAmmo
deleteOnSpawn: true
proto: Bullet53mmPF
- type: entity
id: Cartridge80mmPF
name: cartridge (80mm proximity fuse)
parent: BaseCartridge
components:
- type: Tag
tags:
- Cartridge
- Cartridge80mm
- type: Sprite
sprite: _FTL/Objects/Weapons/Guns/Ammunition/Explosives/explosives.rsi
layers:
- state: 53mm # we do a thing called "reusing sprites"
- type: Appearance
- type: CartridgeAmmo
deleteOnSpawn: true
proto: Bullet80mmPF
- type: entity
id: Cartridge105mmPF
name: cartridge (105mm proximity fuse)
parent: BaseCartridge
components:
- type: Tag
tags:
- Cartridge
- Cartridge105mm
- type: Sprite
sprite: _FTL/Objects/Weapons/Guns/Ammunition/Explosives/explosives.rsi
layers:
- state: 105mm
- type: Appearance
- type: CartridgeAmmo
deleteOnSpawn: true
proto: Bullet105mmPF
- type: entity
id: Cartridge120mmPF
name: cartridge (120mm proximity fuse)
parent: BaseCartridge
components:
- type: Tag
tags:
- Cartridge
- Cartridge120mm
- type: Sprite
sprite: _FTL/Objects/Weapons/Guns/Ammunition/Explosives/explosives.rsi
layers:
- state: 105mm # we do a thing called "reusing sprites"
- type: Appearance
- type: CartridgeAmmo
deleteOnSpawn: true
proto: Bullet120mmPF
- type: entity
id: Cartridge140mmPF
name: cartridge (140mm proximity fuse)
parent: BaseCartridge
components:
- type: Tag
tags:
- Cartridge
- Cartridge140mm
- type: Sprite
sprite: _FTL/Objects/Weapons/Guns/Ammunition/Explosives/explosives.rsi
layers:
- state: 140mm
- type: Appearance
- type: CartridgeAmmo
deleteOnSpawn: true
proto: Bullet140mmPF
Loading

0 comments on commit e7b8e58

Please sign in to comment.