Early merge of #42158. Fixes medibots.

This commit is contained in:
Vanessa 2025-12-29 11:37:40 -06:00
parent 9835041bbb
commit cf76599616
8 changed files with 24 additions and 19 deletions

View File

@ -66,6 +66,7 @@ public sealed partial class InjectorSystem : EntitySystem
ToggleMode(injector, args.User);
args.Handled = true;
args.ApplyDelay = false;
}
private void OnInjectorAfterInteract(Entity<InjectorComponent> injector, ref AfterInteractEvent args)
@ -83,12 +84,12 @@ public sealed partial class InjectorSystem : EntitySystem
return;
}
args.Handled = TryMobsDoAfter(injector, args.User, target);
args.Handled |= TryMobsDoAfter(injector, args.User, target);
return;
}
// Draw from or inject into jugs, bottles, etc.
args.Handled = ContainerDoAfter(injector, args.User, target);
args.Handled |= TryContainerDoAfter(injector, args.User, target);
}
private void OnInjectDoAfter(Entity<InjectorComponent> injector, ref InjectorDoAfterEvent args)
@ -96,7 +97,7 @@ public sealed partial class InjectorSystem : EntitySystem
if (args.Cancelled || args.Handled || args.Args.Target == null)
return;
args.Handled = TryUseInjector(injector, args.Args.User, args.Args.Target.Value);
args.Handled |= TryUseInjector(injector, args.Args.User, args.Args.Target.Value);
}
private void OnAttack(Entity<InjectorComponent> injector, ref MeleeHitEvent args)
@ -198,7 +199,7 @@ public sealed partial class InjectorSystem : EntitySystem
|| !GetMobsDoAfterTime(injector, user, target, out var doAfterTime, out var amount)) // Get the DoAfter time.
return false;
_doAfter.TryStartDoAfter(new DoAfterArgs(EntityManager, user, doAfterTime, new InjectorDoAfterEvent(), injector.Owner, target: target, used: injector.Owner)
if (!_doAfter.TryStartDoAfter(new DoAfterArgs(EntityManager, user, doAfterTime, new InjectorDoAfterEvent(), injector.Owner, target: target, used: injector.Owner)
{
BreakOnMove = true,
BreakOnWeightlessMove = false,
@ -206,7 +207,8 @@ public sealed partial class InjectorSystem : EntitySystem
NeedHand = injector.Comp.NeedHand,
BreakOnHandChange = injector.Comp.BreakOnHandChange,
MovementThreshold = injector.Comp.MovementThreshold,
});
}))
return false;
// If the DoAfter was instant, don't send popups and logs indicating an attempt.
if (doAfterTime == TimeSpan.Zero)
@ -303,12 +305,12 @@ public sealed partial class InjectorSystem : EntitySystem
#endregion Mob Interaction
#region Container Interaction
private bool ContainerDoAfter(Entity<InjectorComponent> injector, EntityUid user, EntityUid target)
private bool TryContainerDoAfter(Entity<InjectorComponent> injector, EntityUid user, EntityUid target)
{
if (!GetContainerDoAfterTime(injector, user, target, out var doAfterTime))
return false;
_doAfter.TryStartDoAfter(new DoAfterArgs(EntityManager, user, doAfterTime, new InjectorDoAfterEvent(), injector.Owner, target: target, used: injector.Owner)
return _doAfter.TryStartDoAfter(new DoAfterArgs(EntityManager, user, doAfterTime, new InjectorDoAfterEvent(), injector.Owner, target: target, used: injector.Owner)
{
BreakOnMove = true,
BreakOnWeightlessMove = false,
@ -317,8 +319,6 @@ public sealed partial class InjectorSystem : EntitySystem
BreakOnHandChange = injector.Comp.BreakOnHandChange,
MovementThreshold = injector.Comp.MovementThreshold,
});
return true;
}
/// <summary>

View File

@ -135,7 +135,7 @@ public sealed class MedibotSystem : EntitySystem
EnsureComp<NPCRecentlyInjectedComponent>(target);
_solutionContainer.TryAddReagent(injectable.Value, treatment.Reagent, treatment.Quantity, out _);
_popup.PopupEntity(Loc.GetString("hypospray-component-feel-prick-message"), target, target);
_popup.PopupEntity(Loc.GetString("injector-component-feel-prick-message"), target, target);
_popup.PopupClient(Loc.GetString("medibot-target-injected"), medibot, medibot);
_audio.PlayPredicted(medibot.Comp.InjectSound, medibot, medibot);

View File

@ -1,4 +1,9 @@
- files: ["healthscanner.ogg"]
license: "CC-BY-4.0"
copyright: "Taken from FM Synthesis on freesound.org"
source: "https://freesound.org/people/FreqMan/sounds/32683/"
source: "https://freesound.org/people/FreqMan/sounds/32683/"
- files: ["jet_injector.ogg"]
license: "CC-BY-3.0"
copyright: "Orginal audio by EminYILDIRIM -- https://freesound.org/s/548009/ -- License: Attribution 4.0, 2imitk -- https://freesound.org/s/279044/ -- License: Attribution 3.0 and brunoboselli -- https://freesound.org/s/457294/ -- License: Creative Commons 0 -- https://freesound.org/s/460586/ -- License: Attribution NonCommercial 4.0, modified by Princess-Cheeseballs (GitHub)"
source: "https://github.com/space-wizards/space-station-14/pull/40076"

Binary file not shown.

View File

@ -173,9 +173,4 @@
- files: ["wirebrushing.ogg"]
license: "CC0-1.0"
copyright: "Created by romulofs, converted to OGG, and edited by TiniestShark (Github)"
source: "https://freesound.org/s/127541/"
- files: ["jet_injector.ogg"]
license: "CC-BY-3.0"
copyright: "Orginal audio by EminYILDIRIM -- https://freesound.org/s/548009/ -- License: Attribution 4.0, 2imitk -- https://freesound.org/s/279044/ -- License: Attribution 3.0 and brunoboselli -- https://freesound.org/s/457294/ -- License: Creative Commons 0, modified by Princess-Cheeseballs (GitHub)"
source: "https://github.com/space-wizards/space-station-14/pull/40076"
source: "https://freesound.org/s/127541/"

View File

@ -127,7 +127,7 @@
abstract: true
parent: BaseHyposprayMode
id: BaseJetInjectorMode
injectSound: /Audio/Items/jet_injector.ogg
injectSound: /Audio/Items/Medical/jet_injector.ogg
popupUserAttempt: injector-component-spray-injecting-user
popupTargetAttempt: injector-component-spray-injecting-target

View File

@ -10,6 +10,11 @@
allowedModes:
- HyposprayDynamicMode
- HyposprayInjectMode
- type: Spillable
solution: hypospray
- type: ExaminableSolution
solution: hypospray
- type: Appearance
- type: entity
parent: [BaseHypospray, BaseGrandTheftContraband]
@ -115,7 +120,7 @@
- type: Item
sprite: Objects/Specific/Medical/jetinjector.rsi
- type: UseDelay
delay: 2.0
delay: 1.5
- type: SolutionContainerManager
solutions:
hypospray: