Skip to content
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Content.Server/StationEvents/Components/VentHordeRuleComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,16 @@ public sealed partial class VentHordeRuleComponent : Component
/// </summary>
[DataField]
public SoundSpecifier? EndSound;

/// <summary>
/// starcup: The chance that a vent will break when entities are spawned.
/// </summary>
[DataField]
public float VentBreakChance;

/// <summary>
/// starcup: The entity that will replace the vent when it breaks.
/// </summary>
[DataField]
public string? VentReplacement = "ScrapSteel";
}
2 changes: 1 addition & 1 deletion Content.Server/StationEvents/Events/VentHordeRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ protected override void Started(EntityUid uid, VentHordeRuleComponent component,
// And start the spawn at the chosen vent.
// The duration is the same as the time until expected gamerule end time, but that is only for convenience.
// The spawn can happen early in certain circumstances anyway.
_horde.StartHordeSpawn(component.ChosenVent.Value, spawns.ToList(), duration, passiveSound: component.PassiveSound, endSound: component.EndSound); // starcup: Pass sounds
_horde.StartHordeSpawn(component.ChosenVent.Value, spawns.ToList(), duration, passiveSound: component.PassiveSound, endSound: component.EndSound, ventBreakChance: component.VentBreakChance, ventReplacement: component.VentReplacement); // starcup: Pass sounds, break vents and replace them
}

private EntityUid? ChooseVent()
Expand Down
14 changes: 13 additions & 1 deletion Content.Server/VentHorde/Components/VentHordeSpawnerComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public sealed partial class VentHordeSpawnerComponent : Component
/// Plays on loop when a vent is selected as a spawner.
/// </summary>
[DataField]
public SoundSpecifier PassiveSound = new SoundPathSpecifier("/Audio/Machines/airlock_creaking.ogg")
public SoundSpecifier PassiveSound = new SoundCollectionSpecifier("VentCrawlGeneric") // starcup: new sound collection
{
Params = AudioParams.Default.WithVolume(-3f),
};
Expand All @@ -74,4 +74,16 @@ public sealed partial class VentHordeSpawnerComponent : Component
[DataField]
[ViewVariables(VVAccess.ReadOnly)]
public EntityUid? AudioStream;

/// <summary>
/// starcup: The chance that a vent will break when entities are spawned.
/// </summary>
[DataField]
public float VentBreakChance;

/// <summary>
/// starcup: The entity that will replace the vent when it breaks.
/// </summary>
[DataField]
public string? VentReplacement;
}
26 changes: 23 additions & 3 deletions Content.Server/VentHorde/Systems/VentHordeSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ private void OnSpawnerAnchored(Entity<VentHordeSpawnerComponent> entity, ref Anc
/// <param name="append">If an already active spawner is selected, will add entities to its list. Otherwise, will fail.</param>
/// starcup: <param name="passiveSound">Will override the default sound in VentHordeSpawnerComponent if provided.</param>
/// starcup: <param name="endSound">Will override the default sound in VentHordSpawnerComponent if provided.</param>
public void StartHordeSpawn(EntityUid uid, List<EntProtoId> spawns, TimeSpan spawnDelay, bool append = true, SoundSpecifier? passiveSound = null, SoundSpecifier? endSound = null)
/// starcup: <param name="ventBreakChance">Will remove the vent horde spawner entity.</param>
/// starcup: <param name="ventReplacement">Spawns a new entity in place of the removed vent horde spawner entity.</param>
public void StartHordeSpawn(EntityUid uid, List<EntProtoId> spawns, TimeSpan spawnDelay, string? ventReplacement, bool append = true, SoundSpecifier? passiveSound = null, SoundSpecifier? endSound = null, float ventBreakChance = 0)
{
if (TryComp<VentHordeSpawnerComponent>(uid, out var hordeSpawner))
{
Expand All @@ -85,6 +87,10 @@ public void StartHordeSpawn(EntityUid uid, List<EntProtoId> spawns, TimeSpan spa

if (endSound is not null)
hordeSpawner.EndSound = endSound;

hordeSpawner.VentBreakChance = ventBreakChance;

hordeSpawner.VentReplacement = ventReplacement;
// end starcup

hordeSpawner.AudioStream = _audio.PlayPvs(hordeSpawner.PassiveSound, uid, hordeSpawner.PassiveSound.Params.WithLoop(true))?.Entity;
Expand All @@ -101,8 +107,6 @@ public void EndHordeSpawn(Entity<VentHordeSpawnerComponent> entity)
{
entity.Comp.AudioStream = _audio.Stop(entity.Comp.AudioStream);

_audio.PlayPvs(entity.Comp.EndSound, entity);

foreach (var spawn in entity.Comp.Entities)
{
var spawned = Spawn(spawn, Transform(entity).Coordinates);
Expand All @@ -111,6 +115,22 @@ public void EndHordeSpawn(Entity<VentHordeSpawnerComponent> entity)
_throwing.TryThrow(spawned, direction, throwSpeed);
}

// begin starcup: Remove the horde spawner entity and spawn a replacement (perhaps a broken version of it).
if (_random.Prob(entity.Comp.VentBreakChance))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should move this random check to StartHordeSpawn and use it to set a data field on VentHordeSpawnerComponent. The advantage of that is to better handle a situation when events overlap on the same vent, similar to what's being done on lines 72 through 80.

If mice and goliaths are coming out at the same time, the vent should break on account of the goliaths, rather than not break on account of the mice coming slightly afterward.

Here's how we can accomplish that. Assignment works like this: variableToAssign = valueToBeAssigned, with the right-hand side being what we want to assign to a variable or field. Compound assignment is shorthand for variableToAssign = variableToAssign + someValue, or variableToAssign += someValue. The result of the boolean OR operation is true if and only if one of the values is true.

bool someVariable = false;
someVariable |= true;
// someVariable: true

// boolean OR won't overwrite true with false
someVariable |= false;
// someVariable: true

Suppose we add a new data field in VentHordeSpawnerComponent, bool ShouldBreakVent.

// in StartHordeSpawn, somewhere
hordeSpawner.ShouldBreakVent |= _random.Prob(breakChance);

// We remove this line (and its corresponding DataField) because they've been replaced by the above addition.
// hordeSpawner.VentBreakChance = ventBreakChance;

Then, later in EndHordeSpawn ...

// Replace the old logic with checking the new data field
// if (_random.Prob(entity.Comp.VentBreakChance))
if (entity.Comp.ShouldBreakVent)

{
var xform = Transform(entity);
var brokenVent = Spawn(entity.Comp.VentReplacement, xform.Coordinates);
var newXform = Transform(brokenVent);
newXform.LocalRotation = xform.LocalRotation;
QueueDel(entity);
_audio.PlayPvs(entity.Comp.EndSound, brokenVent);
}
else
{
_audio.PlayPvs(entity.Comp.EndSound, entity);
}
// end starcup

RemCompDeferred<VentHordeSpawnerComponent>(entity);
}

Expand Down
25 changes: 25 additions & 0 deletions Resources/Audio/_DEN/VentCritters/attributions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# SPDX-FileCopyrightText: 2025 Jakumba
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- files: ["vent_xeno.ogg"]
license: "CC-BY-SA-3.0"
copyright: "Edited and composited by MajorMoth, samples taken from freesound.org at ID's 800277, 803044, 795432, 806647, 806649"
source: "https://freesound.org"

- files: ["vent_carp.ogg"]
license: "CC-BY-SA-3.0"
copyright: "Edited and composited by MajorMoth, modified bite.ogg and metal_break4.ogg. Modified by Psymbiote for use with VentHordeRuleComponent."
source: "https://github.com/TheDenSS14/TheDen"

- files: ["vent_harmless_critter.ogg"]
license: "CC-BY-SA-3.0"
copyright: "Edited and composited by MajorMoth, samples taken from freesound.org at ID's 244015, 528191"
source: "https://freesound.org"

- files: ["vent_slime.ogg"]
license: "CC-BY-SA-3.0"
copyright: "Edited and composited by MajorMoth, samples taken from https://www.youtube.com/watch?v=hX5S4KC0hx0, https://www.youtube.com/watch?v=REOeff9WJ2o,
https://www.youtube.com/watch?v=9XIDm_sZhx4,
https://www.youtube.com/watch?v=jiTV8MwgL3c"
source: "https://www.youtube.com"
Binary file added Resources/Audio/_DEN/VentCritters/vent_carp.ogg
Binary file not shown.
Binary file not shown.
Binary file added Resources/Audio/_DEN/VentCritters/vent_slime.ogg
Binary file not shown.
Binary file added Resources/Audio/_DEN/VentCritters/vent_xeno.ogg
Binary file not shown.
15 changes: 15 additions & 0 deletions Resources/Audio/_starcup/Ambience/Objects/attributions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
- files:
- vent_den.ogg
license: "CC-BY-NC-4.0"
copyright: "Modified by Psymbiote from MOUSE - MICE - RAT - TERRARIUM - SQUEAK.wav by tjandrasounds"
source: "https://freesound.org/s/251949/"
- files:
- vent_infested.ogg
license: "CC-BY-4.0"
copyright: "Modified by Psymbiote from Ambience_AlienHive_00.wav by LittleRobotSoundFactory"
source: "https://freesound.org/s/270520/"
- files:
- vent_pulsating.ogg
license: "CC-BY-4.0"
copyright: "Modified by Psymbiote from Guts - Spooky - HORROR by bolkmar."
source: "https://freesound.org/s/393783/"
Binary file not shown.
Binary file not shown.
Binary file not shown.
39 changes: 39 additions & 0 deletions Resources/Audio/_starcup/VentCritters/attributions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
- files: ["vent_carp.ogg"]
license: "CC-BY-SA-3.0"
copyright: "Modified by Psymbiote from the original file edited and composited by MajorMoth, modified bite.ogg and metal_break4.ogg"
source: "https://github.com/TheDenSS14/TheDen"

- files: ["vent_mosquitoes.ogg"]
license: "CC-BY-SA-3.0"
copyright: "Edited and composited by Psymbiote, samples taken from freesound.org at ID's 827925, 315908"
source: "https://freesound.org"

- files: ["vent_leeches.ogg"]
license: "CC-BY-4.0"
copyright: "Edited and composited by Psymbiote, samples taken from freesound.org at ID's 616199, 616200 and 207930"
source: "https://freesound.org"

- files: ["vent_snakes.ogg"]
license: "CC0-1.0"
copyright: "Edited and composited by Psymbiote, samples taken from freesound.org at ID's 706981 and 712920"
source: "https://freesound.org"

- files: ["vent_spiders.ogg"]
license: "CC-BY-4.0"
copyright: "Edited and composited by Psymbiote from Metal Rattles by IENBA and arachnid_scream.ogg"
source: "https://freesound.org/s/849797"

- files: ["vent_generic1.ogg", "vent_generic2.ogg", "vent_generic3.ogg"]
license: "CC-BY-4.0"
copyright: "Edited and composited by Psymbiote from Vent Crawling by ME_Studios_Official"
source: "https://freesound.org/s/652449/"

- files: ["vent_flesh.ogg"]
license: "CC-BY-3.0"
copyright: "Edited and composited by Psymbiote from Crawling Through a Vent by Ultra-Edward on freesound.org ID 795872, small pest alien/creature by Brandon Morris on OpenGameArt, metal_scrape1.ogg and metal_slam2.ogg."
source: "https://freesound.org/s/849797"

- files: ["vent_bugs.ogg"]
license: "CC-BY-SA-3.0"
copyright: "Edited and composited by Psymbiote, includes metal_thud1.ogg and metal_thud3.ogg."
source: "https://github.com/cmss13-devs/cmss13"
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
83 changes: 61 additions & 22 deletions Resources/Prototypes/GameRules/events.yml
Original file line number Diff line number Diff line change
Expand Up @@ -460,15 +460,26 @@
earliestStart: 20
minimumPlayers: 15
weight: 5
duration: 5
maxDuration: 20
duration: 15
maxDuration: 30 # starcup: the new sounds are longer
- type: VentHordeRule
table: !type:GroupSelector
rolls: 4, 8
# begin starcup
table: !type:AllSelector
children:
- id: MobAdultSlimesBlueAngry
- id: MobAdultSlimesGreenAngry
- id: MobAdultSlimesYellowAngry
- id: PuddleSlime
- !type:GroupSelector
rolls: 4, 8
children:
- id: MobAdultSlimesBlueAngry
- id: MobAdultSlimesGreenAngry
- id: MobAdultSlimesYellowAngry
passiveSound:
path: /Audio/_DEN/VentCritters/vent_slime.ogg
endSound:
collection: MetalBreak
ventBreakChance: 1.0
ventReplacement: GasVentPumpBroken
# end starcup

- type: entity
id: SnakeSpawnHorde
Expand All @@ -481,15 +492,25 @@
earliestStart: 20
minimumPlayers: 15
weight: 5
duration: 5
maxDuration: 20
duration: 30
maxDuration: 30 # starcup: the new sounds are longer
- type: VentHordeRule
table: !type:GroupSelector
rolls: 4, 8
# begin starcup
table: !type:AllSelector
children:
- id: MobPurpleSnake
- id: MobSmallPurpleSnake
- id: MobCobraSpace
- !type:GroupSelector
rolls: 4, 8
children:
- id: MobPurpleSnake
- id: MobSmallPurpleSnake
- id: MobCobraSpace
passiveSound:
path: /Audio/_starcup/VentCritters/vent_snakes.ogg
endSound:
collection: MetalBreak
ventBreakChance: 1.0
ventReplacement: GasVentPumpBroken
# end starcup

- type: entity
id: SpiderSpawnHorde
Expand All @@ -502,13 +523,24 @@
earliestStart: 20
minimumPlayers: 15
weight: 5
duration: 5
maxDuration: 20
duration: 30
maxDuration: 30 # starcup: the new sounds are longer
- type: VentHordeRule
table: !type:GroupSelector
rolls: 4, 8
# begin starcup
table: !type:AllSelector
children:
- id: MobGiantSpiderAngry
- id: SpiderWeb
- !type:GroupSelector
rolls: 4, 8
children:
- id: MobGiantSpiderAngry
passiveSound:
path: /Audio/_starcup/VentCritters/vent_spiders.ogg
endSound:
collection: MetalBreak
ventBreakChance: 1.0
ventReplacement: GasVentPumpBroken
# end starcup

- type: entity
id: SpiderClownSpawnHorde
Expand All @@ -524,10 +556,17 @@
duration: 5
maxDuration: 20
- type: VentHordeRule
table: !type:GroupSelector
rolls: 4, 8
# begin starcup
table: !type:AllSelector
children:
- id: MobClownSpider
- id: SpiderWebClown
- !type:GroupSelector
rolls: 4, 8
children:
- id: MobClownSpider
ventBreakChance: 1.0
ventReplacement: GasVentPumpBroken
# end starcup

- type: entity
id: ZombieOutbreak
Expand Down
13 changes: 8 additions & 5 deletions Resources/Prototypes/GameRules/pests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
prob: 0.02
- id: MobMouse2
prob: 0.02
- id: MobMouseCancer
prob: 0.001
#- id: MobMouseCancer # starcup: disable cancer mouse spawn
#prob: 0.001
specialEntries:
- id: SpawnPointGhostRatKing
prob: 0.001
Expand All @@ -71,13 +71,15 @@
- type: VentCrittersRule
entries:
- id: MobCockroach
prob: 0.03
prob: 0.02
# begin starcup
- id: MobCockroachHL
prob: 0.02
- id: MobMothroach
prob: 0.004 # starcup: 0.008 -> 0.004
#- id: MobMoproach # starcup: move to mothroach event
# prob: 0.004
- id: MobMoproach
prob: 0.004
# end starcup

- type: entity
id: SnailMigrationLowPop
Expand Down Expand Up @@ -140,6 +142,7 @@
- !type:GroupSelector
children: # Increased chances for special roaches on purpose. Makes it a bit more interesting.
- id: MobCockroach
- id: MobCockroachHL # starcup
- id: MobMothroach
- id: MobMoproach
weight: 0.5
Expand Down
44 changes: 0 additions & 44 deletions Resources/Prototypes/_DV/GameRules/events.yml

This file was deleted.

Loading
Loading