Skip to content

Commit

Permalink
Merge branch 'refs/heads/flesh_cult' into fix_flesh_cult
Browse files Browse the repository at this point in the history
# Conflicts:
#	Content.Server/_Sunrise/FleshCult/FleshCultistSystem.cs
#	Content.Shared/_Sunrise/FleshCult/FleshCultistComponent.cs
#	Content.Shared/_Sunrise/FleshCult/FleshMobComponent.cs
#	Resources/Prototypes/_Sunrise/FleshCult/body_mods.yml
  • Loading branch information
VigersRay committed Dec 31, 2024
2 parents 0e9091f + 7e47cd1 commit aa3eb9c
Show file tree
Hide file tree
Showing 227 changed files with 5,793 additions and 118 deletions.
32 changes: 32 additions & 0 deletions Content.Client/_Sunrise/FleshCult/FleshCultistSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using Content.Shared._Sunrise.FleshCult;
using Content.Shared.StatusIcon.Components;
using Robust.Shared.Prototypes;
namespace Content.Client._Sunrise.FleshCult;

public sealed class FleshCultistSystem : SharedFleshMobSystem
{
[Dependency] private readonly IPrototypeManager _prototype = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<FleshCultistComponent, GetStatusIconsEvent>(GetFleshCultistIcon);
SubscribeLocalEvent<FleshMobComponent, GetStatusIconsEvent>(GetFleshMobIcon);
}

private void GetFleshCultistIcon(Entity<FleshCultistComponent> ent, ref GetStatusIconsEvent args)
{
var iconPrototype = _prototype.Index(ent.Comp.StatusIcon);
args.StatusIcons.Add(iconPrototype);
}

private void GetFleshMobIcon(Entity<FleshMobComponent> ent, ref GetStatusIconsEvent args)
{
if (HasComp<FleshCultistComponent>(ent))
return;

var iconPrototype = _prototype.Index(ent.Comp.StatusIcon);
args.StatusIcons.Add(iconPrototype);
}
}
23 changes: 23 additions & 0 deletions Content.Client/_Sunrise/FleshCult/FleshHeartVisualSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Content.Shared._Sunrise.FleshCult;
using Content.Shared.Flesh;
using Robust.Client.GameObjects;

namespace Content.Client._Sunrise.FleshCult;

public sealed class FleshHeartSystem : VisualizerSystem<FleshHeartComponent>
{
protected override void OnAppearanceChange(EntityUid uid, FleshHeartComponent component, ref AppearanceChangeEvent args)
{
if (args.Sprite == null)
return;

if (!AppearanceSystem.TryGetData<FleshHeartStatus>(uid, FleshHeartVisuals.State, out var state, args.Component))
return;
var layer = args.Sprite.LayerMapGet(FleshHeartLayers.Base);

if (state == FleshHeartStatus.Active)
{
args.Sprite.LayerSetState(layer, component.FinalState);
}
}
}
11 changes: 11 additions & 0 deletions Content.Client/_Sunrise/FleshCult/FleshHuggerSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Content.Server.Flesh;

namespace Content.Client._Sunrise.FleshCult;

public sealed class FleshHuggerSystem: SharedFleshHuggerSystem
{

public override void Initialize()
{
}
}
11 changes: 11 additions & 0 deletions Content.Client/_Sunrise/FleshCult/FleshMobSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Content.Shared._Sunrise.FleshCult;

namespace Content.Client._Sunrise.FleshCult;

public sealed class FleshMobSystem : SharedFleshCultistSystem
{
public override void Initialize()
{
base.Initialize();
}
}
5 changes: 5 additions & 0 deletions Content.Server/Access/Components/PresetIdCardComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@ public sealed partial class PresetIdCardComponent : Component

[DataField("name")]
public string? IdName;

// Sunrise-Start
[DataField]
public bool SetAccess = true;
// Sunrise-End
}
4 changes: 3 additions & 1 deletion Content.Server/Access/Systems/PresetIdCardSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ private void SetupIdAccess(EntityUid uid, PresetIdCardComponent id, bool extende
return;
}

_accessSystem.SetAccessToJob(uid, job, extended);

if (id.SetAccess) // Sunrise-Edit
_accessSystem.SetAccessToJob(uid, job, extended);

_cardSystem.TryChangeJobTitle(uid, job.LocalizedName);
_cardSystem.TryChangeJobDepartment(uid, job);
Expand Down
15 changes: 15 additions & 0 deletions Content.Server/Administration/Systems/AdminVerbSystem.Antags.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Content.Server._Sunrise.FleshCult.GameRule;
using Content.Server.Administration.Commands;
using Content.Server.Antag;
using Content.Server.GameTicking.Rules.Components;
Expand Down Expand Up @@ -179,5 +180,19 @@ private void AddAntagVerbs(GetVerbsEvent<Verb> args)
Message = Loc.GetString("admin-verb-make-vampire"),
};
args.Verbs.Add(vampire);

Verb fleshCultist = new()
{
Text = "Make Flesh Cultist",
Category = VerbCategory.Antag,
Icon = new SpriteSpecifier.Texture(new ResPath("_Sunrise/FleshCult/Interface/Actions/fleshCultistFleshHeart.png")),
Act = () =>
{
_antag.ForceMakeAntag<FleshCultRuleComponent>(targetPlayer, "FleshCult");
},
Impact = LogImpact.High,
Message = Loc.GetString("admin-verb-make-flesh-cultist"),
};
args.Verbs.Add(fleshCultist);
}
}
7 changes: 7 additions & 0 deletions Content.Server/Destructible/Thresholds/DamageThreshold.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,12 @@ public void Execute(EntityUid owner, DestructibleSystem system, IEntityManager e
behavior.Execute(owner, system, cause);
}
}

// Sunrise-Start
public void AddBehavior(IThresholdBehavior behavior)
{
_behaviors.Add(behavior);
}
// Sunrise-End
}
}
38 changes: 0 additions & 38 deletions Content.Server/_Sunrise/Disease/DiseaseRoleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
using Content.Shared.FixedPoint;
using Content.Shared.Popups;
using Content.Shared.Store.Components;
using Content.Server.Objectives;
using Content.Server.GameTicking;
using Content.Shared.Random.Helpers;

namespace Content.Server._Sunrise.Disease;

Expand Down Expand Up @@ -37,43 +34,8 @@ public override void Initialize()
SubscribeLocalEvent<DiseaseRoleComponent, DiseaseAddCoughChanceEvent>(OnCoughChance);
SubscribeLocalEvent<DiseaseRoleComponent, DiseaseAddLethalEvent>(OnLethal);
SubscribeLocalEvent<DiseaseRoleComponent, DiseaseAddShieldEvent>(OnShield);
SubscribeLocalEvent<DiseaseRuleComponent, ObjectivesTextGetInfoEvent>(OnObjectivesTextGetInfo);
SubscribeLocalEvent<RoundEndTextAppendEvent>(OnRoundEndText);
}


private void OnRoundEndText(RoundEndTextAppendEvent ev)
{
var sick = EntityQueryEnumerator<SickComponent>();
var immune = EntityQueryEnumerator<DiseaseImmuneComponent>();
var disease = EntityQueryEnumerator<DiseaseRoleComponent>();
int infected = 0;
int immuned = 0;
int infects = 0;
while (sick.MoveNext(out _))
{
infects++;
}
while (immune.MoveNext(out _))
{
immuned++;
}
while (disease.MoveNext(out var comp))
{
infected = comp.SickOfAllTime;
}
ev.AddLine(Loc.GetString("disease-round-end-result"));
ev.AddLine(Loc.GetString("disease-round-end-result-infected", ("count", infected)));
ev.AddLine(Loc.GetString("disease-round-end-result-infects", ("count", infects)));
ev.AddLine(Loc.GetString("disease-round-end-result-immuned", ("count", immuned)));
}
private void OnObjectivesTextGetInfo(EntityUid uid, DiseaseRuleComponent comp, ref ObjectivesTextGetInfoEvent args)
{
args.Minds = comp.DiseasesMinds;
args.AgentName = "разумная болезнь";
}


private void OnLethal(EntityUid uid, DiseaseRoleComponent component, DiseaseAddLethalEvent args)
{
if (!TryRemoveMoney(uid, 15))
Expand Down
54 changes: 54 additions & 0 deletions Content.Server/_Sunrise/Disease/DiseaseRuleSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// © SUNRISE, An EULA/CLA with a hosting restriction, full text: https://github.com/space-sunrise/space-station-14/blob/master/CLA.txt

using Content.Shared._Sunrise.Disease;
using Content.Server.Objectives;
using Content.Server.GameTicking;
using Content.Server.GameTicking.Rules;
using Content.Shared.GameTicking.Components;

namespace Content.Server._Sunrise.Disease;

public sealed class DiseaseRuleSystem : GameRuleSystem<DiseaseRuleComponent>
{
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<DiseaseRuleComponent, ObjectivesTextGetInfoEvent>(OnObjectivesTextGetInfo);
}

private void OnObjectivesTextGetInfo(EntityUid uid, DiseaseRuleComponent comp, ref ObjectivesTextGetInfoEvent args)
{
args.Minds = comp.DiseasesMinds;
args.AgentName = "разумная болезнь";
}

protected override void AppendRoundEndText(EntityUid uid,
DiseaseRuleComponent component,
GameRuleComponent gameRule,
ref RoundEndTextAppendEvent args)
{
var sick = EntityQueryEnumerator<SickComponent>();
var immune = EntityQueryEnumerator<DiseaseImmuneComponent>();
var disease = EntityQueryEnumerator<DiseaseRoleComponent>();
int infected = 0;
int immuned = 0;
int infects = 0;
while (sick.MoveNext(out _))
{
infects++;
}
while (immune.MoveNext(out _))
{
immuned++;
}
while (disease.MoveNext(out var comp))
{
infected = comp.SickOfAllTime;
}
args.AddLine(Loc.GetString("disease-round-end-result"));
args.AddLine(Loc.GetString("disease-round-end-result-infected", ("count", infected)));
args.AddLine(Loc.GetString("disease-round-end-result-infects", ("count", infects)));
args.AddLine(Loc.GetString("disease-round-end-result-immuned", ("count", immuned)));
}
}
18 changes: 18 additions & 0 deletions Content.Server/_Sunrise/FleshCult/CauseFleshCultInfection.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Content.Server.Sunrise.FleshCult;
using Content.Shared.EntityEffects;
using Robust.Shared.Prototypes;

namespace Content.Server._Sunrise.FleshCult;

public sealed partial class CauseFleshCultInfection : EntityEffect
{
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
=> Loc.GetString("reagent-effect-guidebook-cause-flesh-cultist-infection", ("chance", Probability));

public override void Effect(EntityEffectBaseArgs args)
{
var entityManager = args.EntityManager;
entityManager.EnsureComponent<PendingFleshCultistComponent>(args.TargetEntity);
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Content.Server._Sunrise.FleshCult.Events;

[RegisterComponent, Access(typeof(VentFleshWormsRule))]
public sealed partial class VentFleshWormsRuleComponent : Component
{
[DataField("spawnedPrototypeWorm")]
public string SpawnedPrototypeWorm = "MobFleshWorm";
}
47 changes: 47 additions & 0 deletions Content.Server/_Sunrise/FleshCult/Events/VentFleshWormsRule.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using System.Linq;
using Content.Server.Station.Components;
using Content.Server.Station.Systems;
using Content.Server.StationEvents.Components;
using Content.Server.StationEvents.Events;
using Content.Shared.GameTicking.Components;
using Robust.Shared.Utility;

namespace Content.Server._Sunrise.FleshCult.Events;

public sealed class VentFleshWormsRule : StationEventSystem<VentFleshWormsRuleComponent>
{
[Dependency] private readonly StationSystem _stationSystem = default!;

protected override void Started(EntityUid uid, VentFleshWormsRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args)
{
base.Started(uid, component, gameRule, args);

var targetStation = _stationSystem.GetStations().FirstOrNull();

if (!TryComp(targetStation, out StationDataComponent? data))
{
Logger.Info("TargetStation not have StationDataComponent");
return;
}

var spawnLocations = EntityManager.EntityQuery<VentCritterSpawnLocationComponent, TransformComponent>().ToList();

var grids = data.Grids.ToHashSet();
spawnLocations.RemoveAll(
backupSpawnLoc =>
backupSpawnLoc.Item2.GridUid.HasValue && !grids.Contains(backupSpawnLoc.Item2.GridUid.Value));

RobustRandom.Shuffle(spawnLocations);

var spawnAmount = RobustRandom.Next(10, 20);
Sawmill.Info($"Spawning {spawnAmount} of {component.SpawnedPrototypeWorm}");
foreach (var location in spawnLocations)
{
if (spawnAmount-- == 0)
break;

var coords = Transform(location.Item1.Owner);
Spawn(component.SpawnedPrototypeWorm, coords.Coordinates);
}
}
}
10 changes: 10 additions & 0 deletions Content.Server/_Sunrise/FleshCult/FleshCultistRoleComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Content.Shared.Roles;

namespace Content.Server._Sunrise.FleshCult;

[RegisterComponent]
public sealed partial class FleshCultistRoleComponent : BaseMindRoleComponent
{
[DataField("fleshHearts")]
public int FleshHearts;
}
Loading

0 comments on commit aa3eb9c

Please sign in to comment.