Skip to content

Commit

Permalink
Merge branch 'master' into DungeonMobsTweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
ErhardSteinhauer committed Mar 30, 2024
2 parents 1713514 + 5806c01 commit 2dc4d53
Show file tree
Hide file tree
Showing 395 changed files with 32,283 additions and 23,091 deletions.
36 changes: 36 additions & 0 deletions Content.Server/Chemistry/ReagentEffects/DisintegrateArtifact.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using Content.Server.Xenoarchaeology.XenoArtifacts;
using Content.Shared.Chemistry.Reagent;
using Robust.Shared.Prototypes;

namespace Content.Server.Chemistry.ReagentEffects;

public sealed partial class DisintegrateArtifact : ReagentEffect
{

/// <summary>
/// Disintegrate chance
/// </summary>
[DataField("probabilityMin"), ViewVariables(VVAccess.ReadWrite)]
public float ProbabilityMax = 0.05f;

/// <summary>
/// Disintegrate chance
/// </summary>
[DataField("probabilityMax"), ViewVariables(VVAccess.ReadWrite)]
public float ProbabilityMin = 0.15f;

/// <summary>
/// The range around the artifact that it will spawn the entity
/// </summary>
[DataField("range")]
public float Range = 0.5f;

public override void Effect(ReagentEffectArgs args)
{
var artifact = args.EntityManager.EntitySysManager.GetEntitySystem<ArtifactSystem>();
artifact.DisintegrateArtifact(args.SolutionEntity, ProbabilityMin, ProbabilityMax, Range);
}

protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) =>
null;
}
10 changes: 9 additions & 1 deletion Content.Server/GameTicking/GameTicker.Spawning.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,15 @@ private void SpawnPlayer(ICommonSession player, HumanoidCharacterProfile charact

_playTimeTrackings.PlayerRolesChanged(player);

var mobMaybe = _stationSpawning.SpawnPlayerCharacterOnStation(station, job, character);
// Delta-V: Add AlwaysUseSpawner.
var spawnPointType = SpawnPointType.Unset;
if (jobPrototype.AlwaysUseSpawner)
{
lateJoin = false;
spawnPointType = SpawnPointType.Job;
}

var mobMaybe = _stationSpawning.SpawnPlayerCharacterOnStation(station, job, character, spawnPointType: spawnPointType);
DebugTools.AssertNotNull(mobMaybe);
var mob = mobMaybe!.Value;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Content.Server.GameTicking;
using Content.Server.GameTicking;
using Content.Server.Spawners.Components;
using Content.Server.Station.Systems;
using Robust.Server.Containers;
Expand All @@ -20,6 +20,10 @@ public void HandlePlayerSpawning(PlayerSpawningEvent args)
if (args.SpawnResult != null)
return;

// DeltaV - Ignore these two desired spawn types
if (args.DesiredSpawnPointType is SpawnPointType.Observer or SpawnPointType.LateJoin)
return;

var query = EntityQueryEnumerator<ContainerSpawnPointComponent, ContainerManagerComponent, TransformComponent>();
var possibleContainers = new List<Entity<ContainerSpawnPointComponent, ContainerManagerComponent, TransformComponent>>();

Expand Down
20 changes: 19 additions & 1 deletion Content.Server/Spawners/EntitySystems/SpawnPointSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Content.Server.GameTicking;
using Content.Server.GameTicking;
using Content.Server.Spawners.Components;
using Content.Server.Station.Systems;
using Robust.Shared.Map;
Expand Down Expand Up @@ -32,6 +32,24 @@ private void OnPlayerSpawning(PlayerSpawningEvent args)
if (args.Station != null && _stationSystem.GetOwningStation(uid, xform) != args.Station)
continue;

// Delta-V: Allow setting a desired SpawnPointType
if (args.DesiredSpawnPointType != SpawnPointType.Unset)
{
var isMatchingJob = spawnPoint.SpawnType == SpawnPointType.Job &&
(args.Job == null || spawnPoint.Job?.ID == args.Job.Prototype);

switch (args.DesiredSpawnPointType)
{
case SpawnPointType.Job when isMatchingJob:
case SpawnPointType.LateJoin when spawnPoint.SpawnType == SpawnPointType.LateJoin:
case SpawnPointType.Observer when spawnPoint.SpawnType == SpawnPointType.Observer:
possiblePositions.Add(xform.Coordinates);
break;
default:
continue;
}
}

if (_gameTicker.RunLevel == GameRunLevel.InRound && spawnPoint.SpawnType == SpawnPointType.LateJoin)
{
possiblePositions.Add(xform.Coordinates);
Expand Down
14 changes: 11 additions & 3 deletions Content.Server/Station/Systems/StationSpawningSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Utility;
using Content.Server.Spawners.Components; // DeltaV

namespace Content.Server.Station.Systems;

Expand Down Expand Up @@ -72,17 +73,19 @@ public override void Initialize()
/// <param name="job">The job to assign, if any.</param>
/// <param name="profile">The character profile to use, if any.</param>
/// <param name="stationSpawning">Resolve pattern, the station spawning component for the station.</param>
/// <param name="spawnPointType">Delta-V: Set desired spawn point type.</param>
/// <returns>The resulting player character, if any.</returns>
/// <exception cref="ArgumentException">Thrown when the given station is not a station.</exception>
/// <remarks>
/// This only spawns the character, and does none of the mind-related setup you'd need for it to be playable.
/// </remarks>
public EntityUid? SpawnPlayerCharacterOnStation(EntityUid? station, JobComponent? job, HumanoidCharacterProfile? profile, StationSpawningComponent? stationSpawning = null)
public EntityUid? SpawnPlayerCharacterOnStation(EntityUid? station, JobComponent? job, HumanoidCharacterProfile? profile, StationSpawningComponent? stationSpawning = null, SpawnPointType spawnPointType = SpawnPointType.Unset)
{
if (station != null && !Resolve(station.Value, ref stationSpawning))
throw new ArgumentException("Tried to use a non-station entity as a station!", nameof(station));

var ev = new PlayerSpawningEvent(job, profile, station);
// Delta-V: Set desired spawn point type.
var ev = new PlayerSpawningEvent(job, profile, station, spawnPointType);

if (station != null && profile != null)
{
Expand Down Expand Up @@ -276,11 +279,16 @@ public sealed class PlayerSpawningEvent : EntityEventArgs
/// The target station, if any.
/// </summary>
public readonly EntityUid? Station;
/// <summary>
/// Delta-V: Desired SpawnPointType, if any.
/// </summary>
public readonly SpawnPointType DesiredSpawnPointType;

public PlayerSpawningEvent(JobComponent? job, HumanoidCharacterProfile? humanoidCharacterProfile, EntityUid? station)
public PlayerSpawningEvent(JobComponent? job, HumanoidCharacterProfile? humanoidCharacterProfile, EntityUid? station, SpawnPointType spawnPointType = SpawnPointType.Unset)
{
Job = job;
HumanoidCharacterProfile = humanoidCharacterProfile;
Station = station;
DesiredSpawnPointType = spawnPointType;
}
}
32 changes: 27 additions & 5 deletions Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactSystem.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Numerics;
using Content.Server.Cargo.Systems;
using Content.Server.GameTicking;
using Content.Server.Power.EntitySystems;
using Content.Server.Xenoarchaeology.Equipment.Components;
using Content.Server.Xenoarchaeology.XenoArtifacts.Events;
using Content.Server.Xenoarchaeology.XenoArtifacts.Triggers.Components;
using Content.Shared.CCVar;
using Content.Shared.Tiles;
using Content.Shared.Xenoarchaeology.XenoArtifacts;
using JetBrains.Annotations;
using Robust.Shared.Audio;
using Robust.Server.GameObjects;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Configuration;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Serialization.Manager;
Expand All @@ -28,6 +25,9 @@ public sealed partial class ArtifactSystem : EntitySystem
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly ISerializationManager _serialization = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly TransformSystem _transform = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;


public override void Initialize()
{
Expand Down Expand Up @@ -135,6 +135,28 @@ public void RandomizeArtifact(EntityUid uid, ArtifactComponent component)
EnterNode(uid, ref firstNode, component);
}

public void DisintegrateArtifact(EntityUid uid, float probabilityMin, float probabilityMax, float range)
{
// Make a chance between probabilityMin and probabilityMax
var randomChanceForDisintegration = _random.NextFloat(probabilityMin, probabilityMax);
var willDisintegrate = _random.Prob(randomChanceForDisintegration);

if (willDisintegrate)
{
var artifactCoord = _transform.GetMapCoordinates(uid);
var flashEntity = Spawn("EffectFlashBluespace", artifactCoord);
_transform.AttachToGridOrMap(flashEntity);

var dx = _random.NextFloat(-range, range);
var dy = _random.NextFloat(-range, range);
var spawnCord = artifactCoord.Offset(new Vector2(dx, dy));
var mobEntity = Spawn("MobGrimForged", spawnCord);
_transform.AttachToGridOrMap(mobEntity);

_entityManager.DeleteEntity(uid);
}
}

/// <summary>
/// Tries to activate the artifact
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion Content.Shared/Atmos/Rotting/PerishableComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public sealed partial class PerishableComponent : Component
/// How long it takes after death to start rotting.
/// </summary>
[DataField("rotAfter"), ViewVariables(VVAccess.ReadWrite)]
public TimeSpan RotAfter = TimeSpan.FromMinutes(15);
public TimeSpan RotAfter = TimeSpan.FromMinutes(20);

/// <summary>
/// How much rotting has occured
Expand Down
6 changes: 6 additions & 0 deletions Content.Shared/Roles/JobPrototype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ public sealed partial class JobPrototype : IPrototype
[DataField("canBeAntag")]
public bool CanBeAntag { get; private set; } = true;

/// <summary>
/// Nyano/DV: For e.g. prisoners, they'll never use their latejoin spawner.
/// </summary>
[DataField("alwaysUseSpawner")]
public bool AlwaysUseSpawner { get; } = false;

/// <summary>
/// Whether this job is a head.
/// The job system will try to pick heads before other jobs on the same priority level.
Expand Down
2 changes: 1 addition & 1 deletion Content.Shared/_NF/CCVars/CCVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public sealed class NF14CVars
/// Respawn time, how long the player has to wait in seconds after death.
/// </summary>
public static readonly CVarDef<float> RespawnTime =
CVarDef.Create("nf14.respawn.time", 900.0f, CVar.SERVER | CVar.REPLICATED);
CVarDef.Create("nf14.respawn.time", 1200.0f, CVar.SERVER | CVar.REPLICATED);

/// <summary>
/// Whether or not returning from cryosleep is enabled.
Expand Down
Binary file added Resources/Audio/_NF/Ambience/force-field.ogg
Binary file not shown.
48 changes: 48 additions & 0 deletions Resources/Changelog/Changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3840,3 +3840,51 @@ Entries:
message: Named bus docks for STC.
id: 4886
time: '2024-03-27T20:49:47.0000000+00:00'
- author: Leander
changes:
- type: Tweak
message: >-
Respawn times take longer but your body takes longer until it starts
rotting away.
id: 4887
time: '2024-03-29T23:01:04.0000000+00:00'
- author: erhardsteinhauer
changes:
- type: Tweak
message: Buffed stats on Experimental Mining Hardsuit.
id: 4888
time: '2024-03-29T23:03:17.0000000+00:00'
- author: dvir01
changes:
- type: Add
message: Added the Cleithro psychologist shuttle, just a normal ship.
id: 4889
time: '2024-03-29T23:09:22.0000000+00:00'
- author: MoistBiscuits
changes:
- type: Tweak
message: >-
The engi techfab has been upgraded to include everything needed for
shuttle construction and repair
id: 4890
time: '2024-03-29T23:13:11.0000000+00:00'
- author: Leander
changes:
- type: Add
message: >-
Central command has just finished building the latest version of The
Empress.
id: 4891
time: '2024-03-29T23:59:40.0000000+00:00'
- author: erhardsteinhauer
changes:
- type: Tweak
message: Courser X is updated to current mapping standards.
id: 4892
time: '2024-03-30T00:00:39.0000000+00:00'
- author: erhardsteinhauer
changes:
- type: Tweak
message: Courser X is updated to current mapping standards.
id: 4893
time: '2024-03-30T00:03:39.0000000+00:00'
Loading

0 comments on commit 2dc4d53

Please sign in to comment.