Skip to content

Commit

Permalink
Merge branch 'master' into Roundstart-Fugitive-Second-Attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
Kr8art authored Nov 26, 2024
2 parents 5ed4d5e + 4fd2aa3 commit 54574ec
Show file tree
Hide file tree
Showing 14 changed files with 216 additions and 92 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/labeler-untriaged.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
on:
issues:
types: [opened]
pull_request_target:
types: [opened]

jobs:
add_label:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;

namespace Content.Server.DeltaV.GameTicking.Rules.Components;

/// <summary>
/// Delays adding components to the antags of a gamerule until some time has passed.
/// </summary>
/// <remarks>
/// This is used for the zombies gamemode so that new players don't hit the funny button immediately and ruin anyone else's plans.
/// </remarks>
[RegisterComponent, Access(typeof(DelayedRuleSystem))]
[AutoGenerateComponentPause]
public sealed partial class DelayedRuleComponent : Component
{
/// <summary>
/// The players must wait this length of time before <see cref="DelayedComponents"/> gets added.
/// If they are somehow found out and get gibbed/cremated/etc before this delay is up they will not turn.
/// </summary>
[DataField(required: true)]
public TimeSpan Delay;

/// <summary>
/// Whether to skip the delay if there is only 1 antag selected.
/// </summary>
[DataField]
public bool IgnoreSolo;

/// <summary>
/// When the <see cref="Delay"/> will end.
/// </summary>
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoPausedField]
public TimeSpan DelayEnds;

/// <summary>
/// The components to add to each player's mob once the delay ends.
/// </summary>
[DataField(required: true)]
public ComponentRegistry DelayedComponents = new();

/// <summary>
/// Popup to show when the delay ends.
/// </summary>
[DataField(required: true)]
public LocId EndedPopup;
}
58 changes: 58 additions & 0 deletions Content.Server/DeltaV/GameTicking/Rules/DelayedRuleSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
using Content.Server.Antag.Components;
using Content.Server.GameTicking.Rules;
using Content.Server.DeltaV.GameTicking.Rules.Components;
using Content.Shared.GameTicking.Components;
using Content.Shared.Mind;
using Content.Shared.Popups;

namespace Content.Server.DeltaV.GameTicking.Rules;

public sealed class DelayedRuleSystem : GameRuleSystem<DelayedRuleComponent>
{
[Dependency] private readonly SharedPopupSystem _popup = default!;

protected override void Started(EntityUid uid, DelayedRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args)
{
base.Started(uid, component, gameRule, args);

component.DelayEnds = Timing.CurTime + component.Delay;
}

protected override void ActiveTick(EntityUid uid, DelayedRuleComponent component, GameRuleComponent gameRule, float frameTime)
{
base.ActiveTick(uid, component, gameRule, frameTime);

CheckDelay((uid, component));
}

/// <summary>
/// Checks if the delay has ended.
/// </summary>
private void CheckDelay(Entity<DelayedRuleComponent> ent)
{
if (!TryComp<AntagSelectionComponent>(ent, out var selection))
return;

// skip the delay if it's just 1 player, theres no plan to ruin if you are the only one
var ends = ent.Comp.DelayEnds;
if (ent.Comp.IgnoreSolo && selection.SelectedMinds.Count < 2)
ends = Timing.CurTime;

if (Timing.CurTime < ends)
return;

var comps = ent.Comp.DelayedComponents;
foreach (var (mindId, _) in selection.SelectedMinds)
{
// using OriginalOwnedEntity as the player might have ghosted to try become an evil ghost antag
if (!TryComp<MindComponent>(mindId, out var mind) || !TryGetEntity(mind.OriginalOwnedEntity, out var mob))
continue;

var uid = mob.Value;
_popup.PopupEntity(Loc.GetString(ent.Comp.EndedPopup), uid, uid, PopupType.LargeCaution);
EntityManager.AddComponents(uid, comps);
}

RemCompDeferred<DelayedRuleComponent>(ent);
}
}
11 changes: 7 additions & 4 deletions Content.Server/Objectives/Systems/KillPersonConditionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,17 @@ private void OnGetProgress(EntityUid uid, KillPersonConditionComponent comp, ref
args.Progress = GetProgress(target.Value, comp.RequireDead);
}

private void OnPersonAssigned(EntityUid uid, PickRandomPersonComponent comp, ref ObjectiveAssignedEvent args)
private void OnPersonAssigned(Entity<PickRandomPersonComponent> ent, ref ObjectiveAssignedEvent args)
{
AssignRandomTarget(uid, args, _ => true);
AssignRandomTarget(ent, args, _ => true);
}

private void OnHeadAssigned(EntityUid uid, PickRandomHeadComponent comp, ref ObjectiveAssignedEvent args)
private void OnHeadAssigned(Entity<PickRandomHeadComponent> ent, ref ObjectiveAssignedEvent args)
{
AssignRandomTarget(uid, args, mind => HasComp<CommandStaffComponent>(uid));
AssignRandomTarget(ent, args, mindId =>
TryComp<MindComponent>(mindId, out var mind) &&
mind.OwnedEntity is { } ownedEnt &&
HasComp<CommandStaffComponent>(ownedEnt));
}

private void AssignRandomTarget(EntityUid uid, ObjectiveAssignedEvent args, Predicate<EntityUid> filter, bool fallbackToAny = true)
Expand Down
25 changes: 9 additions & 16 deletions Content.Server/Procedural/DungeonJob/DungeonJob.PostGenBiome.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Threading.Tasks;
using Content.Server.Parallax;
using Content.Shared.Maps;
using Content.Shared.Parallax.Biomes;
using Content.Shared.Procedural;
using Content.Shared.Procedural.PostGeneration;
Expand All @@ -16,43 +15,35 @@ public sealed partial class DungeonJob
/// </summary>
private async Task PostGen(BiomeDunGen dunGen, DungeonData data, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
{
if (!_prototype.TryIndex(dunGen.BiomeTemplate, out var indexedBiome))
if (_entManager.TryGetComponent(_gridUid, out BiomeComponent? biomeComp))
return;

biomeComp = _entManager.AddComponent<BiomeComponent>(_gridUid);
var biomeSystem = _entManager.System<BiomeSystem>();

biomeSystem.SetTemplate(_gridUid, biomeComp, _prototype.Index(dunGen.BiomeTemplate));
var seed = random.Next();
var xformQuery = _entManager.GetEntityQuery<TransformComponent>();

var tiles = _maps.GetAllTilesEnumerator(_gridUid, _grid);
while (tiles.MoveNext(out var tileRef))
foreach (var node in dungeon.RoomTiles)
{
var node = tileRef.Value.GridIndices;

if (reservedTiles.Contains(node))
continue;

if (dunGen.TileMask is not null)
{
if (!dunGen.TileMask.Contains(((ContentTileDefinition) _tileDefManager[tileRef.Value.Tile.TypeId]).ID))
continue;
}

// Need to set per-tile to override data.
if (biomeSystem.TryGetTile(node, indexedBiome.Layers, seed, _grid, out var tile))
if (biomeSystem.TryGetTile(node, biomeComp.Layers, seed, _grid, out var tile))
{
_maps.SetTile(_gridUid, _grid, node, tile.Value);
}

if (biomeSystem.TryGetDecals(node, indexedBiome.Layers, seed, _grid, out var decals))
if (biomeSystem.TryGetDecals(node, biomeComp.Layers, seed, _grid, out var decals))
{
foreach (var decal in decals)
{
_decals.TryAddDecal(decal.ID, new EntityCoordinates(_gridUid, decal.Position), out _);
}
}

if (tile is not null && biomeSystem.TryGetEntity(node, indexedBiome.Layers, tile.Value, seed, _grid, out var entityProto))
if (biomeSystem.TryGetEntity(node, biomeComp, _grid, out var entityProto))
{
var ent = _entManager.SpawnEntity(entityProto, new EntityCoordinates(_gridUid, node + _grid.TileSizeHalfVector));
var xform = xformQuery.Get(ent);
Expand All @@ -70,5 +61,7 @@ private async Task PostGen(BiomeDunGen dunGen, DungeonData data, Dungeon dungeon
if (!ValidateResume())
return;
}

biomeComp.Enabled = false;
}
}
2 changes: 1 addition & 1 deletion Content.Shared/Parallax/Biomes/SharedBiomeSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public bool TryGetEntity(Vector2i indices, BiomeComponent component, MapGridComp
}


public bool TryGetEntity(Vector2i indices, List<IBiomeLayer> layers, Tile tileRef, int seed, MapGridComponent grid,
private bool TryGetEntity(Vector2i indices, List<IBiomeLayer> layers, Tile tileRef, int seed, MapGridComponent grid,
[NotNullWhen(true)] out string? entity)
{
var tileId = TileDefManager[tileRef.TypeId].ID;
Expand Down
7 changes: 0 additions & 7 deletions Content.Shared/Procedural/PostGeneration/BiomeDunGen.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Content.Shared.Maps;
using Content.Shared.Parallax.Biomes;
using Robust.Shared.Prototypes;

Expand All @@ -12,10 +11,4 @@ public sealed partial class BiomeDunGen : IDunGenLayer
{
[DataField(required: true)]
public ProtoId<BiomeTemplatePrototype> BiomeTemplate;

/// <summary>
/// creates a biome only on the specified tiles
/// </summary>
[DataField]
public HashSet<ProtoId<ContentTileDefinition>>? TileMask;
}
44 changes: 26 additions & 18 deletions Resources/Changelog/DeltaVChangelog.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,4 @@
Entries:
- author: DebugOk
changes:
- message: Zombies can no longer be psionic
type: Remove
id: 207
time: '2024-01-19T20:53:05.0000000+00:00'
- author: Adrian16199
changes:
- message: Fixes mantis and them not be able to spawn with duffelbags and satchels.
type: Fix
id: 208
time: '2024-01-19T20:54:29.0000000+00:00'
- author: Adrian16199
changes:
- message: Laika no longer takes 200 damage before dying from critical.
type: Fix
id: 209
time: '2024-01-19T20:57:11.0000000+00:00'
- author: lleftTheDragon
changes: []
id: 210
Expand Down Expand Up @@ -3765,3 +3747,29 @@
id: 706
time: '2024-11-24T11:57:37.0000000+00:00'
url: https://github.com/DeltaV-Station/Delta-v/pull/2278
- author: deltanedas
changes:
- message: Fixed salvage debris not having anything.
type: Fix
id: 707
time: '2024-11-24T20:25:25.0000000+00:00'
url: https://github.com/DeltaV-Station/Delta-v/pull/2280
- author: DisposableCrewmember42
changes:
- message: Hungry? Stuff your face with cream from an emergency pie delivery for
a change!
type: Add
id: 708
time: '2024-11-25T05:30:25.0000000+00:00'
url: https://github.com/DeltaV-Station/Delta-v/pull/2211
- author: deltanedas
changes:
- message: Initial Infecteds now get radio implants to communicate thanks to the
Syndicate.
type: Tweak
- message: Initial Infecteds now have to wait 5 minutes before they can turn, form
a plan!
type: Tweak
id: 709
time: '2024-11-26T12:23:26.0000000+00:00'
url: https://github.com/DeltaV-Station/Delta-v/pull/2194
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
zombie-bioterrorist-role-greeting = You are a syndicate sponsored bioterrorist sent to overtake the station by use of the Romerol virus. Coordinate with your team, get supplies and prepare for your eventual transformation. Death to nanotrasen!
zombie-bioterrorist-romerol-active = The romerol in your blood is now active, you are ready to transform!
Loading

0 comments on commit 54574ec

Please sign in to comment.