Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Jabak
2024-05-31 23:12:21 +03:00
55 changed files with 1241 additions and 33 deletions

View File

@@ -37,8 +37,10 @@ using Content.Shared._White.Cult.Components;
using Content.Shared._White.Cult.Runes;
using Content.Shared._White.Cult.UI;
using Content.Shared.Cuffs;
using Content.Shared.FixedPoint;
using Content.Shared.GameTicking;
using Content.Shared.Mindshield.Components;
using Content.Shared.Mobs.Systems;
using Content.Shared.Movement.Pulling.Components;
using Content.Shared.Movement.Pulling.Systems;
using Content.Shared.UserInterface;
@@ -74,6 +76,8 @@ public sealed partial class CultSystem : EntitySystem
[Dependency] private readonly PullingSystem _pulling = default!;
[Dependency] private readonly SharedCuffableSystem _cuffable = default!;
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
[Dependency] private readonly MobStateSystem _mobState = default!;
[Dependency] private readonly MobThresholdSystem _thresholdSystem = default!;
public override void Initialize()
{
@@ -821,8 +825,7 @@ public sealed partial class CultSystem : EntitySystem
var targets =
_lookup.GetEntitiesInRange(uid, component.RangeTarget, LookupFlags.Dynamic | LookupFlags.Sundries);
targets.RemoveWhere(x =>
!_entityManager.HasComponent<HumanoidAppearanceComponent>(x) || !HasComp<CultistComponent>(x));
targets.RemoveWhere(x => !_entityManager.HasComponent<HumanoidAppearanceComponent>(x));
if (targets.Count == 0)
return;
@@ -832,12 +835,7 @@ public sealed partial class CultSystem : EntitySystem
if (victim == null)
return;
_entityManager.TryGetComponent<MobStateComponent>(victim.Value, out var state);
if (state == null)
return;
if (state.CurrentState != MobState.Dead && state.CurrentState != MobState.Critical)
if (_mobState.IsAlive(victim.Value))
{
_popupSystem.PopupEntity(Loc.GetString("cult-revive-rune-already-alive"), args.User, args.User);
return;
@@ -850,15 +848,56 @@ public sealed partial class CultSystem : EntitySystem
private bool Revive(EntityUid target, EntityUid user)
{
if (CultRuneReviveComponent.ChargesLeft == 0)
if (HasComp<CultistComponent>(target))
{
_popupSystem.PopupEntity(Loc.GetString("cult-revive-rune-no-charges"), user, user);
return false;
if (CultRuneReviveComponent.ChargesLeft == 0)
{
_popupSystem.PopupEntity(Loc.GetString("cult-revive-rune-no-charges"), user, user);
return false;
}
CultRuneReviveComponent.ChargesLeft--;
_entityManager.EventBus.RaiseLocalEvent(target, new RejuvenateEvent());
}
else
{
if (!TryComp(target, out DamageableComponent? damageable) ||
!TryComp(target, out MobThresholdsComponent? threshold) ||
!TryComp(target, out MobStateComponent? mobState))
return false;
CultRuneReviveComponent.ChargesLeft--;
if (!_mobState.IsDead(target, mobState))
return false;
_entityManager.EventBus.RaiseLocalEvent(target, new RejuvenateEvent());
var airlossGroup = _prototypeManager.Index<DamageGroupPrototype>("Airloss");
var deadThreshold = _thresholdSystem.GetThresholdForState(target, MobState.Dead, threshold);
if (damageable.Damage.TryGetDamageInGroup(airlossGroup, out var toHeal))
{
var afterHeal = damageable.TotalDamage - toHeal;
if (deadThreshold <= afterHeal)
return false;
var asphyxType = _prototypeManager.Index<DamageTypePrototype>("Asphyxiation");
var bloodlossType = _prototypeManager.Index<DamageTypePrototype>("Bloodloss");
var heal = new Action<DamageTypePrototype>(type =>
{
if (!damageable.Damage.DamageDict.TryGetValue(type.ID, out var damage))
return;
_damageableSystem.TryChangeDamage(target, new DamageSpecifier(type, -damage));
});
heal(asphyxType);
heal(bloodlossType);
}
if (damageable.TotalDamage < deadThreshold)
_mobState.ChangeMobState(target, MobState.Critical, mobState, user);
}
EntityUid? transferTo = null;
@@ -1383,4 +1422,4 @@ public sealed partial class CultSystem : EntitySystem
/*
* Helpers End ----
*/
}
}

View File

@@ -121,8 +121,12 @@ public sealed class ERTRecruitmentRule : StationEventSystem<ERTRecruitmentRuleCo
var ev = new ERTRecruitedReasonEvent();
RaiseLocalEvent(uid,ev);
_chat.DispatchServerMessage(args.PlayerSession,Loc.GetString("ert-description"));
_chat.DispatchServerMessage(args.PlayerSession, Loc.GetString("ert-reason", ("reason", ev.Reason)));
if (args.PlayerSession != null)
{
_chat.DispatchServerMessage(args.PlayerSession, Loc.GetString("ert-description"));
_chat.DispatchServerMessage(args.PlayerSession, Loc.GetString("ert-reason", ("reason", ev.Reason)));
}
}
private void OnStartAttempt(RoundStartAttemptEvent ev)
@@ -186,6 +190,7 @@ public sealed class ERTRecruitmentRule : StationEventSystem<ERTRecruitmentRuleCo
return false;
}
*/
var ertMap = EnsureComp<ERTMapComponent>(outpost);
ertMap.MapId = mapId;

View File

@@ -0,0 +1,53 @@
using Content.Server.Atmos.Piping.Unary.Components;
using Content.Shared._White.PolymorphableCanister;
using Content.Shared.Lock;
using Content.Shared.Verbs;
using Robust.Server.GameObjects;
using Robust.Shared.Player;
using Robust.Shared.Utility;
namespace Content.Server._White.PolymorphableCanister;
public sealed class PolymorphableCanisterSystem : SharedPolymorphableCanisterSystem
{
[Dependency] private readonly UserInterfaceSystem _ui = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<PolymorphableCanisterComponent, GetVerbsEvent<Verb>>(GetVerb);
}
private void GetVerb(EntityUid uid, PolymorphableCanisterComponent component, GetVerbsEvent<Verb> args)
{
if (TryComp(uid, out LockComponent? lockComponent) && lockComponent.Locked)
{
return;
}
if (TryComp(uid, out GasCanisterComponent? gasCanister) && gasCanister.Air.Pressure > 100)
{
return;
}
var changeAppearanceVerb = new Verb
{
Text = Loc.GetString("polymorphable-canister-change-appearance-verb"),
Icon = new SpriteSpecifier.Rsi(new ResPath("Structures/Storage/canister.rsi"), "yellow"),
Act = () => TryOpenUi(uid, args.User, component)
};
args.Verbs.Add(changeAppearanceVerb);
}
private void TryOpenUi(EntityUid uid, EntityUid user, PolymorphableCanisterComponent? component = null)
{
if (!Resolve(uid, ref component))
return;
if (!TryComp(user, out ActorComponent? actor))
return;
_ui.TryToggleUi(uid, PolymorphableCanisterUiKey.Key, actor.PlayerSession);
}
}