-
Notifications
You must be signed in to change notification settings - Fork 359
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor borg candy and move to shared _DV namespace Signed-off-by: deltanedas <[email protected]> Co-authored-by: deltanedas <@deltanedas:kde.org>
- Loading branch information
1 parent
8d04118
commit 60c5291
Showing
19 changed files
with
167 additions
and
149 deletions.
There are no files selected for viewing
25 changes: 0 additions & 25 deletions
25
Content.Server/Nyanotrasen/Abilities/Borgs/FabricateCandyComponent.cs
This file was deleted.
Oops, something went wrong.
47 changes: 0 additions & 47 deletions
47
Content.Server/Nyanotrasen/Abilities/Borgs/FabricateCandySystem.cs
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
46 changes: 46 additions & 0 deletions
46
Content.Shared/_DV/Silicons/Borgs/FabricateCandyComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}"); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 0 additions & 34 deletions
34
Resources/Textures/Nyanotrasen/Objects/Consumable/Food/candy.rsi/meta.json
This file was deleted.
Oops, something went wrong.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
34 changes: 34 additions & 0 deletions
34
Resources/Textures/_DV/Objects/Consumable/Food/candy.rsi/meta.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
] | ||
} |