Stable to master merge (#41375)
* HOTFIX: Reword Wizard objective text to be more hostile (#41371) Initial commit * HOTFIX: automatically reset fallback gamemode to default (#41367) automatically reset fallback gamemode to default after the round * [HOTFIX] Prevent Payload Enumeration Failure. (#41376) * Prevent payload enumeration failure when spawning entities * hate it here * boop --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com> --------- Co-authored-by: Errant <35878406+Errant-4@users.noreply.github.com> Co-authored-by: Princess Cheeseballs <66055347+Princess-Cheeseballs@users.noreply.github.com> Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
This commit is contained in:
@@ -59,7 +59,7 @@ public sealed partial class GameTicker
|
|||||||
foreach (var preset in fallbackPresets)
|
foreach (var preset in fallbackPresets)
|
||||||
{
|
{
|
||||||
ClearGameRules();
|
ClearGameRules();
|
||||||
SetGamePreset(preset);
|
SetGamePreset(preset, resetDelay: 1);
|
||||||
AddGamePresetRules();
|
AddGamePresetRules();
|
||||||
StartGamePresetRules();
|
StartGamePresetRules();
|
||||||
|
|
||||||
@@ -129,11 +129,11 @@ public sealed partial class GameTicker
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetGamePreset(string preset, bool force = false)
|
public void SetGamePreset(string preset, bool force = false, int? resetDelay = null)
|
||||||
{
|
{
|
||||||
var proto = FindGamePreset(preset);
|
var proto = FindGamePreset(preset);
|
||||||
if (proto != null)
|
if (proto != null)
|
||||||
SetGamePreset(proto, force);
|
SetGamePreset(proto, force, null, resetDelay);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GamePresetPrototype? FindGamePreset(string preset)
|
public GamePresetPrototype? FindGamePreset(string preset)
|
||||||
|
|||||||
@@ -17,50 +17,49 @@ namespace Content.Server.Payload.EntitySystems;
|
|||||||
|
|
||||||
public sealed class PayloadSystem : EntitySystem
|
public sealed class PayloadSystem : EntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly TagSystem _tagSystem = default!;
|
|
||||||
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainerSystem = default!;
|
|
||||||
[Dependency] private readonly TransformSystem _transform = default!;
|
|
||||||
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||||
[Dependency] private readonly ISerializationManager _serializationManager = default!;
|
[Dependency] private readonly ISerializationManager _serializationManager = default!;
|
||||||
|
[Dependency] private readonly SharedContainerSystem _container = default!;
|
||||||
|
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainerSystem = default!;
|
||||||
|
[Dependency] private readonly TagSystem _tagSystem = default!;
|
||||||
|
[Dependency] private readonly TransformSystem _transform = default!;
|
||||||
|
|
||||||
private static readonly ProtoId<TagPrototype> PayloadTag = "Payload";
|
private static readonly ProtoId<TagPrototype> PayloadTag = "Payload";
|
||||||
|
|
||||||
|
// TODO: Construction System Integration tests and remove the EnsureContainer from ConstructionSystem. :(
|
||||||
|
private static readonly string PayloadContainer = "payload";
|
||||||
|
private static readonly string TriggerContainer = "payloadTrigger";
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
SubscribeLocalEvent<PayloadCaseComponent, TriggerEvent>(OnCaseTriggered);
|
SubscribeLocalEvent<PayloadCaseComponent, TriggerEvent>(OnCaseTriggered);
|
||||||
SubscribeLocalEvent<PayloadTriggerComponent, TriggerEvent>(OnTriggerTriggered);
|
SubscribeLocalEvent<PayloadTriggerComponent, TriggerEvent>(OnTriggerTriggered);
|
||||||
|
SubscribeLocalEvent<PayloadCaseComponent, ContainerIsInsertingAttemptEvent>(OnInsertAttempt);
|
||||||
SubscribeLocalEvent<PayloadCaseComponent, EntInsertedIntoContainerMessage>(OnEntityInserted);
|
SubscribeLocalEvent<PayloadCaseComponent, EntInsertedIntoContainerMessage>(OnEntityInserted);
|
||||||
SubscribeLocalEvent<PayloadCaseComponent, EntRemovedFromContainerMessage>(OnEntityRemoved);
|
SubscribeLocalEvent<PayloadCaseComponent, EntRemovedFromContainerMessage>(OnEntityRemoved);
|
||||||
SubscribeLocalEvent<PayloadCaseComponent, ExaminedEvent>(OnExamined);
|
SubscribeLocalEvent<PayloadCaseComponent, ExaminedEvent>(OnExamined);
|
||||||
SubscribeLocalEvent<ChemicalPayloadComponent, TriggerEvent>(HandleChemicalPayloadTrigger);
|
SubscribeLocalEvent<ChemicalPayloadComponent, TriggerEvent>(HandleChemicalPayloadTrigger);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<EntityUid> GetAllPayloads(EntityUid uid, ContainerManagerComponent? contMan = null)
|
public IEnumerable<EntityUid> GetAllPayloads(EntityUid uid)
|
||||||
{
|
{
|
||||||
if (!Resolve(uid, ref contMan, false))
|
if (!_container.TryGetContainer(uid, PayloadContainer, out var container))
|
||||||
yield break;
|
yield break;
|
||||||
|
|
||||||
foreach (var container in contMan.Containers.Values)
|
foreach (var entity in container.ContainedEntities)
|
||||||
{
|
{
|
||||||
foreach (var entity in container.ContainedEntities)
|
if (_tagSystem.HasTag(entity, PayloadTag))
|
||||||
{
|
yield return entity;
|
||||||
if (_tagSystem.HasTag(entity, PayloadTag))
|
|
||||||
yield return entity;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnCaseTriggered(EntityUid uid, PayloadCaseComponent component, TriggerEvent args)
|
private void OnCaseTriggered(EntityUid uid, PayloadCaseComponent component, TriggerEvent args)
|
||||||
{
|
{
|
||||||
// TODO: Adjust to the new trigger system
|
// TODO: Adjust to the new trigger system
|
||||||
|
|
||||||
if (!TryComp(uid, out ContainerManagerComponent? contMan))
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Pass trigger event onto all contained payloads. Payload capacity configurable by construction graphs.
|
// Pass trigger event onto all contained payloads. Payload capacity configurable by construction graphs.
|
||||||
foreach (var ent in GetAllPayloads(uid, contMan))
|
foreach (var ent in GetAllPayloads(uid))
|
||||||
{
|
{
|
||||||
RaiseLocalEvent(ent, ref args, false);
|
RaiseLocalEvent(ent, ref args, false);
|
||||||
}
|
}
|
||||||
@@ -82,9 +81,18 @@ public sealed class PayloadSystem : EntitySystem
|
|||||||
RaiseLocalEvent(parent, ref args);
|
RaiseLocalEvent(parent, ref args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnInsertAttempt(Entity<PayloadCaseComponent> ent, ref ContainerIsInsertingAttemptEvent args)
|
||||||
|
{
|
||||||
|
if (args.Container.ID == PayloadContainer && !_tagSystem.HasTag(args.EntityUid, PayloadTag))
|
||||||
|
args.Cancel();
|
||||||
|
|
||||||
|
if (args.Container.ID == TriggerContainer && !HasComp<PayloadTriggerComponent>(args.EntityUid))
|
||||||
|
args.Cancel();
|
||||||
|
}
|
||||||
|
|
||||||
private void OnEntityInserted(EntityUid uid, PayloadCaseComponent _, EntInsertedIntoContainerMessage args)
|
private void OnEntityInserted(EntityUid uid, PayloadCaseComponent _, EntInsertedIntoContainerMessage args)
|
||||||
{
|
{
|
||||||
if (!TryComp(args.Entity, out PayloadTriggerComponent? trigger))
|
if (args.Container.ID != TriggerContainer || !TryComp(args.Entity, out PayloadTriggerComponent? trigger))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
trigger.Active = true;
|
trigger.Active = true;
|
||||||
@@ -114,7 +122,7 @@ public sealed class PayloadSystem : EntitySystem
|
|||||||
|
|
||||||
private void OnEntityRemoved(EntityUid uid, PayloadCaseComponent component, EntRemovedFromContainerMessage args)
|
private void OnEntityRemoved(EntityUid uid, PayloadCaseComponent component, EntRemovedFromContainerMessage args)
|
||||||
{
|
{
|
||||||
if (!TryComp(args.Entity, out PayloadTriggerComponent? trigger))
|
if (args.Container.ID != TriggerContainer || !TryComp(args.Entity, out PayloadTriggerComponent? trigger))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
trigger.Active = false;
|
trigger.Active = false;
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ roles-antag-wizard-objective = Teach them a lesson they'll never forget.
|
|||||||
|
|
||||||
wizard-role-greeting =
|
wizard-role-greeting =
|
||||||
It's wizard time, fireball!
|
It's wizard time, fireball!
|
||||||
There's been tensions between the Space Wizards Federation and NanoTrasen. You've been selected by the Space Wizards Federation to pay a visit to the station and give them a good "demonstration" of your powers.
|
There's been tensions between the Space Wizards Federation and NanoTrasen. You've been selected by the Space Wizards Federation to pay a visit to the station and "remind them" why spellcasters are not to be trifled with.
|
||||||
What you do is up to you, but remember that the Space Wizards want you to make it out alive.
|
Cause mayhem and destruction! What you do is up to you, but remember that the Space Wizards want you to make it out alive.
|
||||||
|
|
||||||
wizard-round-end-name = wizard
|
wizard-round-end-name = wizard
|
||||||
|
|
||||||
|
|||||||
@@ -25,8 +25,8 @@
|
|||||||
- type: entity
|
- type: entity
|
||||||
parent: [BaseWizardObjective, BaseFreeObjective]
|
parent: [BaseWizardObjective, BaseFreeObjective]
|
||||||
id: WizardDemonstrateObjective
|
id: WizardDemonstrateObjective
|
||||||
name: Show off
|
name: Cause chaos
|
||||||
description: Give the station a good demonstration of your powers!
|
description: Teach those station welps to never disrespect a Wizard again!
|
||||||
components:
|
components:
|
||||||
- type: Objective
|
- type: Objective
|
||||||
icon:
|
icon:
|
||||||
|
|||||||
Reference in New Issue
Block a user