Skip to content

Commit

Permalink
Merge branch 'master' into fashion-update-markings
Browse files Browse the repository at this point in the history
  • Loading branch information
angelofallars authored Dec 1, 2024
2 parents 8c3c26e + 8a368bb commit 0b9ee93
Show file tree
Hide file tree
Showing 31 changed files with 838 additions and 45 deletions.
8 changes: 4 additions & 4 deletions Content.Client/Lobby/UI/LoadoutPreferenceSelector.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,21 +148,21 @@ public LoadoutPreferenceSelector(LoadoutPrototype loadout, JobPrototype highJob,

// Manage the info button
void UpdateGuidebook() => GuidebookButton.Visible =
prototypeManager.HasIndex<GuideEntryPrototype>(DefaultLoadoutInfoGuidebook + Loadout.ID);
prototypeManager.HasIndex<GuideEntryPrototype>(loadout.GuideEntry);
UpdateGuidebook();
prototypeManager.PrototypesReloaded += _ => UpdateGuidebook();

GuidebookButton.OnPressed += _ =>
{
if (!prototypeManager.TryIndex<GuideEntryPrototype>(DefaultLoadoutInfoGuidebook, out var guideRoot))
if (!prototypeManager.TryIndex<GuideEntryPrototype>(loadout.GuideEntry, out var guideRoot))
return;

var guidebookController = UserInterfaceManager.GetUIController<GuidebookUIController>();
//TODO: Don't close the guidebook if its already open, just go to the correct page
guidebookController.ToggleGuidebook(
new Dictionary<string, GuideEntry> { { DefaultLoadoutInfoGuidebook, guideRoot } },
new Dictionary<string, GuideEntry> { { loadout.GuideEntry, guideRoot } },
includeChildren: true,
selected: DefaultLoadoutInfoGuidebook + Loadout.ID);
selected: loadout.GuideEntry);
};

// Create a checkbox to get the loadout
Expand Down
60 changes: 23 additions & 37 deletions Content.Server/Mood/MoodSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,6 @@ public sealed class MoodSystem : EntitySystem
[Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly IConfigurationManager _config = default!;

#if RELEASE
// Disable Mood for tests, because of a stupid race condition where if it spawns an Urist McHarpy,
// the Harpy will choke during the test, creating a mood alert.
// And then cause a debug assert.
private bool _debugMode;
#else
private bool _debugMode = true;
#endif


public override void Initialize()
{
Expand All @@ -55,14 +46,12 @@ public override void Initialize()
SubscribeLocalEvent<MoodComponent, MoodRemoveEffectEvent>(OnRemoveEffect);
}

private void OnShutdown(EntityUid uid, MoodComponent component, ComponentShutdown args)
{
private void OnShutdown(EntityUid uid, MoodComponent component, ComponentShutdown args) =>
_alerts.ClearAlertCategory(uid, component.MoodCategory);
}

private void OnRemoveEffect(EntityUid uid, MoodComponent component, MoodRemoveEffectEvent args)
{
if (_debugMode)
if (!_config.GetCVar(CCVars.MoodEnabled))
return;

if (component.UncategorisedEffects.TryGetValue(args.EffectId, out _))
Expand All @@ -78,7 +67,7 @@ private void OnRemoveEffect(EntityUid uid, MoodComponent component, MoodRemoveEf

private void OnRefreshMoveSpeed(EntityUid uid, MoodComponent component, RefreshMovementSpeedModifiersEvent args)
{
if (_debugMode
if (!_config.GetCVar(CCVars.MoodEnabled)
|| component.CurrentMoodThreshold is > MoodThreshold.Meh and < MoodThreshold.Good or MoodThreshold.Dead
|| _jetpack.IsUserFlying(uid))
return;
Expand All @@ -101,7 +90,7 @@ private void OnRefreshMoveSpeed(EntityUid uid, MoodComponent component, RefreshM

private void OnMoodEffect(EntityUid uid, MoodComponent component, MoodEffectEvent args)
{
if (_debugMode
if (!_config.GetCVar(CCVars.MoodEnabled)
|| !_config.GetCVar(CCVars.MoodEnabled)
|| !_prototypeManager.TryIndex<MoodEffectPrototype>(args.EffectId, out var prototype) )
return;
Expand Down Expand Up @@ -210,7 +199,7 @@ private void ReplaceMood(EntityUid uid, string prototypeId)

private void OnMobStateChanged(EntityUid uid, MoodComponent component, MobStateChangedEvent args)
{
if (_debugMode)
if (!_config.GetCVar(CCVars.MoodEnabled))
return;

if (args.NewMobState == MobState.Dead && args.OldMobState != MobState.Dead)
Expand Down Expand Up @@ -249,7 +238,7 @@ private void RefreshMood(EntityUid uid, MoodComponent component)

private void OnInit(EntityUid uid, MoodComponent component, ComponentStartup args)
{
if (_debugMode)
if (!_config.GetCVar(CCVars.MoodEnabled))
return;

if (_config.GetCVar(CCVars.MoodModifiesThresholds)
Expand All @@ -274,15 +263,14 @@ private void SetMood(EntityUid uid, float amount, MoodComponent? component = nul

if (ev.Cancelled)
return;
else
{
uid = ev.Receiver;
amount = ev.MoodChangedAmount;
}

uid = ev.Receiver;
amount = ev.MoodChangedAmount;

var newMoodLevel = amount + neutral;
if (!force)
newMoodLevel = Math.Clamp(amount + neutral,
newMoodLevel = Math.Clamp(
amount + neutral,
component.MoodThresholds[MoodThreshold.Dead],
component.MoodThresholds[MoodThreshold.Perfect]);

Expand Down Expand Up @@ -355,7 +343,7 @@ private void SetCritThreshold(EntityUid uid, MoodComponent component, int modifi
{
1 => FixedPoint2.New(key.Value.Float() * component.IncreaseCritThreshold),
-1 => FixedPoint2.New(key.Value.Float() * component.DecreaseCritThreshold),
_ => component.CritThresholdBeforeModify
_ => component.CritThresholdBeforeModify,
};

component.CritThresholdBeforeModify = key.Value;
Expand All @@ -378,15 +366,13 @@ private MoodThreshold GetMoodThreshold(MoodComponent component, float? moodLevel
return result;
}

private int GetMovementThreshold(MoodThreshold threshold)
{
return threshold switch
private int GetMovementThreshold(MoodThreshold threshold) =>
threshold switch
{
>= MoodThreshold.Good => 1,
<= MoodThreshold.Meh => -1,
_ => 0
_ => 0,
};
}

private void OnDamageChange(EntityUid uid, MoodComponent component, DamageChangedEvent args)
{
Expand All @@ -408,8 +394,7 @@ private void OnDamageChange(EntityUid uid, MoodComponent component, DamageChange
}
}

[UsedImplicitly]
[DataDefinition]
[UsedImplicitly, DataDefinition]
public sealed partial class ShowMoodEffects : IAlertClick
{
public void AlertClicked(EntityUid uid)
Expand All @@ -421,8 +406,7 @@ public void AlertClicked(EntityUid uid)

if (!entityManager.TryGetComponent<MoodComponent>(uid, out var comp)
|| comp.CurrentMoodThreshold == MoodThreshold.Dead
|| !playerManager.TryGetSessionByEntity(uid, out var session)
|| session == null)
|| !playerManager.TryGetSessionByEntity(uid, out var session))
return;

var msgStart = Loc.GetString("mood-show-effects-start");
Expand Down Expand Up @@ -450,15 +434,17 @@ public void AlertClicked(EntityUid uid)

private void SendDescToChat(MoodEffectPrototype proto, ICommonSession session)
{
if (session == null)
return;

var chatManager = IoCManager.Resolve<IChatManager>();

var color = (proto.MoodChange > 0) ? "#008000" : "#BA0000";
var msg = $"[font size=10][color={color}]{proto.Description}[/color][/font]";

chatManager.ChatMessageToOne(ChatChannel.Emotes, msg, msg, EntityUid.Invalid, false,
chatManager.ChatMessageToOne(
ChatChannel.Emotes,
msg,
msg,
EntityUid.Invalid,
false,
session.Channel);
}
}
4 changes: 4 additions & 0 deletions Content.Shared/CCVar/CCVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2693,7 +2693,11 @@ public static readonly CVarDef<float>
#region Mood System

public static readonly CVarDef<bool> MoodEnabled =
#if RELEASE
CVarDef.Create("mood.enabled", true, CVar.SERVER);
#else
CVarDef.Create("mood.enabled", false, CVar.SERVER);
#endif

public static readonly CVarDef<bool> MoodIncreasesSpeed =
CVarDef.Create("mood.increases_speed", true, CVar.SERVER);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
using Content.Shared.Clothing.Loadouts.Systems;
using Content.Shared.Customization.Systems;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;

namespace Content.Shared.Clothing.Loadouts.Prototypes;

Expand Down Expand Up @@ -45,4 +42,7 @@ public sealed partial class LoadoutPrototype : IPrototype

[DataField]
public List<CharacterRequirement> Requirements = new();

[DataField]
public string GuideEntry { get; } = "";
}
13 changes: 13 additions & 0 deletions Resources/Changelog/Changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8293,3 +8293,16 @@ Entries:
id: 6548
time: '2024-11-30T18:52:35.0000000+00:00'
url: https://github.com/Simple-Station/Einstein-Engines/pull/1297
- author: VMSolidus
changes:
- type: Add
message: Added a guidebook entry on Security Duty Weapons
- type: Add
message: >-
Added guidebook entries on various Corporations in lore, such as
Einstein Engines, Hephaestus Heavy Industries, etc.
- type: Add
message: Loadouts can now link to a specific guidebook entry via prototype ID.
id: 6549
time: '2024-12-01T03:27:05.0000000+00:00'
url: https://github.com/Simple-Station/Einstein-Engines/pull/1298
2 changes: 1 addition & 1 deletion Resources/Credits/GitHub.txt

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions Resources/Locale/en-US/guidebook/lore.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
guide-entry-setting-lore = Setting Lore
guide-entry-corporations = Corporations
guide-entry-einstein-engines = Einstein Engines
guide-entry-hephaestus-industries = Hephaestus Industries
guide-entry-idris-incorporated = Idris Incorporated
guide-entry-nanotrasen = NanoTrasen
guide-entry-orion-express = Orion Express
guide-entry-private-military-contracting-group = Private Military Contracting Group
guide-entry-stellar-corporate-conglomerate = Stellar Corporate Conglomerate
guide-entry-zavodskoi-interstellar = Zavodskoi Interstellar
guide-entry-zeng-hu-pharmaceuticals = Zeng-Hu Pharmaceuticals
guide-entry-loadout-info-security-weapons = Security Weapons
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@
id: WeaponEnergyGunMiniSecurity
description: A light version of the Energy gun with a smaller capacity.
The serial number on the handguard marks this gun as belonging to an NT Security Officer.
components:
- type: GuideHelp
guides: [ SecurityWeapons ]

- type: entity
name: PDW-9 Energy Pistol
Expand Down Expand Up @@ -236,6 +239,9 @@
id: WeaponEnergyGunPistolSecurity
description: A military grade sidearm, used by many militia forces throughout the local sector.
The serial number on the handguard marks this gun as belonging to an NT Security Officer.
components:
- type: GuideHelp
guides: [ SecurityWeapons ]

- type: entity
name: IK-60 laser carbine
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
id: WeaponPistolViperWoodSecurity
description: A small, low-power pistol with pleasant lacquered wooden grips. Uses .35 auto ammo.
The serial number on the handguard marks this gun as belonging to an NT Security Officer.
components:
- type: GuideHelp
guides: [ SecurityWeapons ]

- type: entity
name: Pollock
Expand Down Expand Up @@ -85,6 +88,9 @@
id: WeaponPistolPollockSecurity
description: A compact and mass-produced combat pistol. Uses .35 auto ammo.
The serial number on the handguard marks this gun as belonging to an NT Security Officer.
components:
- type: GuideHelp
guides: [ SecurityWeapons ]

- type: entity
name: Pollock
Expand All @@ -110,6 +116,8 @@
whitelist:
tags:
- CartridgePistol
- type: GuideHelp
guides: [ SecurityWeapons ]

- type: entity
name: psi-breaker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
id: WeaponRevolverSnubSecurity
description: An old and reliable revolver, modified to be more easily concealed. Uses .45 magnum ammo.
The serial number on the handguard marks this gun as belonging to an NT Security Officer.
components:
- type: GuideHelp
guides: [ SecurityWeapons ]

- type: entity
name: snubbed .45
Expand All @@ -43,6 +46,8 @@
capacity: 6
chambers: [ True, True, True, True, True, True ]
ammoSlots: [ null, null, null, null, null, null ]
- type: GuideHelp
guides: [ SecurityWeapons ]

- type: entity
name: k-38 masterpiece
Expand Down Expand Up @@ -75,6 +80,9 @@
id: WeaponRevolverK38MasterSecurity
description: A classic, if not outdated, law enforcement firearm. Uses .38 special ammo.
The serial number on the handguard marks this gun as belonging to an NT Security Officer.
components:
- type: GuideHelp
guides: [ SecurityWeapons ]

- type: entity
name: k-38 masterpiece
Expand All @@ -90,6 +98,8 @@
capacity: 6
chambers: [ True, True, True, True, True, True ]
ammoSlots: [ null, null, null, null, null, null ]
- type: GuideHelp
guides: [ SecurityWeapons ]

- type: entity
name: fitz special
Expand Down Expand Up @@ -122,6 +132,9 @@
id: WeaponRevolverFitzSecurity
description: A compact and concealable self defence snub revolver. Uses .38 special ammo.
The serial number on the handguard marks this gun as belonging to an NT Security Officer.
components:
- type: GuideHelp
guides: [ SecurityWeapons ]

- type: entity
name: fitz special
Expand All @@ -137,6 +150,8 @@
capacity: 6
chambers: [ True, True, True, True, True, True ]
ammoSlots: [ null, null, null, null, null, null ]
- type: GuideHelp
guides: [ SecurityWeapons ]

- type: entity
name: lucky 37
Expand Down
Loading

0 comments on commit 0b9ee93

Please sign in to comment.