Skip to content

Commit

Permalink
upd
Browse files Browse the repository at this point in the history
  • Loading branch information
Rxup committed Apr 1, 2024
1 parent 1488db8 commit 300da83
Show file tree
Hide file tree
Showing 14 changed files with 146 additions and 18 deletions.
1 change: 1 addition & 0 deletions Content.Client/Antag/AntagStatusIconSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public override void Initialize()
SubscribeLocalEvent<Shared.Backmen.Blob.Components.BlobCarrierComponent, GetStatusIconsEvent>(GetIcon);
SubscribeLocalEvent<Shared.Backmen.Blob.Components.ZombieBlobComponent, GetStatusIconsEvent>(GetIcon);
SubscribeLocalEvent<Shared.Backmen.Vampiric.BkmVampireComponent, GetStatusIconsEvent>(GetIcon);
SubscribeLocalEvent<Shared.Backmen.ShipVsShip.SVSTeamMemberComponent, GetStatusIconsEvent>(GetIcon);
//end-backmen: antag
SubscribeLocalEvent<InitialInfectedComponent, GetStatusIconsEvent>(GetIcon);
}
Expand Down
68 changes: 60 additions & 8 deletions Content.Server/Backmen/ShipVsShip/ShipVsShipGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -42,6 +45,8 @@ public sealed class ShipVsShipGame : GameRuleSystem<ShipVsShipGameComponent>
[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()
{
Expand All @@ -59,13 +64,62 @@ public override void Initialize()
SubscribeLocalEvent<RoundStartedEvent>(OnStartRound);
SubscribeLocalEvent<RoundEndTextAppendEvent>(OnRoundEndText);
SubscribeLocalEvent<CanHandleWithArrival>(CanUseArrivals);
SubscribeLocalEvent<PlayerSpawnCompleteEvent>(OnAfterSpawning);
}

private void SetFlag(EntityUid ent, StationTeamMarker team)
{
var teamFlag = EnsureComp<SVSTeamMemberComponent>(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<StationDataComponent>(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<SpawnPointComponent, TransformComponent>()
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();
}
Expand All @@ -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)));
}
Expand All @@ -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);
}
Expand Down Expand Up @@ -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<FTLComponent>(ev.Entity).Accumulator += 60 * 5;
EnsureComp<FTLComponent>(ev.Entity).StateTime = StartEndTime.FromCurTime(_gameTiming, 60 * 5);
_console.RefreshShuttleConsoles(ev.Entity);
}
}
Expand Down Expand Up @@ -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
}


}
}

Expand Down
16 changes: 16 additions & 0 deletions Content.Shared/Backmen/ShipVsShip/SVSTeamMember.cs
Original file line number Diff line number Diff line change
@@ -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<StatusIconPrototype> StatusIcon { get; set; } = "Team0Faction";
public bool IconVisibleToGhost { get; set; } = true;
}
8 changes: 4 additions & 4 deletions Resources/Prototypes/Backmen/Catalog/Loadout/head.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- type: loadout
id: ClothingHeadHatFlowerCrownLoadout
entity: ClothingHeadHatFlowerCrown
entity: ClothingHeadHatFlowerWreath

- type: loadout
id: ClothingHeadHatHairflowerLoadout
entity: ClothingHeadHatHairflower
#- type: loadout
# id: ClothingHeadHatHairflowerLoadout
# entity: ClothingHeadHatHairflower
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
- ClothingHeadHatXmasCrown
- ClothingHeadHelmetCosmonaut
- ClothingHeadHelmetBasic
- ClothingHeadHelmetScaf
- ClothingHeadHelmetTemplar
- ClothingHeadHelmetThunderdome
- ClothingHeadHelmetFire
Expand All @@ -28,7 +27,6 @@
- ClothingHeadHatHoodRad
- ClothingHeadHatCake
- ClothingHeadHatChickenhead
- ClothingHeadHatHairflower
- ClothingHeadHatPumpkin
- ClothingHeadHatRichard
- ClothingHeadHatShrineMaidenWig
Expand Down Expand Up @@ -72,7 +70,7 @@
- ClothingHeadFishCap
- ClothingHeadRastaHat
- ClothingHeadSafari
- ClothingHeadHatFlowerCrown
- ClothingHeadHatFlowerWreath
- ClothingHeadHatCone
- ClothingHeadHatBluesoft
- ClothingHeadHatCorpsoftFlipped
Expand Down
2 changes: 1 addition & 1 deletion Resources/Prototypes/Backmen/Entities/Mobs/NPC/special.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
- type: startingGear
id: HecateStartingGear
equipment:
hat: ClothingHeadHatHairflower
#hat: ClothingHeadHatHairflower
jumpsuit: ClothingCostumeArcDress
shoes: ClothingShoesColorBlack
innerClothingSkirt: ClothingCostumeArcDress
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
- type: Tag
tags:
- Wall
- RCDDeconstructWhitelist
- type: RCDDeconstructable
cost: 6
delay: 8

- type: entity
parent: BaseWall
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 24 additions & 0 deletions Resources/Prototypes/Backmen/Statusicon/antag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
15 changes: 15 additions & 0 deletions Resources/Prototypes/Backmen/Traits/neutral.yml
Original file line number Diff line number Diff line change
@@ -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
20 changes: 20 additions & 0 deletions Resources/Textures/Backmen/Interface/Misc/svs_icon.rsi/meta.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 300da83

Please sign in to comment.