-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/Simple-Station/Parkstatio…
…n-Friendly-Chainsaw into shadowkin
- Loading branch information
Showing
17 changed files
with
610 additions
and
25 deletions.
There are no files selected for viewing
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
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,13 @@ | ||
namespace Content.Server.Corvax.GameTicking; | ||
|
||
public sealed class RoundEndedEvent : EntityEventArgs | ||
{ | ||
public int RoundId { get; } | ||
public TimeSpan RoundDuration { get; } | ||
|
||
public RoundEndedEvent(int roundId, TimeSpan roundDuration) | ||
{ | ||
RoundId = roundId; | ||
RoundDuration = roundDuration; | ||
} | ||
} |
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,11 @@ | ||
namespace Content.Server.Corvax.GameTicking; | ||
|
||
public sealed class RoundStartedEvent : EntityEventArgs | ||
{ | ||
public int RoundId { get; } | ||
|
||
public RoundStartedEvent(int roundId) | ||
{ | ||
RoundId = roundId; | ||
} | ||
} |
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,55 @@ | ||
using System.Linq; | ||
using Content.Server.Administration; | ||
using Content.Shared.Administration; | ||
using Robust.Shared.Console; | ||
using Robust.Shared.Prototypes; | ||
|
||
namespace Content.Server.Corvax.StationGoal | ||
{ | ||
[AdminCommand(AdminFlags.Fun)] | ||
public sealed class StationGoalCommand : IConsoleCommand | ||
{ | ||
public string Command => "sendstationgoal"; | ||
public string Description => Loc.GetString("send-station-goal-command-description"); | ||
public string Help => Loc.GetString("send-station-goal-command-help-text", ("command", Command)); | ||
|
||
public void Execute(IConsoleShell shell, string argStr, string[] args) | ||
{ | ||
if (args.Length != 1) | ||
{ | ||
shell.WriteError(Loc.GetString("shell-need-exactly-one-argument")); | ||
return; | ||
} | ||
|
||
var protoId = args[0]; | ||
var prototypeManager = IoCManager.Resolve<IPrototypeManager>(); | ||
if (!prototypeManager.TryIndex<StationGoalPrototype>(protoId, out var proto)) | ||
{ | ||
shell.WriteError(Loc.GetString("send-station-goal-command-error-no-goal-proto", ("id", protoId))); | ||
return; | ||
} | ||
|
||
var stationGoalPaper = IoCManager.Resolve<IEntityManager>().System<StationGoalPaperSystem>(); | ||
if (!stationGoalPaper.SendStationGoal(proto)) | ||
{ | ||
shell.WriteError(Loc.GetString("send-station-goal-command-error-couldnt-fax")); | ||
return; | ||
} | ||
} | ||
|
||
public CompletionResult GetCompletion(IConsoleShell shell, string[] args) | ||
{ | ||
if (args.Length == 1) | ||
{ | ||
var options = IoCManager.Resolve<IPrototypeManager>() | ||
.EnumeratePrototypes<StationGoalPrototype>() | ||
.OrderBy(p => p.ID) | ||
.Select(p => new CompletionOption(p.ID)); | ||
|
||
return CompletionResult.FromHintOptions(options, Loc.GetString("send-station-goal-command-arg-id")); | ||
} | ||
|
||
return CompletionResult.Empty; | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Content.Server/Corvax/StationGoal/StationGoalPaperComponent.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,11 @@ | ||
namespace Content.Server.Corvax.StationGoal | ||
{ | ||
/// <summary> | ||
/// Paper with a written station goal in it. | ||
/// </summary> | ||
[RegisterComponent] | ||
public sealed partial class StationGoalPaperComponent : Component | ||
{ | ||
} | ||
} | ||
|
113 changes: 113 additions & 0 deletions
113
Content.Server/Corvax/StationGoal/StationGoalPaperSystem.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,113 @@ | ||
using System.Data; | ||
using System.Text.RegularExpressions; | ||
using Content.Server.Corvax.GameTicking; | ||
using Content.Server.Fax; | ||
using Content.Server.Station.Systems; | ||
using Content.Shared.Corvax.CCCVars; | ||
using Content.Shared.Random; | ||
using Content.Shared.Random.Helpers; | ||
using Robust.Shared.Configuration; | ||
using Robust.Shared.Prototypes; | ||
using Robust.Shared.Random; | ||
|
||
namespace Content.Server.Corvax.StationGoal; | ||
|
||
/// <summary> | ||
/// System for station goals | ||
/// </summary> | ||
public sealed class StationGoalPaperSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly IPrototypeManager _prototype = default!; | ||
[Dependency] private readonly IRobustRandom _random = default!; | ||
[Dependency] private readonly FaxSystem _fax = default!; | ||
[Dependency] private readonly IConfigurationManager _config = default!; | ||
[Dependency] private readonly StationSystem _station = default!; | ||
|
||
private static readonly Regex StationIdRegex = new(@".*-(\d+)$"); | ||
|
||
private const string RandomPrototype = "StationGoals"; | ||
|
||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<RoundStartedEvent>(OnRoundStarted); | ||
} | ||
|
||
|
||
private void OnRoundStarted(RoundStartedEvent ev) | ||
{ | ||
if (_config.GetCVar(CCCVars.StationGoalsEnabled)) | ||
SendRandomGoal(); | ||
} | ||
|
||
/// <summary> | ||
/// Send a random station goal to all faxes which are authorized to receive it | ||
/// </summary> | ||
/// <returns>If the fax was successful</returns> | ||
/// <exception cref="ConstraintException">Raised when station goal types in the prototype is invalid</exception> | ||
public bool SendRandomGoal() | ||
{ | ||
// Get the random station goal list | ||
if (!_prototype.TryIndex<WeightedRandomPrototype>(RandomPrototype, out var goals)) | ||
{ | ||
Log.Error($"StationGoalPaperSystem: Random station goal prototype '{RandomPrototype}' not found"); | ||
return false; | ||
} | ||
|
||
// Get a random goal | ||
var goal = RecursiveRandom(goals); | ||
|
||
// Send the goal | ||
return SendStationGoal(goal); | ||
} | ||
|
||
private StationGoalPrototype RecursiveRandom(WeightedRandomPrototype random) | ||
{ | ||
var goal = random.Pick(_random); | ||
|
||
if (_prototype.TryIndex<StationGoalPrototype>(goal, out var goalPrototype)) | ||
return goalPrototype; | ||
|
||
if (_prototype.TryIndex<WeightedRandomPrototype>(goal, out var goalRandom)) | ||
return RecursiveRandom(goalRandom); | ||
|
||
throw new Exception($"StationGoalPaperSystem: Random station goal could not be found from origin prototype {RandomPrototype}"); | ||
} | ||
|
||
/// <summary> | ||
/// Send a station goal to all faxes which are authorized to receive it | ||
/// </summary> | ||
/// <returns>True if at least one fax received paper</returns> | ||
public bool SendStationGoal(StationGoalPrototype goal) | ||
{ | ||
var enumerator = EntityManager.EntityQueryEnumerator<FaxMachineComponent>(); | ||
var wasSent = false; | ||
|
||
while (enumerator.MoveNext(out var uid, out var fax)) | ||
{ | ||
if (!fax.ReceiveStationGoal || | ||
!TryComp<MetaDataComponent>(_station.GetOwningStation(uid), out var meta)) | ||
continue; | ||
|
||
var stationId = StationIdRegex.Match(meta.EntityName).Groups[1].Value; | ||
|
||
var printout = new FaxPrintout( | ||
Loc.GetString("station-goal-fax-paper-header", | ||
("date", DateTime.Now.AddYears(1000).ToString("yyyy MMMM dd")), | ||
("station", string.IsNullOrEmpty(stationId) ? "???" : stationId), | ||
("content", goal.Text) | ||
), | ||
Loc.GetString("station-goal-fax-paper-name"), | ||
"StationGoalPaper" | ||
); | ||
|
||
_fax.Receive(uid, printout, null, fax); | ||
|
||
wasSent = true; | ||
} | ||
|
||
return wasSent; | ||
} | ||
} |
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,12 @@ | ||
using Robust.Shared.Prototypes; | ||
|
||
namespace Content.Server.Corvax.StationGoal | ||
{ | ||
[Serializable, Prototype("stationGoal")] | ||
public sealed class StationGoalPrototype : IPrototype | ||
{ | ||
[IdDataFieldAttribute] public string ID { get; } = default!; | ||
|
||
public string Text => Loc.GetString($"station-goal-{ID.ToLower()}"); | ||
} | ||
} |
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
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
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.Corvax.CCCVars; | ||
|
||
[CVarDefs] | ||
// ReSharper disable once InconsistentNaming | ||
public sealed class CCCVars | ||
{ | ||
/* | ||
* Station Goals | ||
*/ | ||
|
||
/// <summary> | ||
/// Enables station goals | ||
/// </summary> | ||
public static readonly CVarDef<bool> StationGoalsEnabled = | ||
CVarDef.Create("game.station_goals", 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 |
---|---|---|
@@ -1,43 +1,54 @@ | ||
<p align="center"> <img alt="Space Station 14 Delta-V Logo" width="128" height="128" src="https://raw.githubusercontent.com/DeltaV-Station/Delta-v/master/Resources/Textures/Logo/logo.png" /></p> | ||
<!---<p align="center"> <img alt="Space Station 14 Delta-V Banner" width="512" height="126" src="https://raw.githubusercontent.com/DeltaV-Station/Delta-v/master/Resources/Textures/Logo/banner.png" /></p>--> | ||
# Parkstation | ||
|
||
Delta-V is a fork of [Space Station 14](https://github.com/space-wizards/space-station-14), embracing a mixture of classic SS13 chaos and experimentation only possible with the new engine. | ||
|
||
Space Station 14 is a remake of SS13 that runs on [Robust Toolbox](https://github.com/space-wizards/RobustToolbox), a homegrown engine written in C#. | ||
|
||
### Delta-V is a continuation of the [Nyanotrasen](https://www.nyanotrasen.moe/) fork. Any work done in a non-base namespace may contain incorrect attributes due to rewrites and recommitting. | ||
![GithubAction](https://github.com/Simple-Station/Parkstation-Friendly-Chainsaw/actions/workflows/changelog.yml/badge.svg) | ||
![GithubAction](https://github.com/Simple-Station/Parkstation-Friendly-Chainsaw/actions/workflows/yaml-linter.yml/badge.svg) | ||
![GithubAction](https://github.com/Simple-Station/Parkstation-Friendly-Chainsaw/actions/workflows/validate-rgas.yml/badge.svg) | ||
![GithubAction](https://github.com/Simple-Station/Parkstation-Friendly-Chainsaw/actions/workflows/validate_mapfiles.yml/badge.svg) | ||
![GithubAction](https://github.com/Simple-Station/Parkstation-Friendly-Chainsaw/actions/workflows/build-test-debug.yml/badge.svg) | ||
![GithubAction](https://github.com/Simple-Station/Parkstation-Friendly-Chainsaw/actions/workflows/build-test-release.yml/badge.svg) | ||
![GithubAction](https://github.com/Simple-Station/Parkstation-Friendly-Chainsaw/actions/workflows/test-packaging.yml/badge.svg) | ||
|
||
## Links | ||
|
||
#### DeltaV | ||
[Website](https://delta-v.org/) | [Wiki](https://wiki.delta-v.org/view/Main_Page) | [Discord](https://discord.gg/BRCBAxw65X) | ||
[Discord](https://discord.gg/49KeKwXc8g) | [Steam](https://store.steampowered.com/app/2585480/Space_Station_Multiverse/) | [Standalone](https://spacestationmultiverse.com/downloads/) | ||
|
||
#### Space Station 14 | ||
## Contributing | ||
|
||
[Website](https://spacestation14.io/) | [Discord](https://discord.ss14.io/) | [Forum](https://forum.spacestation14.io/) | [Steam](https://store.steampowered.com/app/1255460/Space_Station_14/) | [Standalone Download](https://spacestation14.io/about/nightlies/) | ||
We are happy to accept contributions from anybody. Get in Discord if you want to help. We've got a [list of issues](https://github.com/orgs/Park-Station/projects/1/views/1) that need to be done and anybody can pick them up. Don't be afraid to ask for help either! | ||
|
||
## Documentation/Wiki | ||
## Building | ||
|
||
The [docs site](https://docs.spacestation14.io/) has documentation on SS14s content, engine, game design and more. It has lots of resources for new contributors to the project. | ||
Refer to [the Space Wizards'](https://docs.spacestation14.com/en/general-development/setup/setting-up-a-development-environment.html) guide on setting up a development environment for general information, but keep in mind that Parkstation is a distant fork of Space Wizards' SS14 and not everything applies. We provide some scripts for making the job easier. | ||
|
||
## Contributing | ||
### Build dependencies | ||
|
||
We are happy to accept contributions from anybody. Get in Discord if you want to help. We've got a [list of issues](https://github.com/DeltaV-Station/Delta-v/issues) that need to be done and anybody can pick them up. Don't be afraid to ask for help either! | ||
> - Git | ||
> - .NET SDK 7.0 or higher | ||
> - python 3.7 or higher | ||
We are currently accepting translations of the game on our main repository. If you would like to translate the game into another language check the #localization channel in our [Discord](https://discord.gg/BRCBAxw65Xo) | ||
|
||
## Building | ||
### Windows | ||
|
||
> 1. Clone this repository. | ||
> 2. Run `RUN_THIS.py` to init submodules and download the engine, or run `git submodule update --init --recursive` in a terminal. | ||
> 3. Run the `Scripts/bat/run1buildDebug.bat` | ||
> 4. Run the `Scripts/bat/run2configDev.bat` if you need other configurations run other config scripts. | ||
> 5. Run both the `Scripts/bat/run3server.bat` and `Scripts/bat/run4client.bat` | ||
> 6. Connect to localhost and play. | ||
1. Clone this repo. | ||
2. Run `RUN_THIS.py` to init submodules and download the engine. | ||
3. Compile the solution. | ||
### Linux | ||
|
||
[More detailed instructions on building the project.](https://docs.spacestation14.com/en/general-development/setup.html) | ||
> 1. Clone this repository. | ||
> 2. Run `RUN_THIS.py` to init submodules and download the engine, or run `git submodule update --init --recursive` in a terminal. | ||
> 3. Run the `Scripts/sh/run1buildDebug.sh` | ||
> 4. Run the `Scripts/sh/run2configDev.sh` if you need other configurations run other config scripts. | ||
> 5. Run both the `Scripts/sh/run3server.bat` and `scripts/sh/run4client.sh` | ||
> 6. Connect to localhost and play. | ||
## License | ||
|
||
All code for the content repository is licensed under [MIT](https://github.com/DeltaV-Station/Delta-v/blob/master/LICENSE.TXT). | ||
All code for the content repository is licensed under [MIT](https://github.com/Simple-Station/Parkstation-Friendly-Chainsaw/blob/master/LICENSE.TXT). | ||
|
||
Most assets are licensed under [CC-BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/) unless stated otherwise. Assets have their license and the copyright in the metadata file. [Example](https://github.com/DeltaV-Station/Delta-v/blob/master/Resources/Textures/Objects/Tools/crowbar.rsi/meta.json). | ||
Most assets are licensed under [CC-BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/) unless stated otherwise. Assets have their license and the copyright in the metadata file. [Example](https://github.com/Simple-Station/Parkstation-Friendly-Chainsaw/blob/master/Resources/Textures/Objects/Tools/crowbar.rsi/meta.json). | ||
|
||
Note that some assets are licensed under the non-commercial [CC-BY-NC-SA 3.0](https://creativecommons.org/licenses/by-nc-sa/3.0/) or similar non-commercial licenses and will need to be removed if you wish to use this project commercially. |
6 changes: 6 additions & 0 deletions
6
Resources/Locale/en-US/corvax/station-goal/station-goal-command.ftl
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,6 @@ | ||
send-station-goal-command-description = Sends the selected station target to all faxes that can receive it | ||
send-station-goal-command-help-text = Usage: { $command } <Goal Prototype ID> | ||
send-station-goal-command-arg-id = Goal Prototype ID | ||
send-station-goal-command-error-no-goal-proto = No station goal found with ID {$id} | ||
send-station-goal-command-error-couldnt-fax = Couldn't send station goal, probably due to a lack of fax machines that are able to recieve it |
Oops, something went wrong.