Skip to content

Commit

Permalink
Specie update (#524)
Browse files Browse the repository at this point in the history
* 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
FoxxoTrystan authored Dec 1, 2023
1 parent ea97b48 commit 937491e
Show file tree
Hide file tree
Showing 77 changed files with 816 additions and 183 deletions.
12 changes: 12 additions & 0 deletions Content.Server/Atmos/Miasma/RottingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Robust.Server.GameObjects;
using Robust.Shared.Physics.Components;
using Robust.Shared.Timing;
using Content.Shared.Cuffs.Components;

namespace Content.Server.Atmos.Miasma;

Expand Down Expand Up @@ -98,6 +99,17 @@ public bool IsRotProgressing(EntityUid uid, PerishableComponent? perishable)
return false;
}

if (TryComp<CuffableComponent>(uid, out var cuffed) && cuffed.CuffedHandCount > 0)
{
if (TryComp<HandcuffComponent>(cuffed.LastAddedCuffs, out var cuffcomp))
{
if (cuffcomp.NoRot)
{
return false;
}
}
}

var ev = new IsRottingEvent();
RaiseLocalEvent(uid, ref ev);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using Content.Shared.Item;
using Content.Shared.Inventory;
using Content.Shared.Hands;
using Content.Shared.Actions;
using Content.Shared.IdentityManagement;
using Content.Server.Body.Components;
using Content.Server.Medical;
Expand Down Expand Up @@ -41,7 +40,7 @@ public override void Initialize()
SubscribeLocalEvent<FelinidComponent, HairballActionEvent>(OnHairball);
SubscribeLocalEvent<FelinidComponent, EatMouseActionEvent>(OnEatMouse);
SubscribeLocalEvent<FelinidComponent, DidEquipHandEvent>(OnEquipped);
SubscribeLocalEvent<FelinidComponent,DidUnequipHandEvent>(OnUnequipped);
SubscribeLocalEvent<FelinidComponent, DidUnequipHandEvent>(OnUnequipped);
SubscribeLocalEvent<HairballComponent, ThrowDoHitEvent>(OnHairballHit);
SubscribeLocalEvent<HairballComponent, GettingPickedUpAttemptEvent>(OnHairballPickupAttempt);
}
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Nyanotrasen/Abilities/Oni/OniComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ public sealed partial class OniComponent : Component
public DamageModifierSet MeleeModifiers = default!;

[DataField("stamDamageBonus")]
public float StamDamageMultiplier = 1.25f;
public float StamDamageMultiplier = 1.20f;
}
}
17 changes: 6 additions & 11 deletions Content.Server/Nyanotrasen/Abilities/Oni/OniSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,22 @@ private void OnEntInserted(EntityUid uid, OniComponent component, EntInsertedInt
var heldComp = EnsureComp<HeldByOniComponent>(args.Entity);
heldComp.Holder = uid;

if (TryComp<ToolComponent>(args.Entity, out var tool) && _toolSystem.HasQuality(args.Entity, "Prying", tool))
tool.SpeedModifier *= 1.66f;

if (TryComp<GunComponent>(args.Entity, out var gun))
{
gun.MinAngle *= 15f;
gun.AngleIncrease *= 15f;
gun.MaxAngle *= 15f;
gun.MinAngle *= 20f;
gun.AngleIncrease *= 20f;
gun.MaxAngle *= 20f;
}
}

private void OnEntRemoved(EntityUid uid, OniComponent component, EntRemovedFromContainerMessage args)
{
if (TryComp<ToolComponent>(args.Entity, out var tool) && _toolSystem.HasQuality(args.Entity, "Prying", tool))
tool.SpeedModifier /= 1.66f;

if (TryComp<GunComponent>(args.Entity, out var gun))
{
gun.MinAngle /= 15f;
gun.AngleIncrease /= 15f;
gun.MaxAngle /= 15f;
gun.MinAngle /= 20f;
gun.AngleIncrease /= 20f;
gun.MaxAngle /= 20f;
}

RemComp<HeldByOniComponent>(args.Entity);
Expand Down
24 changes: 11 additions & 13 deletions Content.Server/Spider/SpiderSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
using Content.Shared.Maps;
using Robust.Server.GameObjects;
using Robust.Shared.Map;
using Content.Shared.Nutrition.EntitySystems;
using Content.Shared.Nutrition.Components;

namespace Content.Server.Spider;

public sealed class SpiderSystem : SharedSpiderSystem
{
[Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly HungerSystem _hungerSystem = default!;

public override void Initialize()
{
Expand All @@ -22,6 +25,13 @@ private void OnSpawnNet(EntityUid uid, SpiderComponent component, SpiderWebActio
if (args.Handled)
return;

if (TryComp<HungerComponent>(uid, out var hungerComp)
&& _hungerSystem.IsHungerBelowState(uid, HungerThreshold.Okay, hungerComp.CurrentHunger - 5, hungerComp))
{
_popup.PopupEntity(Loc.GetString("sericulture-failure-hunger"), args.Performer, args.Performer);
return;
}

var transform = Transform(uid);

if (transform.GridUid == null)
Expand All @@ -42,22 +52,10 @@ private void OnSpawnNet(EntityUid uid, SpiderComponent component, SpiderWebActio
result = true;
}

// Spawn web in other directions
for (var i = 0; i < 4; i++)
{
var direction = (DirectionFlag) (1 << i);
coords = transform.Coordinates.Offset(direction.AsDir().ToVec());

if (!IsTileBlockedByWeb(coords))
{
Spawn(component.WebPrototype, coords);
result = true;
}
}

if (result)
{
_popup.PopupEntity(Loc.GetString("spider-web-action-success"), args.Performer, args.Performer);
_hungerSystem.ModifyHunger(uid, -5);
args.Handled = true;
}
else
Expand Down
7 changes: 7 additions & 0 deletions Content.Server/_NF/ArachnidChaos/ArachnidChaosComponent.cs
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 Content.Server/_NF/ArachnidChaos/ArachnidChaosSystem.cs
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 Content.Server/_NF/SizeAttribute/SizeAttributeComponent.cs
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;
}
}
91 changes: 91 additions & 0 deletions Content.Server/_NF/SizeAttribute/SizeAttributeSystem.cs
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) { }
}
Loading

0 comments on commit 937491e

Please sign in to comment.