-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
- Loading branch information
Showing
59 changed files
with
34,599 additions
and
19,113 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
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,14 @@ | ||
|
||
using Content.Shared.FixedPoint; | ||
|
||
namespace Content.Server.FaceCast; | ||
|
||
[RegisterComponent] | ||
public sealed partial class FaceCastComponent : Component | ||
{ | ||
public TimeSpan? StartCastingTime = null; | ||
|
||
public EntityUid? Equiper = null; | ||
|
||
public Double TimeToCast = 5; | ||
} |
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,69 @@ | ||
using Content.Shared.Inventory.Events; | ||
using Robust.Shared.Timing; | ||
using Content.Shared.IdentityManagement.Components; | ||
using Content.Shared.Clothing.Components; | ||
using Content.Shared.Inventory; | ||
using Content.Shared.Nutrition.AnimalHusbandry; | ||
|
||
namespace Content.Server.FaceCast; | ||
|
||
public sealed class FaceCastSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly IGameTiming _timing = default!; | ||
[Dependency] private readonly MetaDataSystem _metaData = default!; | ||
[Dependency] private readonly InventorySystem _inventory = default!; | ||
public override void Initialize() | ||
{ | ||
SubscribeLocalEvent<FaceCastComponent, GotEquippedEvent>(OnEquip); | ||
SubscribeLocalEvent<FaceCastComponent, GotUnequippedEvent>(OnUnequip); | ||
} | ||
|
||
private void OnEquip(EntityUid ent, FaceCastComponent faceCast, ref GotEquippedEvent args) | ||
{ | ||
if (!HasComp<IdentityComponent>(args.Equipee)) | ||
return; | ||
faceCast.Equiper = args.Equipee; | ||
if (HasComp<InfantComponent>(args.Equipee)) | ||
return; | ||
faceCast.StartCastingTime = _timing.CurTime; | ||
} | ||
|
||
private void OnUnequip(EntityUid ent, FaceCastComponent faceCast, ref GotUnequippedEvent args) | ||
{ | ||
faceCast.StartCastingTime = null; | ||
faceCast.Equiper = null; | ||
} | ||
|
||
public override void Update(float frameTime) | ||
{ | ||
base.Update(frameTime); | ||
|
||
var query = EntityQueryEnumerator<FaceCastComponent>(); | ||
while (query.MoveNext(out var uid, out var faceCast)) | ||
{ | ||
if (!TryComp<ClothingComponent>(uid, out var cloth)) | ||
continue; | ||
|
||
if (faceCast.Equiper == null) | ||
continue; | ||
|
||
if (!HasComp<InfantComponent>(faceCast.Equiper) && faceCast.StartCastingTime == null) | ||
{ | ||
if (Name(uid) != Loc.GetEntityData("ClothingMaskFaceCast").Name) | ||
_metaData.SetEntityName((EntityUid) faceCast.Equiper, Name(uid)); | ||
faceCast.StartCastingTime = _timing.CurTime; | ||
continue; | ||
} | ||
|
||
if (faceCast.StartCastingTime == null) | ||
continue; | ||
|
||
if ((_timing.CurTime - faceCast.StartCastingTime) >= TimeSpan.FromSeconds(faceCast.TimeToCast)) | ||
{ | ||
_metaData.SetEntityName(uid, Name((EntityUid)faceCast.Equiper)); | ||
faceCast.StartCastingTime = _timing.CurTime; | ||
} | ||
|
||
} | ||
} | ||
} |
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,14 @@ | ||
using Content.Shared.FixedPoint; | ||
|
||
namespace Content.Server.Saw; | ||
|
||
|
||
[RegisterComponent] | ||
public sealed partial class SawComponent : Component | ||
{ | ||
[DataField] | ||
public EntityUid? EatenMind = null; | ||
|
||
[DataField] | ||
public FixedPoint2 HungerToThresholdModifier = 1.5; | ||
} |
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,85 @@ | ||
using Content.Server.Nutrition.Components; | ||
using Content.Shared.IdentityManagement.Components; | ||
using Content.Shared.Nutrition.AnimalHusbandry; | ||
using Content.Server.Mind; | ||
using Robust.Shared.Prototypes; | ||
using Content.Shared.Mind.Components; | ||
using Content.Server.Nutrition.EntitySystems; | ||
using Content.Shared.Mobs.Components; | ||
using Content.Shared.Mobs; | ||
using Content.Shared.FixedPoint; | ||
using Content.Shared.Mobs.Systems; | ||
using Content.Server._Sunrise.Mood; | ||
using Content.Shared.Nutrition.Components; | ||
using Content.Shared.Nutrition; | ||
using Content.Shared.Nutrition.EntitySystems; | ||
|
||
namespace Content.Server.Saw; | ||
|
||
public sealed class SawSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly IEntityManager _entityManager = default!; | ||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; | ||
[Dependency] private readonly MindSystem _mindSystem = default!; | ||
[Dependency] private readonly MetaDataSystem _metaData = default!; | ||
[Dependency] private readonly MobThresholdSystem _thresholdSystem = default!; | ||
[Dependency] private readonly HungerSystem _hungerSystem = default!; | ||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<FoodComponent, BeforeFullyEatenEvent>(OnBeforeFullyEaten); | ||
SubscribeLocalEvent<SawComponent, ComponentInit>(SawInit); | ||
SubscribeLocalEvent<SawComponent, BirthEvent>(OnBirth); | ||
} | ||
|
||
private void OnBeforeFullyEaten(Entity<FoodComponent> food, ref BeforeFullyEatenEvent args) | ||
{ | ||
if (!TryComp(args.User, out SawComponent? sawComp) || | ||
!TryComp(args.User, out ReproductiveComponent? reproductive) || | ||
!TryComp(food, out MindContainerComponent? mind) || | ||
!HasComp<IdentityComponent>(food)) | ||
return; | ||
|
||
EntityUid? foodMind = _mindSystem.GetMind(food); | ||
sawComp.EatenMind = foodMind; | ||
|
||
if (_prototypeManager.Index<EntityPrototype>("MobSaw").Components.TryGetComponent("Reproductive", out var defaultReproductive)) | ||
reproductive.Capacity = 6; | ||
} | ||
|
||
private void SawInit(EntityUid ent, SawComponent saw, ComponentInit args) | ||
{ | ||
if (HasComp<ReproductiveComponent>(ent)) | ||
RemComp<ReproductiveComponent>(ent); | ||
|
||
_entityManager.AddComponents(ent, _prototypeManager.Index("MobSaw").Components, false); | ||
Comp<ReproductiveComponent>(ent).Capacity = 0; | ||
} | ||
|
||
private void OnBirth(Entity<SawComponent> saw, ref BirthEvent args) | ||
{ | ||
if (TryComp(saw, out ReproductiveComponent? reproductive)) | ||
reproductive.Capacity = 0; | ||
EntityUid child = args.Spawns[0]; | ||
EntityUid? eatenMind = Comp<SawComponent>(saw).EatenMind; | ||
saw.Comp.EatenMind = null; | ||
if (eatenMind == null) | ||
return; | ||
if (!TryComp<HungerComponent>(saw, out var hungerComp)) | ||
return; | ||
|
||
if (TryComp<MobThresholdsComponent>(child, out var thresholds)) | ||
{ | ||
FixedPoint2 thresholdModifier = _hungerSystem.GetHunger(hungerComp) * saw.Comp.HungerToThresholdModifier; | ||
|
||
_thresholdSystem.SetMobStateThreshold(child, _thresholdSystem.GetThresholdForState(child, MobState.Critical) + thresholdModifier, MobState.Critical); | ||
_thresholdSystem.SetMobStateThreshold(child, _thresholdSystem.GetThresholdForState(child, MobState.Dead) + thresholdModifier, MobState.Dead); | ||
if (TryComp<MoodComponent>(child, out var mood)) | ||
mood.CritThresholdBeforeModify = _thresholdSystem.GetThresholdForState(child, MobState.Critical); | ||
} | ||
|
||
_mindSystem.TransferTo((EntityUid) eatenMind, child); | ||
_metaData.SetEntityName(args.Spawns[0], "троттин"); | ||
} | ||
} |
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
Oops, something went wrong.