Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mediborg candy refactor #2639

Merged
merged 2 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions Content.Shared/Nyanotrasen/Actions/FabricateCandyEvent.cs

This file was deleted.

46 changes: 46 additions & 0 deletions Content.Shared/_DV/Silicons/Borgs/FabricateCandyComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using Content.Shared.Actions;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;

namespace Content.Shared._DV.Silicons.Borgs;

/// <summary>
/// Lets a medical borg spawn a number of candy items using actions.
/// </summary>
[RegisterComponent, NetworkedComponent]
public sealed partial class FabricateCandyComponent : Component
{
/// <summary>
/// Actions to add to the entity.
/// </summary>
[DataField(required: true)]
public List<EntProtoId> Actions = new();

/// <summary>
/// The sound played when fabricating candy.
/// </summary>
[DataField]
public SoundSpecifier FabricationSound = new SoundPathSpecifier("/Audio/Machines/machine_vend.ogg")
{
Params = new AudioParams
{
Volume = -2f
}
};
}

/// <summary>
/// Action event to use for candy fabrication actions.
/// </summary>
public sealed partial class FabricateCandyActionEvent : InstantActionEvent
{
/// <summary>
/// The item to spawn at the borg.
/// </summary>
/// <remarks>
/// The client only sends a <see cref="RequestPerformActionEvent"/>, no exploits possible with this being in the event.
/// </remarks>
[DataField(required: true)]
public EntProtoId Item;
}
45 changes: 45 additions & 0 deletions Content.Shared/_DV/Silicons/Borgs/FabricateCandySystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using Content.Shared.Actions;
using Content.Shared.Administration.Logs;
using Content.Shared.Database;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Network;
using Robust.Shared.Prototypes;

namespace Content.Shared._DV.Silicons.Borgs;

public sealed partial class FabricateCandySystem : EntitySystem
{
[Dependency] private readonly INetManager _net = default!;
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly SharedActionsSystem _actions = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<FabricateCandyComponent, MapInitEvent>(OnMapInit);
SubscribeLocalEvent<FabricateCandyComponent, FabricateCandyActionEvent>(OnFabricate);
}

private void OnMapInit(Entity<FabricateCandyComponent> ent, ref MapInitEvent args)
{
var (uid, comp) = ent;
foreach (var id in comp.Actions)
{
_actions.AddAction(uid, id);
}
}

private void OnFabricate(Entity<FabricateCandyComponent> ent, ref FabricateCandyActionEvent args)
{
_audio.PlayPredicted(ent.Comp.FabricationSound, ent, ent);
args.Handled = true;

if (_net.IsClient)
return;

var spawned = Spawn(args.Item, Transform(ent).Coordinates);
_adminLogger.Add(LogType.EntitySpawn, LogImpact.Low, $"{ToPrettyString(ent):player} fabricated {ToPrettyString(spawned):item}");
}
}
5 changes: 0 additions & 5 deletions Resources/Locale/en-US/nyanotrasen/abilities/borgs.ftl

This file was deleted.

21 changes: 0 additions & 21 deletions Resources/Prototypes/Nyanotrasen/Actions/types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,24 +142,3 @@
- type: InstantAction
icon: Nyanotrasen/Interface/VerbIcons/psionic_invisibility_off.png
event: !type:RemovePsionicInvisibilityOffPowerActionEvent

- type: entity
id: ActionFabricateLollipop
name: action-name-fabricate-lollipop
description: action-description-fabricate-lollipop
components:
- type: InstantAction
icon: { sprite: Nyanotrasen/Objects/Consumable/Food/candy.rsi, state: lollipop }
useDelay: 120
event: !type:FabricateLollipopActionEvent

- type: entity
id: ActionFabricateGumball
name: action-name-fabricate-gumball
description: action-description-fabricate-gumball
components:
- type: InstantAction
icon: { sprite: Nyanotrasen/Objects/Consumable/Food/candy.rsi, state: gumball }
iconColor: '#FFAED7'
useDelay: 40
event: !type:FabricateGumballActionEvent
22 changes: 22 additions & 0 deletions Resources/Prototypes/_DV/Actions/borgs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
- type: entity
id: ActionFabricateLollipop
name: Fabricate Lollipop
description: Fabricate a lollipop that contains a small dose of Omnizine.
components:
- type: InstantAction
icon: { sprite: _DV/Objects/Consumable/Food/candy.rsi, state: lollipop }
useDelay: 120
event: !type:FabricateCandyActionEvent
item: FoodLollipop

- type: entity
id: ActionFabricateGumball
name: Fabricate Gumball
description: Fabricate a gumball full of sugar and medicine to treat small injuries.
components:
- type: InstantAction
icon: { sprite: _DV/Objects/Consumable/Food/candy.rsi, state: gumball }
iconColor: '#FFAED7'
useDelay: 40
event: !type:FabricateCandyActionEvent
item: FoodGumball
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
- type: entity
abstract: true
parent: FoodBase
id: FoodCandyBase
components:
- type: Sprite
sprite: _DV/Objects/Consumable/Food/candy.rsi
- type: Appearance
- type: RandomizedCandy

- type: entity
parent: FoodCandyBase
id: FoodLollipop
name: lollipop
description: For being such a good sport! It's enriched with potent yet mostly safe-to-eat medicine.
components:
- type: SolutionContainerManager
solutions:
food:
maxVol: 15
maxVol: 17 # 2 extra
reagents:
- ReagentId: Sugar
Quantity: 3
Expand All @@ -20,29 +30,26 @@
- ReagentId: Vitamin
Quantity: 3
- type: Sprite
sprite: Nyanotrasen/Objects/Consumable/Food/candy.rsi
layers:
- state: lollipop-ball
map: [ "enum.CandyVisualLayers.Ball" ]
- state: lollipop-stickandshine
- type: Clothing
sprite: Nyanotrasen/Objects/Consumable/Food/candy.rsi
sprite: _DV/Objects/Consumable/Food/candy.rsi
slots: [ mask ]
equippedPrefix: lollipop
quickEquip: false # would block eating otherwise
- type: Appearance
- type: RandomizedCandy
quickEquip: false # would block eating otherwise

- type: entity
parent: FoodBase
parent: FoodCandyBase
id: FoodGumball
name: gumball
description: Try as you might, you can't blow bubbles with it... it's enriched with medicine for minor ailments.
description: "Try as you might, you can't blow bubbles with it... it's enriched with medicine for minor ailments."
Lyndomen marked this conversation as resolved.
Show resolved Hide resolved
components:
- type: SolutionContainerManager
solutions:
food:
maxVol: 15
maxVol: 15 # 1 extra
reagents:
- ReagentId: Sugar
Quantity: 5
Expand All @@ -53,10 +60,7 @@
- ReagentId: Dylovene
Quantity: 3
- type: Sprite
sprite: Nyanotrasen/Objects/Consumable/Food/candy.rsi
layers:
- state: gumball
map: [ "enum.CandyVisualLayers.Ball" ]
- state: gumball-shine
- type: Appearance
- type: RandomizedCandy
5 changes: 4 additions & 1 deletion Resources/Prototypes/borg_types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@
- type: ShowHealthIcons
damageContainers:
- Biological
- type: FabricateCandy # Nyanotrasen - The medical cyborg can generate candies filled with medicine.
- type: FabricateCandy # DeltaV - The medical cyborg can generate candies filled with medicine.
actions:
- ActionFabricateLollipop
- ActionFabricateGumball
Lyndomen marked this conversation as resolved.
Show resolved Hide resolved
- type: SurgeryTarget # Shitmed
- type: Sanitized # Shitmed

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"version": 1,
"license": "CC-BY-SA-3.0",
"copyright": "Taken from tgstation at commit https://github.com/tgstation/tgstation/commit/c6e3401f2e7e1e55c57060cdf956a98ef1fefc24, made colorable by pissdemon, equip sprites made by pissdemon based on cigarette.rsi taken from tgstation and paradise (see attributions in Resources/Textures/Objects/Consumable/Smokeables/Cigarettes/cigarette.rsi)",
"size": {
"x": 32,
"y": 32
},
"states": [
{
"name": "gumball"
},
{
"name": "gumball-shine"
},
{
"name": "lollipop"
},
{
"name": "lollipop-ball"
},
{
"name": "lollipop-stickandshine"
},
{
"name": "lollipop-equipped-MASK",
"directions": 4
},
{
"name": "lollipop-equipped-MASK-vulpkanin",
"directions": 4
}
]
}
Loading