From 26ad73e6c5cfe7a4cfc47b45d72c4ef7a155ceae Mon Sep 17 00:00:00 2001 From: Saeko-44 Date: Sun, 15 Dec 2024 16:57:25 +0100 Subject: [PATCH 1/6] Added the medium component --- Content.Client/Ghost/GhostSystem.cs | 43 +++++++++++++++ .../ConstructionMediumComponent.cs | 12 +++++ .../EntityEffects/Effects/Polymorph.cs | 7 ++- Content.Server/Ghost/GhostSystem.cs | 53 +++++++++++++++++-- .../_Impstation/Ghost/MediumComponent.cs | 19 +++++++ .../Entities/Mobs/Player/medium.yml | 10 ++++ 6 files changed, 138 insertions(+), 6 deletions(-) create mode 100644 Content.Client/_Impstation/Construction/ConstructionMediumComponent.cs create mode 100644 Content.Shared/_Impstation/Ghost/MediumComponent.cs create mode 100644 Resources/Prototypes/_Impstation/Entities/Mobs/Player/medium.yml diff --git a/Content.Client/Ghost/GhostSystem.cs b/Content.Client/Ghost/GhostSystem.cs index 2a851d5bdce2ee..e3822e5d512995 100644 --- a/Content.Client/Ghost/GhostSystem.cs +++ b/Content.Client/Ghost/GhostSystem.cs @@ -46,8 +46,10 @@ private bool GhostVisibility public bool IsGhostBarPatron => PlayerGhostPatron != null; public event Action? PlayerRemoved; + public event Action? MediumRemoved; public event Action? PlayerUpdated; public event Action? PlayerAttached; + public event Action? MediumAttached; public event Action? PlayerDetached; public event Action? GhostWarpsResponse; public event Action? GhostRoleCountUpdated; @@ -69,6 +71,11 @@ public override void Initialize() SubscribeLocalEvent(OnToggleLighting); SubscribeLocalEvent(OnToggleFoV); SubscribeLocalEvent(OnToggleGhosts); + + SubscribeLocalEvent(OnMediumStartup); + SubscribeLocalEvent(OnGhostMediumPlayerAttach); + SubscribeLocalEvent(OnToggleGhostsMedium); + SubscribeLocalEvent(OnGhostMediumRemove); } private void OnStartup(EntityUid uid, GhostComponent component, ComponentStartup args) @@ -77,6 +84,12 @@ private void OnStartup(EntityUid uid, GhostComponent component, ComponentStartup sprite.Visible = GhostVisibility || uid == _playerManager.LocalEntity; } + private void OnMediumStartup(EntityUid uid, MediumComponent component, ComponentStartup args) + { + if (TryComp(uid, out SpriteComponent? sprite)) + sprite.Visible = GhostVisibility || uid == _playerManager.LocalEntity; + } + private void OnToggleLighting(EntityUid uid, EyeComponent component, ToggleLightingActionEvent args) { if (args.Handled) @@ -110,6 +123,19 @@ private void OnToggleGhosts(EntityUid uid, GhostComponent component, ToggleGhost args.Handled = true; } + private void OnToggleGhostsMedium(EntityUid uid, MediumComponent component, ToggleGhostsMediumActionEvent args) + { + if (args.Handled) + return; + + var locId = GhostVisibility ? "ghost-gui-toggle-ghost-visibility-popup-off" : "ghost-gui-toggle-ghost-visibility-popup-on"; + Popup.PopupEntity(Loc.GetString(locId), args.Performer); + if (uid == _playerManager.LocalEntity) + ToggleGhostVisibility(); + + args.Handled = true; + } + private void OnGhostRemove(EntityUid uid, GhostComponent component, ComponentRemove args) { _actions.RemoveAction(uid, component.ToggleLightingActionEntity); @@ -124,12 +150,29 @@ private void OnGhostRemove(EntityUid uid, GhostComponent component, ComponentRem PlayerRemoved?.Invoke(component); } + private void OnGhostMediumRemove(EntityUid uid, MediumComponent component, ComponentRemove args) + { + _actions.RemoveAction(uid, component.ToggleGhostsMediumActionEntity); + + if (uid != _playerManager.LocalEntity) + return; + + GhostVisibility = false; + MediumRemoved?.Invoke(component); + } + private void OnGhostPlayerAttach(EntityUid uid, GhostComponent component, LocalPlayerAttachedEvent localPlayerAttachedEvent) { GhostVisibility = true; PlayerAttached?.Invoke(component); } + private void OnGhostMediumPlayerAttach(EntityUid uid, MediumComponent component, LocalPlayerAttachedEvent localPlayerAttachedEvent) + { + GhostVisibility = true; + MediumAttached?.Invoke(component); + } + private void OnGhostState(EntityUid uid, GhostComponent component, ref AfterAutoHandleStateEvent args) { if (TryComp(uid, out var sprite)) diff --git a/Content.Client/_Impstation/Construction/ConstructionMediumComponent.cs b/Content.Client/_Impstation/Construction/ConstructionMediumComponent.cs new file mode 100644 index 00000000000000..7ebf106372b59e --- /dev/null +++ b/Content.Client/_Impstation/Construction/ConstructionMediumComponent.cs @@ -0,0 +1,12 @@ +using Content.Shared.Construction.Prototypes; +using Robust.Shared.GameObjects; +using Robust.Shared.ViewVariables; + +namespace Content.Client.Construction +{ + [RegisterComponent] + public sealed partial class ConstructionMediumComponent : Component + { + [ViewVariables] public ConstructionPrototype? Prototype { get; set; } + } +} diff --git a/Content.Server/EntityEffects/Effects/Polymorph.cs b/Content.Server/EntityEffects/Effects/Polymorph.cs index 2ee533a4d70013..eaac94182d27c1 100644 --- a/Content.Server/EntityEffects/Effects/Polymorph.cs +++ b/Content.Server/EntityEffects/Effects/Polymorph.cs @@ -1,5 +1,6 @@ using Content.Server.Polymorph.Components; using Content.Server.Polymorph.Systems; +using Content.Shared._Impstation.Ghost; using Content.Shared.EntityEffects; using Content.Shared.Polymorph; using Robust.Shared.Prototypes; @@ -27,7 +28,9 @@ public override void Effect(EntityEffectBaseArgs args) var polySystem = entityManager.System(); // Make it into a prototype - entityManager.EnsureComponent(uid); - polySystem.PolymorphEntity(uid, PolymorphPrototype); + //entityManager.EnsureComponent(uid); + //polySystem.PolymorphEntity(uid, PolymorphPrototype); + + entityManager.EnsureComponent(uid); } } diff --git a/Content.Server/Ghost/GhostSystem.cs b/Content.Server/Ghost/GhostSystem.cs index 77cf813b56b4f7..f5c27da2b001ba 100644 --- a/Content.Server/Ghost/GhostSystem.cs +++ b/Content.Server/Ghost/GhostSystem.cs @@ -7,6 +7,7 @@ using Content.Server.Mind; using Content.Server.Roles.Jobs; using Content.Server.Warps; +using Content.Shared._Impstation.Ghost; using Content.Shared.Actions; using Content.Shared.CCVar; using Content.Shared.Damage; @@ -95,6 +96,10 @@ public override void Initialize() SubscribeLocalEvent(_ => MakeVisible(true)); SubscribeLocalEvent(OnToggleGhostVisibilityToAll); + + SubscribeLocalEvent(OnMediumStartup); + SubscribeLocalEvent(OnMapInitMedium); + SubscribeLocalEvent(OnMediumShutdown); } private void OnGhostHearingAction(EntityUid uid, GhostComponent component, ToggleGhostHearingActionEvent args) @@ -171,8 +176,8 @@ private void OnGhostStartup(EntityUid uid, GhostComponent component, ComponentSt if (_gameTicker.RunLevel != GameRunLevel.PostRound) { - _visibilitySystem.AddLayer((uid, visibility), (int) VisibilityFlags.Ghost, false); - _visibilitySystem.RemoveLayer((uid, visibility), (int) VisibilityFlags.Normal, false); + _visibilitySystem.AddLayer((uid, visibility), (int)VisibilityFlags.Ghost, false); + _visibilitySystem.RemoveLayer((uid, visibility), (int)VisibilityFlags.Normal, false); _visibilitySystem.RefreshVisibility(uid, visibilityComponent: visibility); } @@ -182,6 +187,23 @@ private void OnGhostStartup(EntityUid uid, GhostComponent component, ComponentSt component.TimeOfDeath = time; } + private void OnMediumStartup(EntityUid uid, MediumComponent component, ComponentStartup args) + { + // Allow this entity to be seen by other ghosts. + var visibility = EnsureComp(uid); + + if (_gameTicker.RunLevel != GameRunLevel.PostRound) + { + _visibilitySystem.AddLayer((uid, visibility), (int)VisibilityFlags.Ghost, false); + _visibilitySystem.RemoveLayer((uid, visibility), (int)VisibilityFlags.Normal, false); + _visibilitySystem.RefreshVisibility(uid, visibilityComponent: visibility); + } + + SetCanSeeGhosts(uid, true); + + var time = _gameTiming.CurTime; + } + private void OnGhostShutdown(EntityUid uid, GhostComponent component, ComponentShutdown args) { // Perf: If the entity is deleting itself, no reason to change these back. @@ -191,8 +213,8 @@ private void OnGhostShutdown(EntityUid uid, GhostComponent component, ComponentS // Entity can't be seen by ghosts anymore. if (TryComp(uid, out VisibilityComponent? visibility)) { - _visibilitySystem.RemoveLayer((uid, visibility), (int) VisibilityFlags.Ghost, false); - _visibilitySystem.AddLayer((uid, visibility), (int) VisibilityFlags.Normal, false); + _visibilitySystem.RemoveLayer((uid, visibility), (int)VisibilityFlags.Ghost, false); + _visibilitySystem.AddLayer((uid, visibility), (int)VisibilityFlags.Normal, false); _visibilitySystem.RefreshVisibility(uid, visibilityComponent: visibility); } @@ -201,6 +223,24 @@ private void OnGhostShutdown(EntityUid uid, GhostComponent component, ComponentS _actions.RemoveAction(uid, component.BooActionEntity); } + private void OnMediumShutdown(EntityUid uid, MediumComponent component, ComponentShutdown args) + { + // Perf: If the entity is deleting itself, no reason to change these back. + if (Terminating(uid)) + return; + + // Entity can't be seen by ghosts anymore. + if (TryComp(uid, out VisibilityComponent? visibility)) + { + _visibilitySystem.RemoveLayer((uid, visibility), (int)VisibilityFlags.Ghost, false); + _visibilitySystem.AddLayer((uid, visibility), (int)VisibilityFlags.Normal, false); + _visibilitySystem.RefreshVisibility(uid, visibilityComponent: visibility); + } + + // Entity can't see ghosts anymore. + SetCanSeeGhosts(uid, false); + } + private void SetCanSeeGhosts(EntityUid uid, bool canSee, EyeComponent? eyeComponent = null) { if (!Resolve(uid, ref eyeComponent, false)) @@ -221,6 +261,11 @@ private void OnMapInit(EntityUid uid, GhostComponent component, MapInitEvent arg _actions.AddAction(uid, ref component.ToggleGhostsActionEntity, component.ToggleGhostsAction); } + private void OnMapInitMedium(EntityUid uid, MediumComponent component, MapInitEvent args) + { + _actions.AddAction(uid, ref component.ToggleGhostsMediumActionEntity, component.ToggleGhostsMediumAction); + } + private void OnGhostExamine(EntityUid uid, GhostComponent component, ExaminedEvent args) { var timeSinceDeath = _gameTiming.RealTime.Subtract(component.TimeOfDeath); diff --git a/Content.Shared/_Impstation/Ghost/MediumComponent.cs b/Content.Shared/_Impstation/Ghost/MediumComponent.cs new file mode 100644 index 00000000000000..ca74c24e1c2318 --- /dev/null +++ b/Content.Shared/_Impstation/Ghost/MediumComponent.cs @@ -0,0 +1,19 @@ +using Content.Shared.Actions; +using Content.Shared.Ghost; +using Robust.Shared.GameStates; +using Robust.Shared.Prototypes; + +namespace Content.Shared._Impstation.Ghost; + +[RegisterComponent, NetworkedComponent, Access(typeof(SharedGhostSystem))] +[AutoGenerateComponentState(true)] +public sealed partial class MediumComponent : Component +{ + [DataField] + public EntProtoId ToggleGhostsMediumAction = "ActionToggleGhostsMedium"; + + [DataField, AutoNetworkedField] + public EntityUid? ToggleGhostsMediumActionEntity; +} + +public sealed partial class ToggleGhostsMediumActionEvent : InstantActionEvent { } diff --git a/Resources/Prototypes/_Impstation/Entities/Mobs/Player/medium.yml b/Resources/Prototypes/_Impstation/Entities/Mobs/Player/medium.yml new file mode 100644 index 00000000000000..490b1fbbaab52b --- /dev/null +++ b/Resources/Prototypes/_Impstation/Entities/Mobs/Player/medium.yml @@ -0,0 +1,10 @@ +- type: entity + id: ActionToggleGhostsMedium + name: Toggle Ghosts + description: Toggle the visibility of ghosts. + components: + - type: InstantAction + icon: { sprite: Mobs/Ghosts/ghost_human.rsi, state: icon } + clientExclusive: true + checkCanInteract: false + event: !type:ToggleGhostsMediumActionEvent \ No newline at end of file From b84a0ac0be3d1edfa0338c7816bcd7d7c9a9c93b Mon Sep 17 00:00:00 2001 From: Saeko-44 Date: Sun, 15 Dec 2024 18:10:56 +0100 Subject: [PATCH 2/6] added the actual medium chemical --- .../EntityEffects/Effects/Polymorph.cs | 7 ++--- .../EntityEffects/Effects/Medium.cs | 30 +++++++++++++++++++ .../_Impstation/flavors/flavor-profiles.ftl | 2 ++ .../en-US/_Impstation/reagents/meta/fun.ftl | 3 ++ .../_Impstation/Flavors/flavors.yml | 5 ++++ .../Prototypes/_Impstation/Reagents/fun.yml | 12 ++++++++ .../Recipes/Reactions/chemicals.yml | 17 ++++------- 7 files changed, 60 insertions(+), 16 deletions(-) create mode 100644 Content.Server/_Impstation/EntityEffects/Effects/Medium.cs diff --git a/Content.Server/EntityEffects/Effects/Polymorph.cs b/Content.Server/EntityEffects/Effects/Polymorph.cs index eaac94182d27c1..2ee533a4d70013 100644 --- a/Content.Server/EntityEffects/Effects/Polymorph.cs +++ b/Content.Server/EntityEffects/Effects/Polymorph.cs @@ -1,6 +1,5 @@ using Content.Server.Polymorph.Components; using Content.Server.Polymorph.Systems; -using Content.Shared._Impstation.Ghost; using Content.Shared.EntityEffects; using Content.Shared.Polymorph; using Robust.Shared.Prototypes; @@ -28,9 +27,7 @@ public override void Effect(EntityEffectBaseArgs args) var polySystem = entityManager.System(); // Make it into a prototype - //entityManager.EnsureComponent(uid); - //polySystem.PolymorphEntity(uid, PolymorphPrototype); - - entityManager.EnsureComponent(uid); + entityManager.EnsureComponent(uid); + polySystem.PolymorphEntity(uid, PolymorphPrototype); } } diff --git a/Content.Server/_Impstation/EntityEffects/Effects/Medium.cs b/Content.Server/_Impstation/EntityEffects/Effects/Medium.cs new file mode 100644 index 00000000000000..724003199b1fd7 --- /dev/null +++ b/Content.Server/_Impstation/EntityEffects/Effects/Medium.cs @@ -0,0 +1,30 @@ +using Content.Shared._Impstation.Ghost; +using Content.Shared.EntityEffects; +using Content.Shared.Polymorph; +using Robust.Shared.Prototypes; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; + +namespace Content.Server._Impstation.EntityEffects.Effects; + +public sealed partial class Medium : EntityEffect +{ + /// + /// What Medium prototype is used on effect + /// + //[DataField("prototype", customTypeSerializer:typeof(PrototypeIdSerializer))] + //public string MediumPrototype { get; set; } + + protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) + { + return "Grants whoever drinks this the ability to see ghosts"; + } + + public override void Effect(EntityEffectBaseArgs args) + { + var entityManager = args.EntityManager; + var uid = args.TargetEntity; + + // Make it into a prototype + entityManager.EnsureComponent(uid); + } +} diff --git a/Resources/Locale/en-US/_Impstation/flavors/flavor-profiles.ftl b/Resources/Locale/en-US/_Impstation/flavors/flavor-profiles.ftl index 2feba84bf57fc4..8c84a735f3acd9 100644 --- a/Resources/Locale/en-US/_Impstation/flavors/flavor-profiles.ftl +++ b/Resources/Locale/en-US/_Impstation/flavors/flavor-profiles.ftl @@ -23,3 +23,5 @@ flavor-complex-snotty = like snot flavor-complex-speed = like speed flavor-base-whimsy = whimsical flavor-complex-secticket = like rotten eggs + +flavor-complex-medium = like your vision expanded \ No newline at end of file diff --git a/Resources/Locale/en-US/_Impstation/reagents/meta/fun.ftl b/Resources/Locale/en-US/_Impstation/reagents/meta/fun.ftl index 22978602d29a8c..a584ee7150bd68 100644 --- a/Resources/Locale/en-US/_Impstation/reagents/meta/fun.ftl +++ b/Resources/Locale/en-US/_Impstation/reagents/meta/fun.ftl @@ -12,3 +12,6 @@ reagent-desc-ungh-juice = The glucose and citric acid seem to have neutralized t reagent-name-holium = holium reagent-desc-holium = An impossibly compressed liquid. It feels as though it could tear through any surface. + +reagent-name-medium = medium +reagent-desc-medium = An alchemical medium to the afterlife. diff --git a/Resources/Prototypes/_Impstation/Flavors/flavors.yml b/Resources/Prototypes/_Impstation/Flavors/flavors.yml index 66fb901005f407..2a915968299c93 100644 --- a/Resources/Prototypes/_Impstation/Flavors/flavors.yml +++ b/Resources/Prototypes/_Impstation/Flavors/flavors.yml @@ -102,3 +102,8 @@ id: unholy flavorType: Base description: flavor-base-unholy + +- type: flavor + id: medium + flavorType: Complex + description: flavor-complex-medium diff --git a/Resources/Prototypes/_Impstation/Reagents/fun.yml b/Resources/Prototypes/_Impstation/Reagents/fun.yml index b0a700ce4b2648..320867580cd1d4 100644 --- a/Resources/Prototypes/_Impstation/Reagents/fun.yml +++ b/Resources/Prototypes/_Impstation/Reagents/fun.yml @@ -123,3 +123,15 @@ entity: FloorChasmEntity maxOnTileWhitelist: tags: [ FloorChasmEntity ] + +- type: reagent + id: Medium + name: reagent-name-medium + desc: reagent-desc-medium + physicalDesc: reagent-physical-desc-reflective + flavor: medium + color: "#DC89E0" + metabolisms: + Poison: + effects: + - !type:Medium diff --git a/Resources/Prototypes/_Impstation/Recipes/Reactions/chemicals.yml b/Resources/Prototypes/_Impstation/Recipes/Reactions/chemicals.yml index 8e0e0b7b51ad4d..799f90c16a3398 100644 --- a/Resources/Prototypes/_Impstation/Recipes/Reactions/chemicals.yml +++ b/Resources/Prototypes/_Impstation/Recipes/Reactions/chemicals.yml @@ -43,22 +43,17 @@ PhilosophersJuice: 1 - type: reaction - id: Holium - impact: High - minTemp: 1000 + id: Medium + impact: Medium #lol reactants: - Carbon: - amount: 200 - UncookedAnimalProteins: + AquamDivinos: amount: 50 - Honk: + Oculine: amount: 50 - Anomalium: - amount: 50 - Frezon: + THC: amount: 50 PhilosophersJuice: amount: 1 catalyst: true products: - Holium: 1 + Medium: 1 From 43e53f4294e0a6bc359ae5e7692a4035b8ff5fdb Mon Sep 17 00:00:00 2001 From: Saeko-44 Date: Sun, 15 Dec 2024 18:20:59 +0100 Subject: [PATCH 3/6] oops --- .../Recipes/Reactions/chemicals.yml | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Resources/Prototypes/_Impstation/Recipes/Reactions/chemicals.yml b/Resources/Prototypes/_Impstation/Recipes/Reactions/chemicals.yml index 799f90c16a3398..1475d47ec87e2a 100644 --- a/Resources/Prototypes/_Impstation/Recipes/Reactions/chemicals.yml +++ b/Resources/Prototypes/_Impstation/Recipes/Reactions/chemicals.yml @@ -42,6 +42,27 @@ products: PhilosophersJuice: 1 +- type: reaction + id: Holium + impact: High + minTemp: 1000 + reactants: + Carbon: + amount: 200 + UncookedAnimalProteins: + amount: 50 + Honk: + amount: 50 + Anomalium: + amount: 50 + Frezon: + amount: 50 + PhilosophersJuice: + amount: 1 + catalyst: true + products: + Holium: 1 + - type: reaction id: Medium impact: Medium #lol From 8bd867e82d494e64067493a719659dbeea23887b Mon Sep 17 00:00:00 2001 From: beck <163376292+widgetbeck@users.noreply.github.com> Date: Thu, 19 Dec 2024 08:01:47 -0500 Subject: [PATCH 4/6] whitespace --- .../Prototypes/_Impstation/Entities/Mobs/Player/medium.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/Prototypes/_Impstation/Entities/Mobs/Player/medium.yml b/Resources/Prototypes/_Impstation/Entities/Mobs/Player/medium.yml index 490b1fbbaab52b..e940f1d4028847 100644 --- a/Resources/Prototypes/_Impstation/Entities/Mobs/Player/medium.yml +++ b/Resources/Prototypes/_Impstation/Entities/Mobs/Player/medium.yml @@ -7,4 +7,4 @@ icon: { sprite: Mobs/Ghosts/ghost_human.rsi, state: icon } clientExclusive: true checkCanInteract: false - event: !type:ToggleGhostsMediumActionEvent \ No newline at end of file + event: !type:ToggleGhostsMediumActionEvent From d1267eb4f224f4a5014dca058b041cd9f54e0ef2 Mon Sep 17 00:00:00 2001 From: beck <163376292+widgetbeck@users.noreply.github.com> Date: Thu, 19 Dec 2024 08:03:40 -0500 Subject: [PATCH 5/6] whitespace --- Resources/Locale/en-US/_Impstation/flavors/flavor-profiles.ftl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/Locale/en-US/_Impstation/flavors/flavor-profiles.ftl b/Resources/Locale/en-US/_Impstation/flavors/flavor-profiles.ftl index 8c84a735f3acd9..4c8b1a08ca9c9c 100644 --- a/Resources/Locale/en-US/_Impstation/flavors/flavor-profiles.ftl +++ b/Resources/Locale/en-US/_Impstation/flavors/flavor-profiles.ftl @@ -24,4 +24,4 @@ flavor-complex-speed = like speed flavor-base-whimsy = whimsical flavor-complex-secticket = like rotten eggs -flavor-complex-medium = like your vision expanded \ No newline at end of file +flavor-complex-medium = like your vision expanded From af138590c9af8c53724972700ff93c2cb6fdb79a Mon Sep 17 00:00:00 2001 From: Saeko-44 Date: Sun, 22 Dec 2024 00:03:58 +0100 Subject: [PATCH 6/6] Added a duration to the medium effect --- Content.Server/Ghost/GhostSystem.cs | 18 ++++++++++++++++++ .../EntityEffects/Effects/Medium.cs | 3 +-- .../_Impstation/Ghost/MediumComponent.cs | 10 ++++++++++ .../Prototypes/_Impstation/Reagents/fun.yml | 3 +++ .../Recipes/Reactions/chemicals.yml | 6 +++--- 5 files changed, 35 insertions(+), 5 deletions(-) diff --git a/Content.Server/Ghost/GhostSystem.cs b/Content.Server/Ghost/GhostSystem.cs index f5c27da2b001ba..871e52460cf2b5 100644 --- a/Content.Server/Ghost/GhostSystem.cs +++ b/Content.Server/Ghost/GhostSystem.cs @@ -5,6 +5,7 @@ using Content.Server.GameTicking; using Content.Server.Ghost.Components; using Content.Server.Mind; +using Content.Server.Polymorph.Components; using Content.Server.Roles.Jobs; using Content.Server.Warps; using Content.Shared._Impstation.Ghost; @@ -29,6 +30,7 @@ using Robust.Server.GameObjects; using Robust.Server.Player; using Robust.Shared.Configuration; +using Robust.Shared.GameObjects; using Robust.Shared.Map; using Robust.Shared.Physics.Components; using Robust.Shared.Physics.Systems; @@ -102,6 +104,22 @@ public override void Initialize() SubscribeLocalEvent(OnMediumShutdown); } + public override void Update(float frameTime) + { + base.Update(frameTime); + + var query = EntityQueryEnumerator(); + while (query.MoveNext(out var uid, out var comp)) + { + comp.CurrentMediumTime += frameTime; + + if (comp.CurrentMediumTime > comp.MediumTime) + { + EntityManager.RemoveComponent(uid); + } + } + } + private void OnGhostHearingAction(EntityUid uid, GhostComponent component, ToggleGhostHearingActionEvent args) { args.Handled = true; diff --git a/Content.Server/_Impstation/EntityEffects/Effects/Medium.cs b/Content.Server/_Impstation/EntityEffects/Effects/Medium.cs index 724003199b1fd7..a72ec8c21ba427 100644 --- a/Content.Server/_Impstation/EntityEffects/Effects/Medium.cs +++ b/Content.Server/_Impstation/EntityEffects/Effects/Medium.cs @@ -16,7 +16,7 @@ public sealed partial class Medium : EntityEffect protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) { - return "Grants whoever drinks this the ability to see ghosts"; + return "Grants whoever drinks this the ability to see ghosts for a while"; } public override void Effect(EntityEffectBaseArgs args) @@ -24,7 +24,6 @@ public override void Effect(EntityEffectBaseArgs args) var entityManager = args.EntityManager; var uid = args.TargetEntity; - // Make it into a prototype entityManager.EnsureComponent(uid); } } diff --git a/Content.Shared/_Impstation/Ghost/MediumComponent.cs b/Content.Shared/_Impstation/Ghost/MediumComponent.cs index ca74c24e1c2318..70fdd6399c1aed 100644 --- a/Content.Shared/_Impstation/Ghost/MediumComponent.cs +++ b/Content.Shared/_Impstation/Ghost/MediumComponent.cs @@ -14,6 +14,16 @@ public sealed partial class MediumComponent : Component [DataField, AutoNetworkedField] public EntityUid? ToggleGhostsMediumActionEntity; + + //Time in seconds passed since medium vision activated + [DataField, AutoNetworkedField] + public float CurrentMediumTime = 0; + + //Time after how many seconds the medium effect stops + //Im just gonna put it here as a constant instead of making a whole prototype to set it from the yaml + //Because Im not expected for other reagents to reuse that effect and even less so with a different time limit + [DataField, AutoNetworkedField] + public float MediumTime = 300; // 5 minutes } public sealed partial class ToggleGhostsMediumActionEvent : InstantActionEvent { } diff --git a/Resources/Prototypes/_Impstation/Reagents/fun.yml b/Resources/Prototypes/_Impstation/Reagents/fun.yml index 320867580cd1d4..04f0e5f0f18170 100644 --- a/Resources/Prototypes/_Impstation/Reagents/fun.yml +++ b/Resources/Prototypes/_Impstation/Reagents/fun.yml @@ -135,3 +135,6 @@ Poison: effects: - !type:Medium + conditions: + - !type:ReagentThreshold + min: 20 diff --git a/Resources/Prototypes/_Impstation/Recipes/Reactions/chemicals.yml b/Resources/Prototypes/_Impstation/Recipes/Reactions/chemicals.yml index 1475d47ec87e2a..2d18023fb83768 100644 --- a/Resources/Prototypes/_Impstation/Recipes/Reactions/chemicals.yml +++ b/Resources/Prototypes/_Impstation/Recipes/Reactions/chemicals.yml @@ -68,11 +68,11 @@ impact: Medium #lol reactants: AquamDivinos: - amount: 50 + amount: 1 Oculine: - amount: 50 + amount: 1 THC: - amount: 50 + amount: 1 PhilosophersJuice: amount: 1 catalyst: true