2023-04-25 20:23:14 -04:00
|
|
|
using Robust.Server.GameObjects;
|
|
|
|
|
using Robust.Server.Maps;
|
|
|
|
|
using Content.Server.GameTicking.Rules.Components;
|
|
|
|
|
using Content.Server.StationEvents.Components;
|
2023-09-25 02:16:33 +06:00
|
|
|
using Content.Server.RoundEnd;
|
2023-04-25 20:23:14 -04:00
|
|
|
|
|
|
|
|
namespace Content.Server.StationEvents.Events;
|
|
|
|
|
|
|
|
|
|
public sealed class LoneOpsSpawnRule : StationEventSystem<LoneOpsSpawnRuleComponent>
|
|
|
|
|
{
|
|
|
|
|
[Dependency] private readonly MapLoaderSystem _map = default!;
|
|
|
|
|
|
|
|
|
|
protected override void Started(EntityUid uid, LoneOpsSpawnRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args)
|
|
|
|
|
{
|
|
|
|
|
base.Started(uid, component, gameRule, args);
|
|
|
|
|
|
Refactor antag rule code (#23445)
* Initial Pass, Rev, Thief
* Zombie initial pass
* Rebase, Traitor
* Nukeops, More overloads
* Revert RevolutionaryRuleComponent
* Use TryRoundStartAttempt, Rewrite nukie spawning
* Comments, Add task scheduler to GameRuleSystem
* Zombie initial testing done
* Sort methods, rework GameRuleTask
* Add CCVar, Initial testing continues
* Might as well get rid of the obsolete logging
* Oops, i dont know how to log apparently
* Suggested formatting fixes
* Suggested changes
* Fix merge issues
* Minor optimisation
* Allowed thief to choose other antags
* Review changes
* Spawn items on floor first, then inserting
* minor tweaks
* Shift as much as possible to ProtoId<>
* Remove unneeded
* Add exclusive antag attribute
* Fix merge issues
* Minor formatting fix
* Convert to struct
* Cleanup
* Review cleanup (need to test a lot)
* Some fixes, (mostly) tested
* oop
* Pass tests (for real)
---------
Co-authored-by: Rainfall <rainfey0+git@gmail.com>
Co-authored-by: AJCM <AJCM@tutanota.com>
2024-02-29 06:25:10 +00:00
|
|
|
// Loneops can only spawn if there is no nukeops active
|
|
|
|
|
if (GameTicker.IsGameRuleAdded<NukeopsRuleComponent>())
|
2023-04-28 23:14:15 -04:00
|
|
|
{
|
|
|
|
|
ForceEndSelf(uid, gameRule);
|
2023-04-25 20:23:14 -04:00
|
|
|
return;
|
2023-04-28 23:14:15 -04:00
|
|
|
}
|
2023-04-25 20:23:14 -04:00
|
|
|
|
Refactor antag rule code (#23445)
* Initial Pass, Rev, Thief
* Zombie initial pass
* Rebase, Traitor
* Nukeops, More overloads
* Revert RevolutionaryRuleComponent
* Use TryRoundStartAttempt, Rewrite nukie spawning
* Comments, Add task scheduler to GameRuleSystem
* Zombie initial testing done
* Sort methods, rework GameRuleTask
* Add CCVar, Initial testing continues
* Might as well get rid of the obsolete logging
* Oops, i dont know how to log apparently
* Suggested formatting fixes
* Suggested changes
* Fix merge issues
* Minor optimisation
* Allowed thief to choose other antags
* Review changes
* Spawn items on floor first, then inserting
* minor tweaks
* Shift as much as possible to ProtoId<>
* Remove unneeded
* Add exclusive antag attribute
* Fix merge issues
* Minor formatting fix
* Convert to struct
* Cleanup
* Review cleanup (need to test a lot)
* Some fixes, (mostly) tested
* oop
* Pass tests (for real)
---------
Co-authored-by: Rainfall <rainfey0+git@gmail.com>
Co-authored-by: AJCM <AJCM@tutanota.com>
2024-02-29 06:25:10 +00:00
|
|
|
var shuttleMap = MapManager.CreateMap();
|
2023-04-25 20:23:14 -04:00
|
|
|
var options = new MapLoadOptions
|
|
|
|
|
{
|
|
|
|
|
LoadMap = true,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
_map.TryLoad(shuttleMap, component.LoneOpsShuttlePath, out _, options);
|
|
|
|
|
|
Refactor antag rule code (#23445)
* Initial Pass, Rev, Thief
* Zombie initial pass
* Rebase, Traitor
* Nukeops, More overloads
* Revert RevolutionaryRuleComponent
* Use TryRoundStartAttempt, Rewrite nukie spawning
* Comments, Add task scheduler to GameRuleSystem
* Zombie initial testing done
* Sort methods, rework GameRuleTask
* Add CCVar, Initial testing continues
* Might as well get rid of the obsolete logging
* Oops, i dont know how to log apparently
* Suggested formatting fixes
* Suggested changes
* Fix merge issues
* Minor optimisation
* Allowed thief to choose other antags
* Review changes
* Spawn items on floor first, then inserting
* minor tweaks
* Shift as much as possible to ProtoId<>
* Remove unneeded
* Add exclusive antag attribute
* Fix merge issues
* Minor formatting fix
* Convert to struct
* Cleanup
* Review cleanup (need to test a lot)
* Some fixes, (mostly) tested
* oop
* Pass tests (for real)
---------
Co-authored-by: Rainfall <rainfey0+git@gmail.com>
Co-authored-by: AJCM <AJCM@tutanota.com>
2024-02-29 06:25:10 +00:00
|
|
|
var nukeopsEntity = GameTicker.AddGameRule(component.GameRuleProto);
|
2023-04-25 20:23:14 -04:00
|
|
|
component.AdditionalRule = nukeopsEntity;
|
Refactor antag rule code (#23445)
* Initial Pass, Rev, Thief
* Zombie initial pass
* Rebase, Traitor
* Nukeops, More overloads
* Revert RevolutionaryRuleComponent
* Use TryRoundStartAttempt, Rewrite nukie spawning
* Comments, Add task scheduler to GameRuleSystem
* Zombie initial testing done
* Sort methods, rework GameRuleTask
* Add CCVar, Initial testing continues
* Might as well get rid of the obsolete logging
* Oops, i dont know how to log apparently
* Suggested formatting fixes
* Suggested changes
* Fix merge issues
* Minor optimisation
* Allowed thief to choose other antags
* Review changes
* Spawn items on floor first, then inserting
* minor tweaks
* Shift as much as possible to ProtoId<>
* Remove unneeded
* Add exclusive antag attribute
* Fix merge issues
* Minor formatting fix
* Convert to struct
* Cleanup
* Review cleanup (need to test a lot)
* Some fixes, (mostly) tested
* oop
* Pass tests (for real)
---------
Co-authored-by: Rainfall <rainfey0+git@gmail.com>
Co-authored-by: AJCM <AJCM@tutanota.com>
2024-02-29 06:25:10 +00:00
|
|
|
var nukeopsComp = Comp<NukeopsRuleComponent>(nukeopsEntity);
|
2023-04-25 20:23:14 -04:00
|
|
|
nukeopsComp.SpawnOutpost = false;
|
2023-09-25 02:16:33 +06:00
|
|
|
nukeopsComp.RoundEndBehavior = RoundEndBehavior.Nothing;
|
Refactor antag rule code (#23445)
* Initial Pass, Rev, Thief
* Zombie initial pass
* Rebase, Traitor
* Nukeops, More overloads
* Revert RevolutionaryRuleComponent
* Use TryRoundStartAttempt, Rewrite nukie spawning
* Comments, Add task scheduler to GameRuleSystem
* Zombie initial testing done
* Sort methods, rework GameRuleTask
* Add CCVar, Initial testing continues
* Might as well get rid of the obsolete logging
* Oops, i dont know how to log apparently
* Suggested formatting fixes
* Suggested changes
* Fix merge issues
* Minor optimisation
* Allowed thief to choose other antags
* Review changes
* Spawn items on floor first, then inserting
* minor tweaks
* Shift as much as possible to ProtoId<>
* Remove unneeded
* Add exclusive antag attribute
* Fix merge issues
* Minor formatting fix
* Convert to struct
* Cleanup
* Review cleanup (need to test a lot)
* Some fixes, (mostly) tested
* oop
* Pass tests (for real)
---------
Co-authored-by: Rainfall <rainfey0+git@gmail.com>
Co-authored-by: AJCM <AJCM@tutanota.com>
2024-02-29 06:25:10 +00:00
|
|
|
GameTicker.StartGameRule(nukeopsEntity);
|
2023-04-25 20:23:14 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Ended(EntityUid uid, LoneOpsSpawnRuleComponent component, GameRuleComponent gameRule, GameRuleEndedEvent args)
|
|
|
|
|
{
|
|
|
|
|
base.Ended(uid, component, gameRule, args);
|
|
|
|
|
|
|
|
|
|
if (component.AdditionalRule != null)
|
|
|
|
|
GameTicker.EndGameRule(component.AdditionalRule.Value);
|
|
|
|
|
}
|
|
|
|
|
}
|