diff --git a/Content.Client/Antag/AntagStatusIconSystem.cs b/Content.Client/Antag/AntagStatusIconSystem.cs index 4e2468eea59..63fc434946a 100644 --- a/Content.Client/Antag/AntagStatusIconSystem.cs +++ b/Content.Client/Antag/AntagStatusIconSystem.cs @@ -29,6 +29,7 @@ public override void Initialize() SubscribeLocalEvent(GetIcon); SubscribeLocalEvent(GetIcon); SubscribeLocalEvent(GetIcon); + SubscribeLocalEvent(GetIcon); //end-backmen: antag SubscribeLocalEvent(GetIcon); } diff --git a/Content.Server/Backmen/ShipVsShip/ShipVsShipGame.cs b/Content.Server/Backmen/ShipVsShip/ShipVsShipGame.cs index fc26273e018..b26f70f946d 100644 --- a/Content.Server/Backmen/ShipVsShip/ShipVsShipGame.cs +++ b/Content.Server/Backmen/ShipVsShip/ShipVsShipGame.cs @@ -11,6 +11,7 @@ using Content.Server.Shuttles.Components; using Content.Server.Shuttles.Events; using Content.Server.Shuttles.Systems; +using Content.Server.Spawners.Components; using Content.Server.Station.Components; using Content.Server.Station.Systems; using Content.Shared.Backmen.ShipVsShip; @@ -22,10 +23,12 @@ using Content.Shared.Players; using Content.Shared.Roles; using Content.Shared.Roles.Jobs; +using Content.Shared.Timing; using Robust.Shared.Network; using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Random; +using Robust.Shared.Timing; using Robust.Shared.Utility; namespace Content.Server.Backmen.ShipVsShip; @@ -42,6 +45,8 @@ public sealed class ShipVsShipGame : GameRuleSystem [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly ShuttleConsoleSystem _console = default!; [Dependency] private readonly RoundEndSystem _endSystem = default!; + [Dependency] private readonly IGameTiming _gameTiming = default!; + [Dependency] private readonly SharedTransformSystem _transform = default!; public override void Initialize() { @@ -59,13 +64,62 @@ public override void Initialize() SubscribeLocalEvent(OnStartRound); SubscribeLocalEvent(OnRoundEndText); SubscribeLocalEvent(CanUseArrivals); + SubscribeLocalEvent(OnAfterSpawning); + } + + private void SetFlag(EntityUid ent, StationTeamMarker team) + { + var teamFlag = EnsureComp(ent); + teamFlag.Team = team; + teamFlag.StatusIcon = team switch + { + StationTeamMarker.TeamA => "TeamAFaction", + StationTeamMarker.TeamB => "TeamBFaction", + _ => "Team0Faction" + }; + Dirty(ent, teamFlag); + } + + private void OnAfterSpawning(PlayerSpawnCompleteEvent ev) + { + var activeRules = QueryActiveRules(); + + while (activeRules.MoveNext(out _, out var rule, out _)) + { + var xform = Transform(ev.Mob); + var team = rule.Players.FirstOrNull(x => x.Value.Contains(ev.Player.UserId))?.Key ?? StationTeamMarker.Neutral; + Log.Info($"Validate player spawning station {ev.Mob:entity} on {xform.GridUid:entity} (team: {team})"); + + + SetFlag(ev.Mob, team); + if (rule.Team.ContainsKey(team) && TryComp(rule.Team[team], out var stationDataComponent)) + { + var stationGrids = stationDataComponent.Grids; + if (xform.GridUid == null || stationGrids.Contains(xform.GridUid.Value)) + { + return; + } + var latejoin = (from s in EntityQuery() + where s.Item1.SpawnType == SpawnPointType.LateJoin && s.Item2.GridUid.HasValue && stationGrids.Contains(s.Item2.GridUid.Value) + select s.Item2.Coordinates).ToList(); + if (latejoin.Count == 0) + { + Log.Error($"not found late join for {team}"); + return; + } + + var point = RobustRandom.Pick(latejoin); + _transform.SetCoordinates(ev.Mob, point); + Log.Warning($"Invalid spawning station {ev.Mob:entity} on {xform.GridUid:entity} (team: {team}) do fixing, new grid = {point.EntityId:entity}"); + } + } } private void CanUseArrivals(CanHandleWithArrival ev) { var activeRules = QueryActiveRules(); - while (activeRules.MoveNext(out var ruleUid, out var r1, out var rule, out var r3)) + while (activeRules.MoveNext(out _, out _, out _)) { ev.Cancel(); } @@ -75,7 +129,7 @@ private void OnRoundEndText(RoundEndTextAppendEvent ev) { var activeRules = QueryActiveRules(); - while (activeRules.MoveNext(out var ruleUid, out var r1, out var rule, out var r3)) + while (activeRules.MoveNext(out _, out var rule, out _)) { ev.AddLine(Loc.GetString($"svs-team-{rule.Winner ?? StationTeamMarker.Neutral}-lose", ("target",rule.WinnerTarget ?? EntityUid.Invalid))); } @@ -87,7 +141,7 @@ private void OnStartRound(RoundStartedEvent ev) { var activeRules = QueryActiveRules(); - while (activeRules.MoveNext(out var ruleUid, out var r1, out var rule, out var r3)) + while (activeRules.MoveNext(out _, out var rule, out _)) { ScanForObjects(rule); } @@ -133,9 +187,9 @@ private void OnAfterFtl(ref FTLCompletedEvent ev) { var activeRules = QueryActiveRules(); - while (activeRules.MoveNext(out var ruleUid, out var r1, out var rule, out var r3)) + while (activeRules.MoveNext(out _, out _, out _)) { - EnsureComp(ev.Entity).Accumulator += 60 * 5; + EnsureComp(ev.Entity).StateTime = StartEndTime.FromCurTime(_gameTiming, 60 * 5); _console.RefreshShuttleConsoles(ev.Entity); } } @@ -234,12 +288,10 @@ private void OnBeforeSpawn(PlayerBeforeSpawnEvent ev) var mobMaybe = _stationSpawning.SpawnPlayerCharacterOnStation(rule.Team[team], job, ev.Profile); DebugTools.AssertNotNull(mobMaybe); var mob = mobMaybe!.Value; - + SetFlag(mob, team); _mind.TransferTo(newMind, mob); return; // invalid team? skip } - - } } diff --git a/Content.Shared/Backmen/ShipVsShip/SVSTeamMember.cs b/Content.Shared/Backmen/ShipVsShip/SVSTeamMember.cs new file mode 100644 index 00000000000..5d6b310e7b1 --- /dev/null +++ b/Content.Shared/Backmen/ShipVsShip/SVSTeamMember.cs @@ -0,0 +1,16 @@ +using Content.Shared.Antag; +using Content.Shared.StatusIcon; +using Robust.Shared.GameStates; +using Robust.Shared.Prototypes; + +namespace Content.Shared.Backmen.ShipVsShip; + +[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] +public sealed partial class SVSTeamMemberComponent : Component, IAntagStatusIconComponent +{ + [AutoNetworkedField] + public StationTeamMarker Team { get; set; } = StationTeamMarker.Neutral; + [AutoNetworkedField] + public ProtoId StatusIcon { get; set; } = "Team0Faction"; + public bool IconVisibleToGhost { get; set; } = true; +} diff --git a/Resources/Prototypes/Backmen/Catalog/Loadout/head.yml b/Resources/Prototypes/Backmen/Catalog/Loadout/head.yml index 07391ab5308..f47b5251683 100644 --- a/Resources/Prototypes/Backmen/Catalog/Loadout/head.yml +++ b/Resources/Prototypes/Backmen/Catalog/Loadout/head.yml @@ -1,7 +1,7 @@ - type: loadout id: ClothingHeadHatFlowerCrownLoadout - entity: ClothingHeadHatFlowerCrown + entity: ClothingHeadHatFlowerWreath -- type: loadout - id: ClothingHeadHatHairflowerLoadout - entity: ClothingHeadHatHairflower +#- type: loadout +# id: ClothingHeadHatHairflowerLoadout +# entity: ClothingHeadHatHairflower diff --git a/Resources/Prototypes/Backmen/Entities/Markers/Spawners/Random/hats.yml b/Resources/Prototypes/Backmen/Entities/Markers/Spawners/Random/hats.yml index 213df719290..add0d7bb815 100644 --- a/Resources/Prototypes/Backmen/Entities/Markers/Spawners/Random/hats.yml +++ b/Resources/Prototypes/Backmen/Entities/Markers/Spawners/Random/hats.yml @@ -19,7 +19,6 @@ - ClothingHeadHatXmasCrown - ClothingHeadHelmetCosmonaut - ClothingHeadHelmetBasic - - ClothingHeadHelmetScaf - ClothingHeadHelmetTemplar - ClothingHeadHelmetThunderdome - ClothingHeadHelmetFire @@ -28,7 +27,6 @@ - ClothingHeadHatHoodRad - ClothingHeadHatCake - ClothingHeadHatChickenhead - - ClothingHeadHatHairflower - ClothingHeadHatPumpkin - ClothingHeadHatRichard - ClothingHeadHatShrineMaidenWig @@ -72,7 +70,7 @@ - ClothingHeadFishCap - ClothingHeadRastaHat - ClothingHeadSafari - - ClothingHeadHatFlowerCrown + - ClothingHeadHatFlowerWreath - ClothingHeadHatCone - ClothingHeadHatBluesoft - ClothingHeadHatCorpsoftFlipped diff --git a/Resources/Prototypes/Backmen/Entities/Mobs/NPC/special.yml b/Resources/Prototypes/Backmen/Entities/Mobs/NPC/special.yml index 7921603a94c..8c6e33f2d57 100644 --- a/Resources/Prototypes/Backmen/Entities/Mobs/NPC/special.yml +++ b/Resources/Prototypes/Backmen/Entities/Mobs/NPC/special.yml @@ -53,7 +53,7 @@ - type: startingGear id: HecateStartingGear equipment: - hat: ClothingHeadHatHairflower + #hat: ClothingHeadHatHairflower jumpsuit: ClothingCostumeArcDress shoes: ClothingShoesColorBlack innerClothingSkirt: ClothingCostumeArcDress diff --git a/Resources/Prototypes/Backmen/Entities/Structures/Walls/walls.yml b/Resources/Prototypes/Backmen/Entities/Structures/Walls/walls.yml index b3555bd7c8d..bd8941b9839 100644 --- a/Resources/Prototypes/Backmen/Entities/Structures/Walls/walls.yml +++ b/Resources/Prototypes/Backmen/Entities/Structures/Walls/walls.yml @@ -34,7 +34,9 @@ - type: Tag tags: - Wall - - RCDDeconstructWhitelist + - type: RCDDeconstructable + cost: 6 + delay: 8 - type: entity parent: BaseWall diff --git a/Resources/Prototypes/Backmen/Entities/Structures/Webbing/Webbing/webs.yml b/Resources/Prototypes/Backmen/Entities/Structures/Webbing/Webbing/webs.yml index 2be8f3cd6fc..5589a712553 100644 --- a/Resources/Prototypes/Backmen/Entities/Structures/Webbing/Webbing/webs.yml +++ b/Resources/Prototypes/Backmen/Entities/Structures/Webbing/Webbing/webs.yml @@ -79,7 +79,7 @@ path: /Audio/Effects/plant_rustle.ogg unbuckleSound: !type:SoundPathSpecifier path: /Audio/Effects/plant_rustle.ogg - allowedEntities: + whitelist: components: - Arachne - type: HealOnBuckle diff --git a/Resources/Prototypes/Backmen/Statusicon/antag.yml b/Resources/Prototypes/Backmen/Statusicon/antag.yml index 3d9fb4ae0e0..d9badc84fb3 100644 --- a/Resources/Prototypes/Backmen/Statusicon/antag.yml +++ b/Resources/Prototypes/Backmen/Statusicon/antag.yml @@ -18,3 +18,27 @@ icon: sprite: /Textures/Backmen/Interface/Misc/antag_icon.rsi state: blob + + +#svs + +- type: statusIcon + id: Team0Faction + priority: 5 + icon: + sprite: /Textures/Backmen/Interface/Misc/svs_icon.rsi + state: team_0 + +- type: statusIcon + id: TeamAFaction + priority: 5 + icon: + sprite: /Textures/Backmen/Interface/Misc/svs_icon.rsi + state: team_a + +- type: statusIcon + id: TeamBFaction + priority: 5 + icon: + sprite: /Textures/Backmen/Interface/Misc/svs_icon.rsi + state: team_b diff --git a/Resources/Prototypes/Backmen/Traits/neutral.yml b/Resources/Prototypes/Backmen/Traits/neutral.yml index e69de29bb2d..95b4d3c87ad 100644 --- a/Resources/Prototypes/Backmen/Traits/neutral.yml +++ b/Resources/Prototypes/Backmen/Traits/neutral.yml @@ -0,0 +1,15 @@ + +- type: trait + id: OwOAccent + name: OwO акцент + description: Вы не можете перестать говорить как неко! + blacklist: + components: + - BSSDrone #backmen: bssdrone + - StationAI # backmen: AI + - BorgChassis + whitelist: + components: + - Felinid + components: + - type: OwOAccent diff --git a/Resources/Textures/Backmen/Interface/Misc/svs_icon.rsi/meta.json b/Resources/Textures/Backmen/Interface/Misc/svs_icon.rsi/meta.json new file mode 100644 index 00000000000..50cf33731bc --- /dev/null +++ b/Resources/Textures/Backmen/Interface/Misc/svs_icon.rsi/meta.json @@ -0,0 +1,20 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "made by kirillcas.", + "size": { + "x": 8, + "y": 8 + }, + "states": [ + { + "name": "team_0" + }, + { + "name": "team_a" + }, + { + "name": "team_b" + } + ] +} diff --git a/Resources/Textures/Backmen/Interface/Misc/svs_icon.rsi/team_0.png b/Resources/Textures/Backmen/Interface/Misc/svs_icon.rsi/team_0.png new file mode 100644 index 00000000000..0d512611b5e Binary files /dev/null and b/Resources/Textures/Backmen/Interface/Misc/svs_icon.rsi/team_0.png differ diff --git a/Resources/Textures/Backmen/Interface/Misc/svs_icon.rsi/team_a.png b/Resources/Textures/Backmen/Interface/Misc/svs_icon.rsi/team_a.png new file mode 100644 index 00000000000..dab12605ea7 Binary files /dev/null and b/Resources/Textures/Backmen/Interface/Misc/svs_icon.rsi/team_a.png differ diff --git a/Resources/Textures/Backmen/Interface/Misc/svs_icon.rsi/team_b.png b/Resources/Textures/Backmen/Interface/Misc/svs_icon.rsi/team_b.png new file mode 100644 index 00000000000..787b4049423 Binary files /dev/null and b/Resources/Textures/Backmen/Interface/Misc/svs_icon.rsi/team_b.png differ