-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix-psi * Update CCVars.Mood.cs * Update CCVars.Mood.cs
- Loading branch information
Showing
12 changed files
with
332 additions
and
178 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
Content.Server/Backmen/Psionics/Glimmer/Components/GlimmerStationEventSchedulerComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using Content.Server.StationEvents; | ||
using Content.Server.StationEvents.Components; | ||
using Content.Shared.EntityTable.EntitySelectors; | ||
|
||
namespace Content.Server.Backmen.Psionics.Glimmer.Components; | ||
|
||
/// <summary> | ||
/// Компонент для управления событиями, основанными на уровне сияния. | ||
/// </summary> | ||
[RegisterComponent] | ||
public sealed partial class GlimmerStationEventSchedulerComponent : Component | ||
{ | ||
/// <summary> | ||
/// Время до следующего события (в секундах). | ||
/// </summary> | ||
[DataField("timeUntilNextEvent")] | ||
public float TimeUntilNextEvent = 0f; | ||
|
||
/// <summary> | ||
/// Минимальное время до следующего события (в секундах). | ||
/// </summary> | ||
[DataField("minEventInterval")] | ||
public float MinEventInterval = 120f; | ||
|
||
/// <summary> | ||
/// Максимальное время до следующего события (в секундах). | ||
/// </summary> | ||
[DataField("maxEventInterval")] | ||
public float MaxEventInterval = 600f; | ||
|
||
/// <summary> | ||
/// Игровые правила, которые планировщик может выбрать. | ||
/// </summary> | ||
[DataField(required: true)] | ||
public EntityTableSelector ScheduledGameRules = default!; | ||
} |
80 changes: 80 additions & 0 deletions
80
Content.Server/Backmen/Psionics/Glimmer/GlimmerStationEventSchedulerSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
using Content.Server.Backmen.Psionics.Glimmer.Components; | ||
using Content.Server.GameTicking; | ||
using Content.Server.GameTicking.Rules; | ||
using Content.Server.StationEvents; | ||
using Content.Shared.Backmen.Psionics.Glimmer; | ||
using Content.Shared.GameTicking.Components; | ||
using Robust.Shared.Random; | ||
|
||
namespace Content.Server.Backmen.Psionics.Glimmer; | ||
|
||
/// <summary> | ||
/// Система, запускающая события в зависимости от уровня сияния. | ||
/// </summary> | ||
public sealed class GlimmerStationEventSchedulerSystem : GameRuleSystem<GlimmerStationEventSchedulerComponent> | ||
{ | ||
[Dependency] private readonly IRobustRandom _random = default!; | ||
[Dependency] private readonly GlimmerSystem _glimmerSystem = default!; | ||
[Dependency] private readonly EventManagerSystem _event = default!; | ||
|
||
protected override void Started(EntityUid uid, GlimmerStationEventSchedulerComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args) | ||
{ | ||
base.Started(uid, component, gameRule, args); | ||
PickNextEventTime(uid, component); | ||
} | ||
|
||
public override void Update(float frameTime) | ||
{ | ||
base.Update(frameTime); | ||
|
||
if (!_event.EventsEnabled) | ||
return; | ||
|
||
var query = EntityQueryEnumerator<GlimmerStationEventSchedulerComponent, GameRuleComponent>(); | ||
while (query.MoveNext(out var uid, out var scheduler, out var gameRule)) | ||
{ | ||
if (!GameTicker.IsGameRuleActive(uid, gameRule)) | ||
continue; | ||
|
||
if (scheduler.TimeUntilNextEvent > 0f) | ||
{ | ||
scheduler.TimeUntilNextEvent -= frameTime; | ||
continue; | ||
} | ||
|
||
PickNextEventTime(uid, scheduler); | ||
_event.RunRandomEvent(scheduler.ScheduledGameRules); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Задаёт время до следующего события в зависимости от уровня сияния. | ||
/// </summary> | ||
private void PickNextEventTime(EntityUid uid, GlimmerStationEventSchedulerComponent component) | ||
{ | ||
var tier = _glimmerSystem.GetGlimmerTier(); | ||
var glimmerMod = GetGlimmerModifier(tier); | ||
|
||
// Интервал задается на основе значений из компонента | ||
component.TimeUntilNextEvent = _random.NextFloat( | ||
component.MinEventInterval / glimmerMod, | ||
component.MaxEventInterval / glimmerMod | ||
); | ||
} | ||
|
||
/// <summary> | ||
/// Модификатор частоты событий в зависимости от уровня сияния. | ||
/// </summary> | ||
private float GetGlimmerModifier(GlimmerTier tier) | ||
{ | ||
return tier switch | ||
{ | ||
GlimmerTier.Minimal => 1f, | ||
GlimmerTier.Low => 1.5f, | ||
GlimmerTier.Moderate => 2f, | ||
GlimmerTier.High => 3f, | ||
GlimmerTier.Dangerous => 4f, | ||
_ => 5f, // Critical | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using Robust.Shared.Configuration; | ||
|
||
namespace Content.Shared.Backmen.CCVar; | ||
|
||
public sealed partial class CCVars | ||
{ | ||
/* | ||
* Discord Auth | ||
*/ | ||
|
||
/// <summary> | ||
/// Enabled Discord linking, show linking button and modal window | ||
/// </summary> | ||
public static readonly CVarDef<bool> DiscordAuthEnabled = | ||
CVarDef.Create("discord_auth.enabled", false, CVar.SERVER | CVar.REPLICATED); | ||
|
||
/// <summary> | ||
/// URL of the Discord auth server API | ||
/// </summary> | ||
public static readonly CVarDef<string> DiscordAuthApiUrl = | ||
CVarDef.Create("discord_auth.api_url", "", CVar.SERVERONLY); | ||
|
||
/// <summary> | ||
/// Secret key of the Discord auth server API | ||
/// </summary> | ||
public static readonly CVarDef<string> DiscordAuthApiKey = | ||
CVarDef.Create("discord_auth.api_key", "", CVar.SERVERONLY | CVar.CONFIDENTIAL); | ||
|
||
public static readonly CVarDef<bool> DiscordAuthIsOptional = | ||
CVarDef.Create("discord_auth.is_opt", false, CVar.SERVER | CVar.REPLICATED); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using Robust.Shared.Configuration; | ||
|
||
namespace Content.Shared.Backmen.CCVar; | ||
|
||
public sealed partial class CCVars | ||
{ | ||
/* | ||
* Glimmer | ||
*/ | ||
|
||
/// <summary> | ||
/// Whether glimmer is enabled. | ||
/// </summary> | ||
public static readonly CVarDef<bool> GlimmerEnabled = | ||
CVarDef.Create("glimmer.enabled", true, CVar.REPLICATED); | ||
|
||
/// <summary> | ||
/// Passive glimmer drain per second. | ||
/// Note that this is randomized and this is an average value. | ||
/// </summary> | ||
public static readonly CVarDef<float> GlimmerLostPerSecond = | ||
CVarDef.Create("glimmer.passive_drain_per_second", 0.1f, CVar.SERVERONLY); | ||
|
||
/// <summary> | ||
/// Whether random rolls for psionics are allowed. | ||
/// Guaranteed psionics will still go through. | ||
/// </summary> | ||
public static readonly CVarDef<bool> PsionicRollsEnabled = | ||
CVarDef.Create("psionics.rolls_enabled", true, CVar.SERVERONLY); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Robust.Shared.Configuration; | ||
|
||
namespace Content.Shared.Backmen.CCVar; | ||
|
||
public sealed partial class CCVars | ||
{ | ||
/* | ||
* Queue | ||
*/ | ||
|
||
/// <summary> | ||
/// Controls if the connections queue is enabled. If enabled stop kicking new players after `SoftMaxPlayers` cap and instead add them to queue. | ||
/// </summary> | ||
public static readonly CVarDef<bool> | ||
QueueEnabled = CVarDef.Create("queue.enabled", false, CVar.SERVERONLY); | ||
|
||
public static readonly CVarDef<bool> | ||
QueueAltEnabled = CVarDef.Create("queue.alt_servers", false, CVar.SERVERONLY); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Robust.Shared.Configuration; | ||
|
||
namespace Content.Shared.Backmen.CCVar; | ||
|
||
public sealed partial class CCVars | ||
{ | ||
public static readonly CVarDef<bool> MoodEnabled = | ||
CVarDef.Create("mood.enabled", true, CVar.SERVER | CVar.REPLICATED); | ||
|
||
public static readonly CVarDef<bool> MoodIncreasesSpeed = | ||
CVarDef.Create("mood.increases_speed", false, CVar.SERVERONLY); | ||
|
||
public static readonly CVarDef<bool> MoodDecreasesSpeed = | ||
CVarDef.Create("mood.decreases_speed", true, CVar.SERVERONLY); | ||
|
||
public static readonly CVarDef<bool> MoodModifiesThresholds = | ||
CVarDef.Create("mood.modify_thresholds", false, CVar.SERVERONLY); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Robust.Shared.Configuration; | ||
|
||
namespace Content.Shared.Backmen.CCVar; | ||
|
||
public sealed partial class CCVars | ||
{ | ||
/** | ||
* Sponsors | ||
*/ | ||
|
||
/// <summary> | ||
/// URL of the sponsors server API. | ||
/// </summary> | ||
public static readonly CVarDef<string> SponsorsApiUrl = | ||
CVarDef.Create("sponsor.api_url", "", CVar.SERVERONLY); | ||
|
||
public static readonly CVarDef<string> SponsorsSelectedGhost = | ||
CVarDef.Create("sponsor.ghost", "", CVar.REPLICATED | CVar.CLIENT | CVar.ARCHIVE); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using Robust.Shared.Configuration; | ||
|
||
namespace Content.Shared.Backmen.CCVar; | ||
|
||
public sealed partial class CCVars | ||
{ | ||
/// <summary> | ||
/// With completely default supermatter values, Singuloose delamination will occur if engineers inject at least 900 moles of coolant per tile | ||
/// in the crystal chamber. For reference, a gas canister contains 1800 moles of air. This Cvar directly multiplies the amount of moles required to singuloose. | ||
/// </summary> | ||
public static readonly CVarDef<float> SupermatterSingulooseMolesModifier = | ||
CVarDef.Create("supermatter.singuloose_moles_modifier", 1f, CVar.SERVER); | ||
|
||
/// <summary> | ||
/// Toggles whether or not Singuloose delaminations can occur. If both Singuloose and Tesloose are disabled, it will always delam into a Nuke. | ||
/// </summary> | ||
public static readonly CVarDef<bool> SupermatterDoSingulooseDelam = | ||
CVarDef.Create("supermatter.do_singuloose", true, CVar.SERVER); | ||
|
||
/// <summary> | ||
/// By default, Supermatter will "Tesloose" if the conditions for Singuloose are not met, and the core's power is at least 4000. | ||
/// The actual reasons for being at least this amount vary by how the core was screwed up, but traditionally it's caused by "The core is on fire". | ||
/// This Cvar multiplies said power threshold for the purpose of determining if the delam is a Tesloose. | ||
/// </summary> | ||
public static readonly CVarDef<float> SupermatterTesloosePowerModifier = | ||
CVarDef.Create("supermatter.tesloose_power_modifier", 1f, CVar.SERVER); | ||
|
||
/// <summary> | ||
/// Toggles whether or not Tesloose delaminations can occur. If both Singuloose and Tesloose are disabled, it will always delam into a Nuke. | ||
/// </summary> | ||
public static readonly CVarDef<bool> SupermatterDoTeslooseDelam = | ||
CVarDef.Create("supermatter.do_tesloose", true, CVar.SERVER); | ||
|
||
/// <summary> | ||
/// When true, bypass the normal checks to determine delam type, and instead use the type chosen by supermatter.forced_delam_type | ||
/// </summary> | ||
public static readonly CVarDef<bool> SupermatterDoForceDelam = | ||
CVarDef.Create("supermatter.do_force_delam", false, CVar.SERVER); | ||
|
||
/// <summary> | ||
/// If supermatter.do_force_delam is true, this determines the delamination type, bypassing the normal checks. | ||
/// </summary> | ||
public static readonly CVarDef<string> SupermatterForcedDelamType = | ||
CVarDef.Create("supermatter.forced_delam_type", "Singulo", CVar.SERVER); | ||
|
||
/// <summary> | ||
/// Directly multiplies the amount of rads put out by the supermatter. Be VERY conservative with this. | ||
/// </summary> | ||
public static readonly CVarDef<float> SupermatterRadsModifier = | ||
CVarDef.Create("supermatter.rads_modifier", 1f, CVar.SERVER); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using Robust.Shared.Configuration; | ||
|
||
namespace Content.Shared.Backmen.CCVar; | ||
|
||
public sealed partial class CCVars | ||
{ | ||
|
||
public static readonly CVarDef<bool> CanOperateOnSelf = | ||
CVarDef.Create("surgery.can_operate_on_self", false, CVar.SERVERONLY); | ||
} |
Oops, something went wrong.