-
Notifications
You must be signed in to change notification settings - Fork 599
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Vulps * Vulpkanins * Reptilians * Diona war against the glass shard is done! * Felinds * Moth * Diona Final * Oni * Update FelinidSystem.cs * Spooders Abilities. * Sooder progress * More Spooder progress! * Spooders can bite! * Spooder Cocoon * Fixes * Compleatly finished spooders * Dog Screams * Spooder data * Update with Master. * Revert "Update with Master." This reverts commit 93b0cd1. * Size Progress! * Bags * Values * Update felinid.yml * Food * Final Snack * Finals * RSI Oopsies * Update vulpkanin.yml * Linder Happy * Update vulpkanin.yml * Update sizeattribute.yml * Remove Custom Reptilian Lungs * Update misc.yml
- Loading branch information
1 parent
ea97b48
commit 937491e
Showing
77 changed files
with
816 additions
and
183 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
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,7 @@ | ||
|
||
namespace Content.Server.ArachnidChaos | ||
{ | ||
[RegisterComponent] | ||
public sealed partial class ArachnidChaosComponent : Component | ||
{} | ||
} |
139 changes: 139 additions & 0 deletions
139
Content.Server/_NF/ArachnidChaos/ArachnidChaosSystem.cs
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,139 @@ | ||
using Content.Server.Administration.Logs; | ||
using Content.Shared.Verbs; | ||
using Content.Shared.DoAfter; | ||
using Content.Shared.Popups; | ||
using Content.Shared.Inventory; | ||
using Content.Shared.Nutrition.Components; | ||
using Content.Shared.Nutrition.EntitySystems; | ||
using Robust.Shared.Audio; | ||
using Content.Shared.Audio; | ||
using Content.Server.Body.Components; | ||
using Content.Shared.ArachnidChaos; | ||
using Content.Server.Nutrition.EntitySystems; | ||
using Robust.Shared.Player; | ||
using Content.Shared.Mobs.Systems; | ||
using Content.Server.Body.Systems; | ||
using Content.Shared.Database; | ||
using Robust.Shared.Utility; | ||
|
||
namespace Content.Server.ArachnidChaos | ||
{ | ||
public sealed class ArachnidChaosSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!; | ||
[Dependency] private readonly SharedPopupSystem _popupSystem = default!; | ||
[Dependency] private readonly HungerSystem _hunger = default!; | ||
[Dependency] private readonly InventorySystem _inventorySystem = default!; | ||
[Dependency] private readonly MobStateSystem _mobStateSystem = default!; | ||
[Dependency] private readonly BloodstreamSystem _bloodstreamSystem = default!; | ||
[Dependency] private readonly IAdminLogManager _adminLogger = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
SubscribeLocalEvent<ArachnidChaosComponent, GetVerbsEvent<InnateVerb>>(AddBiteVerb); | ||
SubscribeLocalEvent<ArachnidChaosComponent, ArachnidChaosDoAfterEvent>(OnDoAfter); | ||
} | ||
private void AddBiteVerb(EntityUid uid, ArachnidChaosComponent component, GetVerbsEvent<InnateVerb> args) | ||
{ | ||
if (!args.CanInteract || !args.CanAccess) | ||
return; | ||
|
||
if (!_mobStateSystem.IsAlive(args.User)) | ||
return; | ||
|
||
if (args.User == args.Target) | ||
return; | ||
|
||
if (!TryComp<BloodstreamComponent>(args.Target, out var bloodstream)) | ||
return; | ||
|
||
InnateVerb verb = new() | ||
{ | ||
Act = () => | ||
{ | ||
if (!IsActionValid(args.User, args.Target)) | ||
return; | ||
|
||
_popupSystem.PopupEntity(Loc.GetString("spider-biting", ("UsernameName", args.User), ("targetName", args.Target)), args.User); | ||
_popupSystem.PopupEntity(Loc.GetString("spider-biting"), args.User, args.User); | ||
|
||
var doAfterEventArgs = new DoAfterArgs(EntityManager, args.User, 3f, new ArachnidChaosDoAfterEvent(), uid, target: args.Target, used: uid) | ||
{ | ||
BreakOnTargetMove = true, | ||
BreakOnUserMove = true, | ||
BreakOnDamage = true, | ||
BlockDuplicate = true | ||
}; | ||
|
||
_doAfter.TryStartDoAfter(doAfterEventArgs); | ||
}, | ||
Icon = new SpriteSpecifier.Rsi(new ("Nyanotrasen/Icons/verbiconfangs.rsi"), "icon"), | ||
Text = Loc.GetString("action-name-spider-bite"), | ||
Priority = 2 | ||
}; | ||
args.Verbs.Add(verb); | ||
} | ||
private void OnDoAfter(EntityUid uid, ArachnidChaosComponent comp, DoAfterEvent args) | ||
{ | ||
if (args.Cancelled || args.Handled || args.Args.Target == null) | ||
return; | ||
|
||
if (!IsActionValid(args.Args.User, args.Args.Target.Value)) | ||
return; | ||
|
||
if (!TryComp<HungerComponent>(args.Args.User, out var hunger)) | ||
return; | ||
|
||
if (!TryComp<BloodstreamComponent>(args.Args.Target.Value, out var bloodstream)) | ||
return; | ||
|
||
_bloodstreamSystem.TryModifyBloodLevel(args.Args.Target.Value, -5, bloodstream); | ||
SoundSystem.Play("/Audio/Items/drink.ogg", Filter.Pvs(args.Args.User), args.Args.User, AudioHelpers.WithVariation(0.15f)); | ||
_hunger.ModifyHunger(args.Args.User, 5, hunger); | ||
|
||
_adminLogger.Add(LogType.Action, LogImpact.Medium, $"{ToPrettyString(args.Args.User):actor} drank blood from {ToPrettyString(args.Args.Target.Value):actor}"); | ||
|
||
args.Repeat = true; | ||
} | ||
|
||
private bool IsActionValid(EntityUid user, EntityUid target) | ||
{ | ||
if (!TryComp<BloodstreamComponent>(target, out var bloodstream)) | ||
return false; | ||
|
||
if (bloodstream.BloodReagent == "Blood") | ||
{ | ||
if (_bloodstreamSystem.GetBloodLevelPercentage(target, bloodstream) <= 0.0f) | ||
{ | ||
_popupSystem.PopupEntity(Loc.GetString("no-blood-warning"), user, user, Shared.Popups.PopupType.SmallCaution); | ||
return false; | ||
} | ||
} | ||
else | ||
{ | ||
_popupSystem.PopupEntity(Loc.GetString("no-good-blood"), user, user, Shared.Popups.PopupType.SmallCaution); | ||
return false; | ||
} | ||
|
||
if (!TryComp<HungerComponent>(user, out var hunger)) | ||
return false; | ||
|
||
if (hunger.CurrentThreshold == Shared.Nutrition.Components.HungerThreshold.Overfed) | ||
{ | ||
_popupSystem.PopupEntity(Loc.GetString("food-system-you-cannot-eat-any-more"), user, user, Shared.Popups.PopupType.SmallCaution); | ||
return false; | ||
} | ||
|
||
if (_inventorySystem.TryGetSlotEntity(user, "mask", out var maskUid) && | ||
EntityManager.TryGetComponent<IngestionBlockerComponent>(maskUid, out var blocker) && | ||
blocker.Enabled) | ||
{ | ||
_popupSystem.PopupEntity(Loc.GetString("hairball-mask", ("mask", maskUid)), user, user, Shared.Popups.PopupType.SmallCaution); | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
Content.Server/_NF/SizeAttribute/SizeAttributeComponent.cs
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,13 @@ | ||
|
||
namespace Content.Server.SizeAttribute | ||
{ | ||
[RegisterComponent] | ||
public sealed partial class SizeAttributeComponent : Component | ||
{ | ||
[DataField("short")] | ||
public bool Short = false; | ||
|
||
[DataField("tall")] | ||
public bool Tall = false; | ||
} | ||
} |
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,91 @@ | ||
using System.Numerics; | ||
using Robust.Server.GameObjects; | ||
using Robust.Shared.Physics; | ||
using Robust.Shared.Physics.Collision.Shapes; | ||
using Robust.Shared.Physics.Systems; | ||
using Content.Server.Item.PseudoItem; | ||
|
||
namespace Content.Server.SizeAttribute | ||
{ | ||
public sealed class SizeAttributeSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly IEntityManager _entityManager = default!; | ||
[Dependency] private readonly SharedPhysicsSystem _physics = default!; | ||
[Dependency] private readonly AppearanceSystem _appearance = default!; | ||
[Dependency] private readonly FixtureSystem _fixtures = default!; | ||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
SubscribeLocalEvent<SizeAttributeComponent, ComponentInit>(OnComponentInit); | ||
} | ||
|
||
private void OnComponentInit(EntityUid uid, SizeAttributeComponent component, ComponentInit args) | ||
{ | ||
if (!TryComp<SizeAttributeWhitelistComponent>(uid, out var whitelist)) | ||
return; | ||
|
||
if (whitelist.Tall && component.Tall) | ||
{ | ||
Scale(uid, component, whitelist.TallScale, whitelist.TallDensity); | ||
PseudoItem(uid, component, whitelist.TallPseudoItem); | ||
} | ||
else if (whitelist.Short && component.Short) | ||
{ | ||
Scale(uid, component, whitelist.ShortScale, whitelist.ShortDensity); | ||
PseudoItem(uid, component, whitelist.ShortPseudoItem); | ||
} | ||
} | ||
|
||
private void PseudoItem(EntityUid uid, SizeAttributeComponent component, bool active) | ||
{ | ||
if (active) | ||
{ | ||
if (TryComp<PseudoItemComponent>(uid, out var pseudoI)) | ||
return; | ||
|
||
_entityManager.AddComponent<PseudoItemComponent>(uid); | ||
} | ||
else | ||
{ | ||
if (!TryComp<PseudoItemComponent>(uid, out var pseudoI)) | ||
return; | ||
|
||
_entityManager.RemoveComponent<PseudoItemComponent>(uid); | ||
} | ||
} | ||
|
||
private void Scale(EntityUid uid, SizeAttributeComponent component, float scale, float density) | ||
{ | ||
if (scale <= 0f && density <= 0f) | ||
return; | ||
|
||
_entityManager.EnsureComponent<ScaleVisualsComponent>(uid); | ||
|
||
var appearanceComponent = _entityManager.EnsureComponent<AppearanceComponent>(uid); | ||
if (!_appearance.TryGetData<Vector2>(uid, ScaleVisuals.Scale, out var oldScale, appearanceComponent)) | ||
oldScale = Vector2.One; | ||
|
||
_appearance.SetData(uid, ScaleVisuals.Scale, oldScale * scale, appearanceComponent); | ||
|
||
if (_entityManager.TryGetComponent(uid, out FixturesComponent? manager)) | ||
{ | ||
foreach (var (id, fixture) in manager.Fixtures) | ||
{ | ||
switch (fixture.Shape) | ||
{ | ||
case PhysShapeCircle circle: | ||
_physics.SetPositionRadius(uid, id, fixture, circle, circle.Position * scale, circle.Radius * scale, manager); | ||
break; | ||
default: | ||
throw new NotImplementedException(); | ||
} | ||
|
||
_physics.SetDensity(uid, id, fixture, density); | ||
} | ||
} | ||
} | ||
} | ||
|
||
[ByRefEvent] | ||
public readonly record struct ScaleEntityEvent(EntityUid Uid) { } | ||
} |
Oops, something went wrong.