-
Notifications
You must be signed in to change notification settings - Fork 524
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
1 parent
de6f811
commit 2e22265
Showing
23 changed files
with
446 additions
and
178 deletions.
There are no files selected for viewing
18 changes: 0 additions & 18 deletions
18
Content.Server/Nyanotrasen/Item/PseudoItem/PseudoItemComponent.cs
This file was deleted.
Oops, something went wrong.
253 changes: 134 additions & 119 deletions
253
Content.Server/Nyanotrasen/Item/PseudoItem/PseudoItemSystem.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 |
---|---|---|
@@ -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(); | ||
} | ||
} |
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
15 changes: 15 additions & 0 deletions
15
Content.Shared/Nyanotrasen/Item/Components/PseudoItemComponent.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,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
10
Content.Shared/Nyanotrasen/Item/PseudoItemInsertDoAfterEvent.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,10 @@ | ||
using Robust.Shared.Serialization; | ||
using Content.Shared.DoAfter; | ||
|
||
namespace Content.Shared.Item.PseudoItem; | ||
|
||
|
||
[Serializable, NetSerializable] | ||
public sealed partial class PseudoItemInsertDoAfterEvent : SimpleDoAfterEvent | ||
{ | ||
} |
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 |
---|---|---|
@@ -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 |
Oops, something went wrong.