Skip to content

Commit

Permalink
Felinids & Vulp Update (#806)
Browse files Browse the repository at this point in the history
* Fluffy tail for felinids (#433)

* Fluffy tail for felinids

After 9 years. I finished it.

(Requires Phil's approval, will put it to ready for review as soon as he gets to see fully the fully finished PR)

* An small update.

Updated meta.json to include all numbers to be equal.
Updated PNG to allow updated numbers to have actual sprites and not just empty sprites.

* Improved the tail sprite.

Proper animation and code.

* Updates ftl for it to properly work.

* Prevent shooting while inside a duffelbag (#510)

Anyone shoved into a duffelbag gets an ItemComponent. This denies anyone
with an ItemComponent from shooting a gun.

* Prevent pseudoitems from being transferred between bags  (#553)

* Update PseudoItemSystem.cs

* Rider full cleanup

* Also abort in sharedstorage

* Make the comp shared

* Why drop the bags?

* Make felinids meow it instead of sayin it. (#543)

* Make felinids meow it instead of sayin it.

A note: snapping doesnt even make a sound effect on humans. Only putting it just incase that ever gets fixed upstream.
Also fixes issue #525
A simple PR.

* Hopefully fixes yaml linter.

* Removes notes.

* Fixing

* FTL fix

* Missing FTL

* fix tattoos

* Updates more variation of mraowing. (#604)

Thats it.

* Allow vulpkaning to sigh. (#569)

Nothing much. Just a small quality of life.

* What the hell is even a yeep?

* Update felinid.yml

---------

Co-authored-by: Adrian16199 <[email protected]>
Co-authored-by: Bakke <[email protected]>
Co-authored-by: Debug <[email protected]>
  • Loading branch information
4 people authored Jan 2, 2024
1 parent de6f811 commit 2e22265
Show file tree
Hide file tree
Showing 23 changed files with 446 additions and 178 deletions.
18 changes: 0 additions & 18 deletions Content.Server/Nyanotrasen/Item/PseudoItem/PseudoItemComponent.cs

This file was deleted.

253 changes: 134 additions & 119 deletions Content.Server/Nyanotrasen/Item/PseudoItem/PseudoItemSystem.cs
Original file line number Diff line number Diff line change
@@ -1,159 +1,174 @@
using System.Threading;
using Content.Shared.Verbs;
using Content.Shared.Item;
using Content.Shared.Hands;
using Content.Server.DoAfter;
using Content.Server.Storage.EntitySystems;
using Content.Shared.DoAfter;
using Content.Shared.Hands;
using Content.Shared.IdentityManagement;
using Content.Shared.Pseudo;
using Content.Server.Storage.Components;
using Content.Server.Storage.EntitySystems;
using Content.Server.DoAfter;
using Content.Shared.Item;
using Content.Shared.Item.PseudoItem;
using Content.Shared.Storage;
using Content.Shared.Tag;
using Content.Shared.Verbs;
using Robust.Shared.Containers;

namespace Content.Server.Item.PseudoItem
namespace Content.Server.Item.PseudoItem;

public sealed class PseudoItemSystem : EntitySystem
{
public sealed class PseudoItemSystem : EntitySystem
{
[Dependency] private readonly StorageSystem _storageSystem = default!;
[Dependency] private readonly ItemSystem _itemSystem = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
[Dependency] private readonly TagSystem _tagSystem = default!;
[Dependency] private readonly StorageSystem _storageSystem = default!;
[Dependency] private readonly ItemSystem _itemSystem = default!;
[Dependency] private readonly DoAfterSystem _doAfter = default!;
[Dependency] private readonly TagSystem _tagSystem = default!;

[ValidatePrototypeId<TagPrototype>]
private const string PreventTag = "PreventLabel";public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<PseudoItemComponent, GetVerbsEvent<InnateVerb>>(AddInsertVerb);
SubscribeLocalEvent<PseudoItemComponent, GetVerbsEvent<AlternativeVerb>>(AddInsertAltVerb);
SubscribeLocalEvent<PseudoItemComponent, EntGotRemovedFromContainerMessage>(OnEntRemoved);
SubscribeLocalEvent<PseudoItemComponent, GettingPickedUpAttemptEvent>(OnGettingPickedUpAttempt);
SubscribeLocalEvent<PseudoItemComponent, DropAttemptEvent>(OnDropAttempt);
SubscribeLocalEvent<PseudoItemComponent, DoAfterEvent>(OnDoAfter);
}
private const string PreventTag = "PreventLabel";

private void AddInsertVerb(EntityUid uid, PseudoItemComponent component, GetVerbsEvent<InnateVerb> args)
{
if (!args.CanInteract || !args.CanAccess)
return;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<PseudoItemComponent, GetVerbsEvent<InnateVerb>>(AddInsertVerb);
SubscribeLocalEvent<PseudoItemComponent, GetVerbsEvent<AlternativeVerb>>(AddInsertAltVerb);
SubscribeLocalEvent<PseudoItemComponent, EntGotRemovedFromContainerMessage>(OnEntRemoved);
SubscribeLocalEvent<PseudoItemComponent, GettingPickedUpAttemptEvent>(OnGettingPickedUpAttempt);
SubscribeLocalEvent<PseudoItemComponent, DropAttemptEvent>(OnDropAttempt);
SubscribeLocalEvent<PseudoItemComponent, PseudoItemInsertDoAfterEvent>(OnDoAfter);
SubscribeLocalEvent<PseudoItemComponent, ContainerGettingInsertedAttemptEvent>(OnInsertAttempt);
}

if (component.Active)
return;
private void AddInsertVerb(EntityUid uid, PseudoItemComponent component, GetVerbsEvent<InnateVerb> args)
{
if (!args.CanInteract || !args.CanAccess)
return;

if (!TryComp<StorageComponent>(args.Target, out var targetStorage))
return;
if (component.Active)
return;

if (component.Size > targetStorage.StorageCapacityMax - targetStorage.StorageUsed)
return;
if (!TryComp<StorageComponent>(args.Target, out var targetStorage))
return;

if (Transform(args.Target).ParentUid == uid)
return;
if (component.Size > targetStorage.StorageCapacityMax - targetStorage.StorageUsed)
return;

InnateVerb verb = new()
{
Act = () =>
{
TryInsert(args.Target, uid, component, targetStorage);
},
Text = Loc.GetString("action-name-insert-self"),
Priority = 2
};
args.Verbs.Add(verb);
}
if (Transform(args.Target).ParentUid == uid)
return;

private void AddInsertAltVerb(EntityUid uid, PseudoItemComponent component, GetVerbsEvent<AlternativeVerb> args)
InnateVerb verb = new()
{
if (!args.CanInteract || !args.CanAccess)
return;
Act = () =>
{
TryInsert(args.Target, uid, component, targetStorage);
},
Text = Loc.GetString("action-name-insert-self"),
Priority = 2
};
args.Verbs.Add(verb);
}

if (args.User == args.Target)
return;
private void AddInsertAltVerb(EntityUid uid, PseudoItemComponent component, GetVerbsEvent<AlternativeVerb> args)
{
if (!args.CanInteract || !args.CanAccess)
return;

if (args.Hands == null)
return;
if (args.User == args.Target)
return;

if (!TryComp<StorageComponent>(args.Hands.ActiveHandEntity, out var targetStorage))
return;
if (args.Hands == null)
return;

AlternativeVerb verb = new()
{
Act = () =>
{
StartInsertDoAfter(args.User, uid, args.Hands.ActiveHandEntity.Value, component);
},
Text = Loc.GetString("action-name-insert-other", ("target", Identity.Entity(args.Target, EntityManager))),
Priority = 2
};
args.Verbs.Add(verb);
}
if (!TryComp<StorageComponent>(args.Hands.ActiveHandEntity, out var targetStorage))
return;

private void OnEntRemoved(EntityUid uid, PseudoItemComponent component, EntGotRemovedFromContainerMessage args)
AlternativeVerb verb = new()
{
if (!component.Active)
return;
Act = () =>
{
StartInsertDoAfter(args.User, uid, args.Hands.ActiveHandEntity.Value, component);
},
Text = Loc.GetString("action-name-insert-other", ("target", Identity.Entity(args.Target, EntityManager))),
Priority = 2
};
args.Verbs.Add(verb);
}

RemComp<ItemComponent>(uid);
component.Active = false;
}
private void OnEntRemoved(EntityUid uid, PseudoItemComponent component, EntGotRemovedFromContainerMessage args)
{
if (!component.Active)
return;

private void OnGettingPickedUpAttempt(EntityUid uid, PseudoItemComponent component, GettingPickedUpAttemptEvent args)
{
if (args.User == args.Item)
return;
RemComp<ItemComponent>(uid);
component.Active = false;
}

private void OnGettingPickedUpAttempt(EntityUid uid, PseudoItemComponent component,
GettingPickedUpAttemptEvent args)
{
if (args.User == args.Item)
return;

Transform(uid).AttachToGridOrMap();
Transform(uid).AttachToGridOrMap();
args.Cancel();
}

private void OnDropAttempt(EntityUid uid, PseudoItemComponent component, DropAttemptEvent args)
{
if (component.Active)
args.Cancel();
}
}

private void OnDropAttempt(EntityUid uid, PseudoItemComponent component, DropAttemptEvent args)
{
if (component.Active)
args.Cancel();
}
private void OnDoAfter(EntityUid uid, PseudoItemComponent component, DoAfterEvent args)
{
if (args.Handled || args.Cancelled || args.Args.Used == null)
return;
private void OnDoAfter(EntityUid uid, PseudoItemComponent component, DoAfterEvent args)
{
if (args.Handled || args.Cancelled || args.Args.Used == null)
return;

args.Handled = TryInsert(args.Args.Used.Value, uid, component);
}
args.Handled = TryInsert(args.Args.Used.Value, uid, component);
}

public bool TryInsert(EntityUid storageUid, EntityUid toInsert, PseudoItemComponent component, StorageComponent? storage = null)
{
if (!Resolve(storageUid, ref storage))
return false;
public bool TryInsert(EntityUid storageUid, EntityUid toInsert, PseudoItemComponent component,
StorageComponent? storage = null)
{
if (!Resolve(storageUid, ref storage))
return false;

if (component.Size > storage.StorageCapacityMax - storage.StorageUsed)
return false;
if (component.Size > storage.StorageCapacityMax - storage.StorageUsed)
return false;

var item = EnsureComp<ItemComponent>(toInsert);
_tagSystem.TryAddTag(toInsert, PreventTag);
var item = EnsureComp<ItemComponent>(toInsert);
_tagSystem.TryAddTag(toInsert, PreventTag);
_itemSystem.SetSize(toInsert, component.Size, item);

if (!_storageSystem.Insert(storageUid, toInsert, out _, storageComp: storage))
{
component.Active = false;
RemComp<ItemComponent>(toInsert);
return false;
}
if (!_storageSystem.Insert(storageUid, toInsert, out _, null, storage))
{
component.Active = false;
RemComp<ItemComponent>(toInsert);
return false;
}

component.Active = true;
Transform(storageUid).AttachToGridOrMap();
return true;
component.Active = true;
return true;
}

}
private void StartInsertDoAfter(EntityUid inserter, EntityUid toInsert, EntityUid storageEntity, PseudoItemComponent? pseudoItem = null)
private void StartInsertDoAfter(EntityUid inserter, EntityUid toInsert, EntityUid storageEntity,
PseudoItemComponent? pseudoItem = null)
{
if (!Resolve(toInsert, ref pseudoItem))
return;

var ev = new PseudoItemInsertDoAfterEvent();
var args = new DoAfterArgs(EntityManager, inserter, 5f, ev, toInsert, toInsert, storageEntity)
{
if (!Resolve(toInsert, ref pseudoItem))
return;
BreakOnTargetMove = true,
BreakOnUserMove = true,
NeedHand = true
};

_doAfter.TryStartDoAfter(new DoAfterArgs(EntityManager, inserter, 5f, new PseudoDoAfterEvent(), toInsert, target: toInsert, used: storageEntity)
{
BreakOnTargetMove = true,
BreakOnUserMove = true,
NeedHand = true
});
}
_doAfter.TryStartDoAfter(args);
}

private void OnInsertAttempt(EntityUid uid, PseudoItemComponent component,
ContainerGettingInsertedAttemptEvent args)
{
if (!component.Active)
return;
// This hopefully shouldn't trigger, but this is a failsafe just in case so we dont bluespace them cats
args.Cancel();
}
}
2 changes: 1 addition & 1 deletion Content.Server/_NF/SizeAttribute/SizeAttributeSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Robust.Shared.Physics;
using Robust.Shared.Physics.Collision.Shapes;
using Robust.Shared.Physics.Systems;
using Content.Server.Item.PseudoItem;
using Content.Shared.Item.PseudoItem;

namespace Content.Server.SizeAttribute
{
Expand Down
15 changes: 15 additions & 0 deletions Content.Shared/Nyanotrasen/Item/Components/PseudoItemComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Content.Shared._NF.Cloning;

namespace Content.Shared.Item.PseudoItem;
/// <summary>
/// For entities that behave like an item under certain conditions,
/// but not under most conditions.
/// </summary>
[RegisterComponent]
public sealed partial class PseudoItemComponent : Component, ITransferredByCloning
{
[DataField("size")]
public int Size = 120;

public bool Active = false;
}
10 changes: 10 additions & 0 deletions Content.Shared/Nyanotrasen/Item/PseudoItemInsertDoAfterEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Robust.Shared.Serialization;
using Content.Shared.DoAfter;

namespace Content.Shared.Item.PseudoItem;


[Serializable, NetSerializable]
public sealed partial class PseudoItemInsertDoAfterEvent : SimpleDoAfterEvent
{
}
4 changes: 4 additions & 0 deletions Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Content.Shared.Implants.Components;
using Content.Shared.Interaction;
using Content.Shared.Item;
using Content.Shared.Item.PseudoItem;
using Content.Shared.Lock;
using Content.Shared.Placeable;
using Content.Shared.Popups;
Expand Down Expand Up @@ -439,6 +440,9 @@ public void TransferEntities(EntityUid source, EntityUid target, EntityUid? user

foreach (var entity in entities.ToArray())
{
if (HasComp<PseudoItemComponent>(entity)) // Nyanotrasen - They dont transfer properly
continue;

Insert(target, entity, out _, user: user, targetComp, playSound: false);
}

Expand Down
4 changes: 3 additions & 1 deletion Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Content.Shared.Gravity;
using Content.Shared.Hands;
using Content.Shared.Hands.Components;
using Content.Shared.Item; // Delta-V: Felinids in duffelbags can't shoot.
using Content.Shared.Popups;
using Content.Shared.Projectiles;
using Content.Shared.Tag;
Expand Down Expand Up @@ -128,7 +129,8 @@ private void OnShootRequest(RequestShootEvent msg, EntitySessionEventArgs args)

if (user == null ||
!_combatMode.IsInCombatMode(user) ||
!TryGetGun(user.Value, out var ent, out var gun))
!TryGetGun(user.Value, out var ent, out var gun) ||
HasComp<ItemComponent>(user)) // Delta-V: Felinids in duffelbags can't shoot.
{
return;
}
Expand Down
8 changes: 7 additions & 1 deletion Resources/Locale/en-US/_NF/chat/managers/chat_manager.ftl
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
chat-speech-verb-vulpkanin-1 = rawrs
chat-speech-verb-vulpkanin-2 = barks
chat-speech-verb-vulpkanin-3 = rurs
chat-speech-verb-vulpkanin-4 = yeeps
chat-speech-verb-vulpkanin-4 = yaps
chat-speech-verb-vulpkanin-5 = yeeps
chat-speech-verb-felinid-1 = mraows
chat-speech-verb-felinid-2 = mews
chat-speech-verb-felinid-3 = meows
chat-speech-verb-felinid-4 = purrs out
Loading

0 comments on commit 2e22265

Please sign in to comment.