diff --git a/Content.Server/Fax/FaxMachineComponent.cs b/Content.Server/Fax/FaxMachineComponent.cs index c9de7e68f10..a189bdc05ac 100644 --- a/Content.Server/Fax/FaxMachineComponent.cs +++ b/Content.Server/Fax/FaxMachineComponent.cs @@ -52,10 +52,9 @@ public sealed partial class FaxMachineComponent : Component public bool ReceiveNukeCodes { get; set; } = false; /// - /// Should that fax receive station goal info + /// Should this fax receive station goals /// - [ViewVariables(VVAccess.ReadWrite)] - [DataField("receiveStationGoal")] + [DataField] public bool ReceiveStationGoal { get; set; } = false; /// diff --git a/Content.Server/StationGoal/StationGoalPaperComponent.cs b/Content.Server/StationGoal/StationGoalPaperComponent.cs index a785ef1e377..445b4746818 100644 --- a/Content.Server/StationGoal/StationGoalPaperComponent.cs +++ b/Content.Server/StationGoal/StationGoalPaperComponent.cs @@ -4,8 +4,6 @@ namespace Content.Server.StationGoal /// Paper with a written station goal in it. /// [RegisterComponent] - public sealed partial class StationGoalPaperComponent : Component - { - } + public sealed partial class StationGoalPaperComponent : Component { } } diff --git a/Content.Server/StationGoal/StationGoalPaperSystem.cs b/Content.Server/StationGoal/StationGoalPaperSystem.cs index 18b5fa2c7b1..fc1e9490bce 100644 --- a/Content.Server/StationGoal/StationGoalPaperSystem.cs +++ b/Content.Server/StationGoal/StationGoalPaperSystem.cs @@ -39,22 +39,16 @@ public override void Initialize() private void OnRoundStarted(RoundStartedEvent ev) { - if (_config.GetCVar(CCVars.StationGoalsEnabled)) - { - if (_config.GetCVar(CCVars.StationGoalsRandomNoGoal) && _random.Prob(0.1f)) - { - if (_random.Prob(0.1f)) - SendRandomGoal(); - } - else SendRandomGoal(); - } + if (_config.GetCVar(CCVars.StationGoalsEnabled) + && _random.Prob(_config.GetCVar(CCVars.StationGoalsChance))) + SendRandomGoal(); } /// /// Send a random station goal to all faxes which are authorized to receive it /// /// If the fax was successful - /// Raised when station goal types in the prototype is invalid + /// Raised when station goal types in the prototype is invalid public bool SendRandomGoal() { // Get the random station goal list @@ -81,7 +75,7 @@ private StationGoalPrototype RecursiveRandom(WeightedRandomPrototype random) if (_prototype.TryIndex(goal, out var goalRandom)) return RecursiveRandom(goalRandom); - throw new Exception($"StationGoalPaperSystem: Random station goal could not be found from origin prototype {RandomPrototype}"); + throw new Exception($"StationGoalPaperSystem: Random station goal could not be found from prototypes {RandomPrototype} and {random.ID}"); } /// @@ -95,8 +89,8 @@ public bool SendStationGoal(StationGoalPrototype goal) while (enumerator.MoveNext(out var uid, out var fax)) { - if (!fax.ReceiveStationGoal || - !TryComp(_station.GetOwningStation(uid), out var meta)) + if (!fax.ReceiveStationGoal + || !TryComp(_station.GetOwningStation(uid), out var meta)) continue; var stationId = StationIdRegex.Match(meta.EntityName).Groups[1].Value; diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index 5e519ffd090..010dbcaa648 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -2114,9 +2114,9 @@ public static readonly CVarDef CVarDef.Create("game.station_goals", true, CVar.SERVERONLY); /// - /// If enabled, station goals have a 10% chance to not generate + /// Chance for a station goal to be sent /// - public static readonly CVarDef StationGoalsRandomNoGoal = - CVarDef.Create("game.station_goals_random_none", false, CVar.SERVERONLY); + public static readonly CVarDef StationGoalsChance = + CVarDef.Create("game.station_goals_chance", 0.1f, CVar.SERVERONLY); } } diff --git a/Resources/Prototypes/Entities/Objects/Misc/paper.yml b/Resources/Prototypes/Entities/Objects/Misc/paper.yml index de0033c94c0..c1a5d9a1bfd 100644 --- a/Resources/Prototypes/Entities/Objects/Misc/paper.yml +++ b/Resources/Prototypes/Entities/Objects/Misc/paper.yml @@ -258,8 +258,8 @@ - type: entity parent: Paper id: StationGoalPaper - name: station goal centcomm message - description: 'It looks like you have a lot of work to do.' + name: station goal + description: It looks like you have a lot of work to do. components: - type: Paper stampState: paper_stamp-centcom diff --git a/Resources/Prototypes/Objectives/goals.yml b/Resources/Prototypes/Objectives/goals.yml index 19465be8792..59e35ea8a51 100644 --- a/Resources/Prototypes/Objectives/goals.yml +++ b/Resources/Prototypes/Objectives/goals.yml @@ -40,6 +40,7 @@ - type: stationGoal id: Zoo + - type: weightedRandom id: StationGoals weights: