-
Notifications
You must be signed in to change notification settings - Fork 41
Gashaponsition #2044
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MothHours
wants to merge
5
commits into
HardLightSector:master
Choose a base branch
from
MothHours:Gashaponsition
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+531
−0
Open
Gashaponsition #2044
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
bb6b95a
Attempting to get prizeball trait working
MothHours c480989
Fixed a few minor issues
MothHours ce82ee1
Fixed some langaunge in the en localization
MothHours cc1cf12
Fixed some minor things
MothHours 52ad5b6
Actually fixed the Linter issue this time, I hope
MothHours File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
Content.Client/_HL/LewdEggLaying/Systems/PrizeballLayingSystem.cs
This file contains hidden or 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,9 @@ | ||
| using Content.Shared.Animals.Systems; | ||
|
|
||
| namespace Content.Client.Animals.Systems; | ||
|
|
||
| // This is just an empty class so that the matching code in SharedPrizeballLayingSystem can run on the client. | ||
| public sealed class PrizeballLayingSystem : SharedPrizeballLayingSystem | ||
| { | ||
|
|
||
| } |
This file contains hidden or 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,26 @@ | ||
| using Content.Shared.EntityEffects; | ||
| using Content.Shared.Animals.Components; // HL: Moved the LewdEggLayingComponent to Shared | ||
| using Content.Server.Animals.Systems; | ||
| using Robust.Shared.Prototypes; | ||
|
|
||
| namespace Content.Server.EntityEffects.Effects | ||
| { | ||
| /// <summary> | ||
| /// Attempts to find a prizeball laying component and triggers its effects | ||
| /// </summary> | ||
| public sealed partial class Redeem : EntityEffect | ||
| { | ||
| public override void Effect(EntityEffectBaseArgs args) | ||
| { | ||
| var entman = args.EntityManager; | ||
| if (entman.TryGetComponent(args.TargetEntity, out PrizeballLayingComponent? egglaying)) | ||
| { | ||
| float amt = (args is EntityEffectReagentArgs reagentArgs) ? (float) reagentArgs.Quantity : 1.0f; | ||
| entman.System<PrizeballLayingSystem>().Redeem(args.TargetEntity, amt, egglaying); | ||
| } | ||
| } | ||
|
|
||
| protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) | ||
| => Loc.GetString("reagent-effect-guidebook-redeem", ("chance", Probability)); | ||
| } | ||
| } | ||
208 changes: 208 additions & 0 deletions
208
Content.Server/_Hardlight/LewdEgglaying/Systems/PrizeballLayingSystem.cs
This file contains hidden or 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,208 @@ | ||
| using Content.Shared.Actions; | ||
| using Content.Shared.DoAfter; | ||
| using Content.Shared.IdentityManagement; | ||
| using Content.Shared.Movement.Systems; | ||
| using Content.Shared.Storage; | ||
| using Content.Shared.Traits.Events; | ||
| using Content.Server.Popups; | ||
| using Robust.Server.Audio; | ||
| using Robust.Shared.Player; | ||
| using Robust.Shared.Random; | ||
| using Content.Shared.Animals.Systems; | ||
| using Content.Shared.Animals.Components; | ||
|
|
||
| namespace Content.Server.Animals.Systems; | ||
|
|
||
| /// <summary> | ||
| /// Gives the ability to lay pballs/other things; | ||
| /// produces endlessly if the owner does not have a HungerComponent. | ||
| /// </summary> | ||
| public sealed class PrizeballLayingSystem : SharedPrizeballLayingSystem // We've changed the base to SharedPrizeballLayingSystem so we can run the Verb drawing on the client. | ||
| { | ||
| [Dependency] private readonly IRobustRandom _random = default!; | ||
| [Dependency] private readonly SharedActionsSystem _actions = default!; | ||
| [Dependency] private readonly SharedDoAfterSystem _doAfter = default!; | ||
| [Dependency] private readonly AudioSystem _audio = default!; | ||
| [Dependency] private readonly PopupSystem _popup = default!; | ||
| [Dependency] private readonly MovementSpeedModifierSystem _movementSpeedModifier = default!; | ||
|
|
||
| public override void Initialize() | ||
| { | ||
| base.Initialize(); | ||
|
|
||
| SubscribeLocalEvent<PrizeballLayingComponent, ComponentShutdown>(OnHostShutdown); | ||
| SubscribeLocalEvent<PrizeballLayingComponent, PrizeballLayingActionEvent>(OnPballLayingAction); | ||
| SubscribeLocalEvent<PrizeballLayingComponent, PrizeballLayingDoAfterEvent>(OnPballLayingDoAfter); | ||
| SubscribeLocalEvent<PrizeballLayingComponent, PrizeballLayingInsideDoAfterEvent>(OnPballLayingInsideDoAfter); | ||
| SubscribeLocalEvent<PrizeballLayingComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshMovespeed); | ||
| } | ||
|
|
||
| private void OnHostShutdown(EntityUid user, PrizeballLayingComponent pballLaying, ComponentShutdown args) | ||
| { | ||
| _actions.RemoveAction(user, pballLaying.Action); | ||
| } | ||
|
|
||
| protected override void AttemptLayInside(Entity<PrizeballLayingComponent> user, EntityUid target) | ||
| { | ||
| var doargs = new DoAfterArgs(EntityManager, user.Owner, user.Comp.PballLayDelay, new PrizeballLayingInsideDoAfterEvent(), user.Owner, target) | ||
| { | ||
| BreakOnMove = true, | ||
| BlockDuplicate = true, | ||
| BreakOnDamage = true, | ||
| CancelDuplicate = true, | ||
| }; | ||
|
|
||
| _popup.PopupEntity(Loc.GetString("action-popup-lay-pball-inside-start", ("entity", Identity.Entity(user.Owner, EntityManager)), ("target", Identity.Entity(target, EntityManager))), user); | ||
| _doAfter.TryStartDoAfter(doargs); | ||
| } | ||
|
|
||
| private void OnRefreshMovespeed(EntityUid user, PrizeballLayingComponent pballLaying, RefreshMovementSpeedModifiersEvent args) | ||
| { | ||
| if (pballLaying.isHeavyOfPballs()) | ||
| { | ||
| args.ModifySpeed(pballLaying.PballSlowMult, pballLaying.PballSlowMult); | ||
| } | ||
| } | ||
|
|
||
| private void OnPballLayingAction(EntityUid user, PrizeballLayingComponent pballLaying, PrizeballLayingActionEvent args) | ||
| { | ||
| if (!pballLaying.hasPballs()) | ||
| { | ||
| _popup.PopupEntity(Loc.GetString("action-popup-lay-pball-no-pballs"), user, user); | ||
| return; | ||
| } | ||
|
|
||
| var doAfter = new DoAfterArgs(EntityManager, user, pballLaying.PballLayDelay, new PrizeballLayingDoAfterEvent(), user) | ||
| { | ||
| BreakOnMove = true, | ||
| BlockDuplicate = true, | ||
| BreakOnDamage = true, | ||
| CancelDuplicate = true, | ||
| }; | ||
|
|
||
| _popup.PopupEntity(Loc.GetString("action-popup-lay-pball-user-start"), user, user); | ||
| _doAfter.TryStartDoAfter(doAfter); | ||
| } | ||
|
|
||
| public void Redeem(EntityUid user, float amount, PrizeballLayingComponent? pballLaying = null) | ||
| { | ||
| if (!Resolve(user, ref pballLaying) || pballLaying.Temporary) | ||
| return; | ||
|
|
||
| amount *= pballLaying.ProductionMult; | ||
|
|
||
| bool hasPballsBefore = pballLaying.hasPballs(); | ||
| bool isHeavyBefore = pballLaying.isHeavyOfPballs(); | ||
| bool isFullBefore = pballLaying.isFullOfPballs(); | ||
|
|
||
| AddPballs(user, pballLaying, amount); | ||
|
|
||
| if(pballLaying.hasPballs() && !hasPballsBefore) | ||
| { | ||
| _popup.PopupEntity(Loc.GetString("action-popup-lay-pball-firstpball"), user, user); | ||
| _actions.AddAction(user, ref pballLaying.Action, pballLaying.ActionPrototype); | ||
| } | ||
| else if(pballLaying.isHeavyOfPballs() && !isHeavyBefore) | ||
| { | ||
| _movementSpeedModifier.RefreshMovementSpeedModifiers(user); | ||
| _popup.PopupEntity(Loc.GetString("action-popup-lay-pball-heavypballs"), user, user); | ||
| } | ||
| else if(pballLaying.isFullOfPballs() && !isFullBefore) | ||
| { | ||
| _popup.PopupEntity(Loc.GetString("action-popup-lay-pball-fullpballs"), user, user); | ||
| } | ||
| else if(pballLaying.doFlavor()) | ||
| { | ||
| _popup.PopupEntity(Loc.GetString(_random.Pick(pballLaying.FlavorMessages)), user, user); | ||
| } | ||
| } | ||
|
|
||
| private void OnPballLayingInsideDoAfter(EntityUid user, PrizeballLayingComponent myPballs, PrizeballLayingInsideDoAfterEvent args) | ||
| { | ||
| if (args.Cancelled || args.Handled || args.Target == null) | ||
| return; | ||
|
|
||
| args.Handled = true; | ||
|
|
||
| if (myPballs.Deleted || !myPballs.hasPballs()) | ||
| { | ||
| _popup.PopupEntity(Loc.GetString("action-popup-lay-pball-nopballs"), user, user); | ||
| return; | ||
| } | ||
| var target = args.Target.Value; | ||
|
|
||
| _audio.PlayPvs(myPballs.PballLaySound, user); | ||
|
|
||
| if (!TryComp<PrizeballLayingComponent>(target, out var theirPballs)) | ||
| { | ||
| theirPballs = (PrizeballLayingComponent)Factory.GetComponent(Factory.GetComponentName<PrizeballLayingComponent>()); | ||
| EntityManager.AddComponent(target, theirPballs); | ||
| theirPballs.makeTempFrom(myPballs); | ||
| _actions.AddAction(target, ref theirPballs.Action, theirPballs.ActionPrototype); | ||
| } | ||
|
|
||
| /// HL: Moved the AddPballs to a helper function so we can share the pballs count in the component to the client | ||
| AddPballs(user, myPballs, -1.0f); | ||
| AddPballs(target, theirPballs, 1.0f); | ||
|
|
||
| _movementSpeedModifier.RefreshMovementSpeedModifiers(user); | ||
| _movementSpeedModifier.RefreshMovementSpeedModifiers(target); | ||
|
|
||
| if(myPballs.hasPballs()) | ||
| { | ||
| _popup.PopupEntity(Loc.GetString("action-popup-lay-pball-inside-give-more", ("entity", Identity.Entity(target, EntityManager))), user, user); | ||
| _popup.PopupEntity(Loc.GetString("action-popup-lay-pball-inside-receive-more", ("entity", Identity.Entity(user, EntityManager))), target, target); | ||
| args.Repeat = true; | ||
| } | ||
| else | ||
| { | ||
| _popup.PopupEntity(Loc.GetString("action-popup-lay-pball-inside-give-done", ("entity", Identity.Entity(target, EntityManager))), user, user); | ||
| _popup.PopupEntity(Loc.GetString("action-popup-lay-pball-inside-receive-done", ("entity", Identity.Entity(user, EntityManager))), target, target); | ||
|
|
||
| if(myPballs.Temporary) | ||
| RemComp<PrizeballLayingComponent>(user); | ||
| else | ||
| _actions.RemoveAction(user, myPballs.Action); | ||
| } | ||
| } | ||
|
|
||
| private void OnPballLayingDoAfter(EntityUid user, PrizeballLayingComponent pballLaying, PrizeballLayingDoAfterEvent args) | ||
| { | ||
| if (args.Cancelled || args.Handled) | ||
| return; | ||
|
|
||
| args.Handled = true; | ||
|
|
||
| if (pballLaying.Deleted || !pballLaying.hasPballs()) | ||
| { | ||
| _popup.PopupEntity(Loc.GetString("action-popup-lay-pball-nopballs"), user, user); | ||
| return; | ||
| } | ||
|
|
||
| foreach (var ent in EntitySpawnCollection.GetSpawns(pballLaying.EggSpawn, _random)) | ||
| { | ||
| Spawn(ent, Transform(user).Coordinates); | ||
| } | ||
|
|
||
| _audio.PlayPvs(pballLaying.PballLaySound, user); | ||
|
|
||
| AddPballs(user, pballLaying, -1.0f); | ||
| _movementSpeedModifier.RefreshMovementSpeedModifiers(user); | ||
|
|
||
| if(pballLaying.hasPballs()) | ||
| { | ||
| _popup.PopupEntity(Loc.GetString("action-popup-lay-pball-user-more"), user, user); | ||
| args.Repeat = true; | ||
| } | ||
| else | ||
| { | ||
| _popup.PopupEntity(Loc.GetString("action-popup-lay-pball-user-done"), user, user); | ||
|
|
||
| if(pballLaying.Temporary) | ||
| EntityManager.RemoveComponent<PrizeballLayingComponent>(user); | ||
| else | ||
| _actions.RemoveAction(user, pballLaying.Action); | ||
| } | ||
| _popup.PopupEntity(Loc.GetString("action-popup-lay-pball-others", ("entity", user)), user, Filter.PvsExcept(user), true); | ||
| } | ||
| } |
129 changes: 129 additions & 0 deletions
129
Content.Shared/_Hardlight/LewdEgglaying/Components/PrizeballLayingComponent.cs
This file contains hidden or 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,129 @@ | ||
| using Content.Shared.Storage; | ||
| using Robust.Shared.Audio; | ||
| using Robust.Shared.GameStates; | ||
| using Robust.Shared.Prototypes; | ||
| using Content.Shared.Animals.Systems; | ||
|
|
||
| namespace Content.Shared.Animals.Components; // Moved this to Shared so the client can use it for verb drawing. | ||
|
|
||
| /// <summary> | ||
| /// This component handles prizeball laying for the prizeball layer trait | ||
| /// </summary> | ||
|
|
||
| [RegisterComponent, NetworkedComponent, AutoGenerateComponentState(fieldDeltas: true)] | ||
| public sealed partial class PrizeballLayingComponent : Component | ||
| { | ||
| [DataField] | ||
| public EntProtoId ActionPrototype = "ActionLayPrizeball"; | ||
|
|
||
| [DataField] | ||
| public EntityUid? Action; | ||
|
|
||
| /// <summary> | ||
| /// Messages while producing prizeballs | ||
| /// </summary> | ||
| [DataField] | ||
| public IReadOnlyList<string> FlavorMessages = new[] | ||
| { | ||
| "action-popup-lay-pball-flavor-1", | ||
| "action-popup-lay-pball-flavor-2", | ||
| "action-popup-lay-pball-flavor-3", | ||
| "action-popup-lay-pball-flavor-4" | ||
| }; | ||
|
|
||
| /// <summary> | ||
| /// The item that gets laid/spawned, retrieved from animal prototype. | ||
| /// </summary> | ||
| [DataField(required: true)] | ||
| public List<EntitySpawnEntry> EggSpawn = new(); | ||
|
|
||
| /// <summary> | ||
| /// The sound played when prizeball pops out | ||
| /// </summary> | ||
| [DataField] | ||
| public SoundSpecifier PballLaySound = new SoundPathSpecifier("/Audio/Machines/machine_vend.ogg"); | ||
|
|
||
| /// <summary> | ||
| /// How many prizeballs produced per unit of cum | ||
| /// </summary> | ||
| [DataField] | ||
| public float ProductionMult = 0.2f; | ||
|
|
||
| /// <summary> | ||
| /// How many prizeballs between each flavor text | ||
| /// </summary> | ||
| [DataField] | ||
| public float FlavorFreq = 6.0f; | ||
|
|
||
| /// <summary> | ||
| /// The number of pballs when movespeed is slowed | ||
| /// </summary> | ||
| [DataField] | ||
| public float PballSlowThreshold = 10; | ||
|
|
||
| /// <summary> | ||
| /// The max number of prizeballs you can hold | ||
| /// </summary> | ||
| [DataField] | ||
| public float MaxPballs = 24; | ||
|
|
||
| /// <summary> | ||
| /// How much the user is slowed by prizeballs | ||
| /// </summary> | ||
| [DataField] | ||
| public float PballSlowMult = 0.5f; | ||
|
|
||
| /// <summary> | ||
| /// How long it takes for the prizeball to come out | ||
| /// </summary> | ||
| [DataField] | ||
| public float PballLayDelay = 5.0f; | ||
|
|
||
| /// <summary> | ||
| /// The number of prizeballs in your belly | ||
| /// </summary> | ||
| [DataField, AutoNetworkedField] | ||
| public float pballs = 0; | ||
|
|
||
| /// <summary> | ||
| /// The number of prizeballs produced since last flavor text | ||
| /// </summary> | ||
| public float pballsFlavorAccum = 0; | ||
|
|
||
| /// <summary> | ||
| /// The number of prizeballs produced since last flavor text | ||
| /// </summary> | ||
| public bool Temporary = false; | ||
| public bool hasPballs() | ||
| { | ||
| return pballs >= 1.0f; | ||
| } | ||
| public bool isHeavyOfPballs() | ||
| { | ||
| return pballs >= PballSlowThreshold; | ||
| } | ||
| public bool isFullOfPballs() | ||
| { | ||
| return pballs >= MaxPballs; | ||
| } | ||
| public bool doFlavor() | ||
| { | ||
| if(pballsFlavorAccum >= FlavorFreq) | ||
| { | ||
| pballsFlavorAccum -= FlavorFreq; | ||
| return true; | ||
| } | ||
| return false; | ||
| } | ||
| public void makeTempFrom(PrizeballLayingComponent other) | ||
| { | ||
| FlavorMessages = other.FlavorMessages; | ||
| EggSpawn = other.EggSpawn; | ||
| PballLaySound = other.PballLaySound; | ||
| PballSlowThreshold = other.PballSlowThreshold; | ||
| MaxPballs = other.MaxPballs; | ||
| PballSlowMult = other.PballSlowMult; | ||
| PballLayDelay = other.PballLayDelay; | ||
| Temporary = true; | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for HL comments in HL namespace