Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into ambient-music
Browse files Browse the repository at this point in the history
  • Loading branch information
Peptide90 committed Dec 22, 2023
2 parents 37cf6c2 + 3346666 commit ce23361
Show file tree
Hide file tree
Showing 876 changed files with 10,596 additions and 715 deletions.
6 changes: 6 additions & 0 deletions Content.Server/Gatherable/Components/GatherableComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,10 @@ public sealed class GatherableComponent : Component
/// </summary>
[DataField("loot")]
public Dictionary<string, string>? MappedLoot = new();

/// <summary>
/// How long it takes to gather the item
/// </summary>
[DataField("gatherTime"), ViewVariables(VVAccess.ReadWrite)]
public int GatherTime = 1;
}
2 changes: 1 addition & 1 deletion Content.Server/Gatherable/GatherableSystem.Projectile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ private void OnProjectileCollide(EntityUid uid, GatheringProjectileComponent com
return;
}

Gather(args.OtherEntity, uid, gatherable);
Gather(args.OtherEntity, uid, uid, gatherable);
component.Amount--;

if (component.Amount <= 0)
Expand Down
70 changes: 61 additions & 9 deletions Content.Server/Gatherable/GatherableSystem.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
using Content.Server.Destructible;
using Content.Server.DoAfter;
using Content.Server.Gatherable.Components;
using Content.Shared.DoAfter;
using Content.Shared.EntityList;
using Content.Shared.Gatherable;
using Content.Shared.Interaction;
using Content.Shared.Tag;
using Content.Shared.Tools;
using Content.Shared.Tools.Components;
using Content.Shared.Weapons.Melee.Events;
using Robust.Shared.Audio;
using Robust.Shared.Prototypes;
Expand All @@ -15,35 +20,79 @@ public sealed partial class GatherableSystem : EntitySystem
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly DestructibleSystem _destructible = default!;
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly TagSystem _tagSystem = default!;
[Dependency] private readonly SharedToolSystem _toolSystem = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<GatherableComponent, ActivateInWorldEvent>(OnActivate);
SubscribeLocalEvent<GatherableComponent, InteractUsingEvent>(OnToolActivate);
SubscribeLocalEvent<GatherableComponent, InteractHandEvent>(OnHandActivate);
SubscribeLocalEvent<GatherableComponent, AttackedEvent>(OnAttacked);
SubscribeLocalEvent<GatherableComponent, GatherableDoAfterEvent>(OnDoAfterGather);

InitializeProjectile();
}

private void OnAttacked(EntityUid uid, GatherableComponent component, AttackedEvent args)
{
if (component.ToolWhitelist?.IsValid(args.Used, EntityManager) != true)
if (component.ToolWhitelist?.IsValid(args.Used, EntityManager) != true || component.GatherTime != 0)
return;

Gather(uid, args.User, component);
Gather(uid, args.User, args.Used, component);
}

private void OnActivate(EntityUid uid, GatherableComponent component, ActivateInWorldEvent args)
private void OnToolActivate(EntityUid uid, GatherableComponent component, InteractUsingEvent args)
{
if (component.ToolWhitelist?.IsValid(args.Used, EntityManager) != true)
return;

//TODO: integrate the tools qualities the right way
var gatherEvent = new GatherableDoAfterEvent();

if (TryComp<ToolComponent>(args.Used, out var tool))
{
_toolSystem.UseTool(args.Used, args.User, uid, component.GatherTime, tool.Qualities, gatherEvent);
}
else
{
_doAfterSystem.TryStartDoAfter(new DoAfterArgs(args.User, component.GatherTime, gatherEvent, uid, uid,
args.Used)
{
BreakOnUserMove = true,
BreakOnDamage = true,
BreakOnTargetMove = true,
MovementThreshold = 1.0f,
});
}
}
private void OnHandActivate(EntityUid uid, GatherableComponent component, InteractHandEvent args)
{
if (component.ToolWhitelist?.IsValid(args.User, EntityManager) != true)
return;

Gather(uid, args.User, component);
var gatherEvent = new GatherableDoAfterEvent();

_doAfterSystem.TryStartDoAfter(new DoAfterArgs(args.User, component.GatherTime, gatherEvent, uid, uid)
{
BreakOnUserMove = true,
BreakOnDamage = true,
BreakOnTargetMove = true,
MovementThreshold = 1.0f,
});
}

public void Gather(EntityUid gatheredUid, EntityUid? gatherer = null, GatherableComponent? component = null, SoundSpecifier? sound = null)
private void OnDoAfterGather(EntityUid uid, GatherableComponent component, GatherableDoAfterEvent args)
{
if (args.Cancelled || args.Handled)
return;

args.Handled = true;
Gather(uid, args.User, args.Used, component);
}
public void Gather(EntityUid gatheredUid, EntityUid? gatherer = null, EntityUid? tool = null, GatherableComponent? component = null, SoundSpecifier? sound = null)
{
if (!Resolve(gatheredUid, ref component))
return;
Expand All @@ -62,13 +111,16 @@ public void Gather(EntityUid gatheredUid, EntityUid? gatherer = null, Gatherable
{
if (tag != "All")
{
if (gatherer != null && !_tagSystem.HasTag(gatherer.Value, tag))
if ((gatherer != null && tool != null && !_tagSystem.HasTag(tool.Value, tag)) || tool == null)
continue;
}
var getLoot = _prototypeManager.Index<EntityLootTablePrototype>(table);
var spawnLoot = getLoot.GetSpawns();
var spawnPos = pos.Offset(_random.NextVector2(0.3f));
Spawn(spawnLoot[0], spawnPos);
foreach (var loot in spawnLoot)
{
Spawn(loot, spawnPos);
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Parallax/BiomeSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ private void LoadChunk(

foreach (var decal in decals)
{
if (!_decals.TryAddDecal(decal.ID, new EntityCoordinates(gridUid, decal.Position), out var dec))
if (!_decals.TryAddDecal(decal.ID, new EntityCoordinates(gridUid, decal.Position), out var dec, decal.Color))
continue;

loadedDecals.Add(dec, indices);
Expand Down
9 changes: 9 additions & 0 deletions Content.Shared/Gatherable/GatherableDoAfterEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Content.Shared.DoAfter;
using Robust.Shared.Serialization;

namespace Content.Shared.Gatherable;

[Serializable, NetSerializable]
public sealed class GatherableDoAfterEvent : SimpleDoAfterEvent
{
}
3 changes: 3 additions & 0 deletions Content.Shared/Parallax/Biomes/Layers/BiomeDecalLayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,7 @@ public sealed class BiomeDecalLayer : IBiomeWorldLayer

[DataField("decals", required: true, customTypeSerializer:typeof(PrototypeIdListSerializer<DecalPrototype>))]
public List<string> Decals = new();

[DataField("color")]
public Color Color = Color.White;
}
6 changes: 3 additions & 3 deletions Content.Shared/Parallax/Biomes/SharedBiomeSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ protected bool TryGetEntity(Vector2i indices, List<IBiomeLayer> layers, FastNois
/// Tries to get the relevant decals for this tile.
/// </summary>
public bool TryGetDecals(Vector2i indices, List<IBiomeLayer> layers, FastNoiseLite noise, MapGridComponent grid,
[NotNullWhen(true)] out List<(string ID, Vector2 Position)>? decals)
[NotNullWhen(true)] out List<(string ID, Vector2 Position, Color Color)>? decals)
{
if (!TryGetBiomeTile(indices, layers, noise, grid, out var tileRef))
{
Expand Down Expand Up @@ -314,7 +314,7 @@ public bool TryGetDecals(Vector2i indices, List<IBiomeLayer> layers, FastNoiseLi
return false;
}

decals = new List<(string ID, Vector2 Position)>();
decals = new List<(string ID, Vector2 Position, Color Color)>();

for (var x = 0; x < decalLayer.Divisions; x++)
{
Expand All @@ -327,7 +327,7 @@ public bool TryGetDecals(Vector2i indices, List<IBiomeLayer> layers, FastNoiseLi
if (decalValue < decalLayer.Threshold)
continue;

decals.Add((Pick(decalLayer.Decals, (noise.GetNoise(indices.X, indices.Y, x + y * decalLayer.Divisions) + 1f) / 2f), index));
decals.Add((Pick(decalLayer.Decals, (noise.GetNoise(indices.X, indices.Y, x + y * decalLayer.Divisions) + 1f) / 2f), index, decalLayer.Color));
}
}

Expand Down
4 changes: 4 additions & 0 deletions Resources/Audio/Nuclear14/attributions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- files: ["war_never_changes.ogg"]
license: "CC-BY-NC-SA-3.0"
copyright: "Bethesda Softworks, from fallout 2. Converted from MP3 to OGG. Should be free use like the other audio, not confirmed."
source: "https://www.myinstants.com/en/instant/war-never-changes-fallouts-narrator-15365/"
Binary file added Resources/Audio/Nuclear14/war_never_changes.ogg
Binary file not shown.
23 changes: 23 additions & 0 deletions Resources/Locale/en-US/Nuclear14/department.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Names
department-BrotherhoodMidwest = Midwest Brotherhood of Steel
department-BrotherhoodWashington = Washington Brotherhood of Steel
department-CaravanCompany = Caravan Company
department-NCR = New California Republic
department-Tribe = Tribal
department-Vault = Vault Dwellers
department-Wastelander = Wastelander
department-Townsfolk = Townsfolk
department-Followers = Followers of the Apocalypse
department-Zetan = Zetan
# Descriptions
department-BrotherhoodMidwest-description = Midwest branch of the Brotherhood of Steel
department-BrotherhoodWashington-description = Washington branch of the Brotherhood of Steel
department-CaravanCompany-description = The local Caravan Company responsible for import and export of goods.
department-NCR-description = A settler detachment sent by the New California Republic
department-Tribe-description = A local tribal group trying to get by.
department-Vault-description = The local Vault Dwellers
department-Wastelander-description = Wastelanders living in the pacific northwest.
department-Townsfolk-description = Townsfolk from a local town trying to keep it civilised.
department-Followers-description = Followers of the Apocalypse on a humanitarian mission.
department-Zetan-description = Zetan abductors here to probe you!
11 changes: 11 additions & 0 deletions Resources/Locale/en-US/Nuclear14/headset-component.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# See en-US/headset/headset-component.ftl for upstream radio channels.

chat-radio-wasteland-common = Wasteland Common
chat-radio-vault-command = Vault Command
chat-radio-vault-engineering = Vault Engineering
chat-radio-vault-medical = Vault Medical
chat-radio-vault-science = Vault Science
chat-radio-vault-security = Vault Security
chat-radio-vault-common = Vault Common
chat-radio-caravan = Caravan Company
chat-radio-bosmidwest = Brotherhood Midwest
51 changes: 51 additions & 0 deletions Resources/Locale/en-US/Nuclear14/job-names.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# N14
job-name-bos-mid-knight-comm = Midwest Brotherhood Knight Commander
job-name-bos-mid-scribe = Midwest Brotherhood Scribe
job-name-bos-washington-elder = Washington Brotherhood Elder
job-name-bos-washington-initiate = Washington Brotherhood Initiate
job-name-bos-washington-knight = Washington Brotherhood Knight
job-name-bos-washington-paladin = Washington Brotherhood Paladin
job-name-bos-washington-scribe = Washington Brotherhood Scribe
job-name-caravan-leader = Caravan Leader
job-name-caravan-trader = Caravan Trader
job-name-caravan-guard = Caravan Guard
job-name-ncr-cadet = NCR Cadet
job-name-ncr-nco = NCR NCO
job-name-ncr-officer = NCR Officer
job-name-ncr-soldier = NCR Soldier
job-name-tribal = Tribesperson
job-name-tribal-elder = Tribe Elder
job-name-tribal-farmer = Tribal Farmer
job-name-tribal-healer = Tribal Healer
job-name-overseer = Vault Overseer
job-name-vault-doctor = Vault Doctor
job-name-vault-dweller = Vault Dweller
job-name-vault-engineer = Vault Engineer
job-name-vault-security = Vault Security
job-name-farmer = Farmer
job-name-scavenger = Scavenger
job-name-wastelander = Wastelander
job-name-townsperson = Townsperson
job-name-towndoctor = Town Doctor
job-name-townmechanic = Town Mechanic
job-name-townshopkeeper = Town Shopkeeper
job-name-towndeputy = Town Deputy
job-name-townsheriff = Town Sheriff
job-name-townmayor = Town Mayor
# Followers
job-name-followers = Followers of the Apocalypse
# Fun
job-name-survivor = Survivor
job-name-zetan = Zetan abductor
# N14 Role Timers
Survivor = Survivor
14 changes: 14 additions & 0 deletions Resources/Locale/en-US/Nuclear14/job-supervisors.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
job-supervisors-bos-mid = the midwest brotherhood knight commander
job-supervisors-bos-washington-elder = lead your faction to victory!
job-supervisors-bos-washington = follow your elder to victory!
job-supervisors-bos-washington-initiate = follow orders from all other roles within the chapter
job-supervisors-caravan = the caravan leader
job-supervisors-caravan-leader = lead your caravan company to riches through trade
job-supervisors-ncr = the NCR officer
job-supervisors-ncr-nco = the NCR officer followed by the NCO
job-supervisors-tribal = the tribe elder
job-supervisors-tribal-elder = lead your tribe to health and prosperity
job-supervisors-overseer = the vaults overseer
job-supervisors-vault-overseer = lead your vault to prosperity and maintain the status quo
job-supervisors-wastelander = look after yourself above all else
job-supervisors-townsfolk = the town mayor
54 changes: 52 additions & 2 deletions Resources/Locale/en-US/Nuclear14/reagents.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,70 @@ reagent-desc-rad-particle-food = Too much will make you sick of living.
reagent-name-juice-cabbage = cabbage juice
reagent-desc-juice-cabbage = Tastes rather bland and iron-y
## Animals
reagent-name-milk-brahmin = brahmin milk
reagent-desc-milk-brahmin = tasty brahmin milk
reagent-name-milk-bighorner = bighorner milk
reagent-desc-milk-bighorner = fatty bighorner milk
reagent-name-milk-radstag = radstag milk
reagent-desc-milk-radstag = protein rich radstag milk
# Chems
reagent-name-firetoxin = fire toxin
reagent-desc-firetoxin = The hot stuff from firey creatures.
reagent-name-healing-powder = healing powder
reagent-desc-healing-powder = A powder made from crushed plants.
reagent-name-antidote-mixture = antidote
reagent-desc-antidote-mixture = An antidote made from radscorpion tail and water for treating poison.
reagent-name-antidote = antidote
reagent-desc-antidote = An antidote made from radscorpion tail and water for treating poison.
reagent-desc-antidote = A potent antitoxin manufactured in a lab.
# Medicine
reagent-name-healing-mixture = healing mixture
reagent-desc-healing-mixture = A mixture of reagents that makes you heal.
reagent-name-robust-healing-mixture = robust healing mixture
reagent-desc-robust-healing-mixture = A mixture of reagents that makes you heal fast.
reagent-name-damage-resist-mixture = damage resistant mixture
reagent-desc-damage-resist-mixture = A mixture of reagents that makes you resistant to damage.
reagent-name-radaway = radaway
reagent-desc-radaway = An odd reagent that cures your radiation.
reagent-name-buffout = buffout
reagent-desc-buffout = A reagent that makes you overall more robust, for a short period of time.
reagent-name-rad-x = rad-x
reagent-desc-rad-x = A reagent that makes you resistant to radiation.
reagent-name-fixer = fixer
reagent-desc-fixer = A reagent that cures your addictions.
reagent-name-mentats = mentats
reagent-desc-mentats = A reagent that makes you mentally sharper.
reagent-name-cateye = cateye
reagent-desc-cateye = A reagent that improves your low-light vision.
# Meta
reagent-name-movespeedmod-mixture = movementspeed modifying mixture
reagent-desc-movespeedmod-mixture = A mixture of reagents that makes you move fast.
reagent-name-robust-movespeedmod-mixture = robust movementspeed modifying mixture
reagent-desc-robust-movespeedmod-mixture = A mixture of reagents that makes you move very fast.
reagent-name-damage-mod-mixture = damage modifying mixture
reagent-desc-damage-mod-mixture = A mixture of reagents that makes you deal more damage.
## Products
reagent-name-abraxocleaner = Abraxo Cleaner
reagent-desc-abraxocleaner = A pre-war cleaning product.
reagent-name-wonderglue = Wonderglue
reagent-desc-wonderglue = A pre-war adhesive. Don't sniff it.
reagent-name-turpentine = Turpentine
reagent-desc-turpentine = A spirit used for cleaning things.
reagent-desc-turpentine = A spirit used for cleaning things.
Loading

0 comments on commit ce23361

Please sign in to comment.