-
Notifications
You must be signed in to change notification settings - Fork 243
[FIX] More fix #2646
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
CrimeMoot
wants to merge
11
commits into
AdventureTimeSS14:master
Choose a base branch
from
CrimeMoot:MASS_FIXX
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.
Open
[FIX] More fix #2646
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d73dea8
add logs ComboEffect
CrimeMoot 99aacdb
stack split custom
CrimeMoot d9f0c1e
remove Pinpointer old
CrimeMoot 0129b1d
fix ShardCrystalRandom > SpawnRandomEntity
CrimeMoot 10ecdf6
fix mob Extractable
CrimeMoot c32b1ed
fix food Reptilian
CrimeMoot be2b92b
fix Tag Toolbox
CrimeMoot cdad096
tweak
CrimeMoot 0a30da0
fix LibrarianJumpsuit
CrimeMoot 4ad6f75
fix
CrimeMoot d04088f
issue
CrimeMoot 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
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
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
75 changes: 75 additions & 0 deletions
75
...nt.Shared/ADT/EntityEffects/Effects/EntitySpawning/SpawnRandomEntityEntityEffectSystem.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,75 @@ | ||
| using Content.Shared.EntityEffects; | ||
| using Robust.Shared.GameObjects; | ||
| using Robust.Shared.Network; | ||
| using Robust.Shared.Prototypes; | ||
| using Robust.Shared.Random; | ||
| using Robust.Shared.Serialization; | ||
|
|
||
| namespace Content.Shared.EntityEffects.Effects.EntitySpawning; | ||
|
|
||
| /// <summary> | ||
| /// Spawns a random entity from a list of prototypes at the coordinates of this entity. | ||
| /// Amount is modified by scale. | ||
| /// </summary> | ||
| public sealed partial class SpawnRandomEntityEntityEffectSystem : EntityEffectSystem<TransformComponent, SpawnRandomEntity> | ||
| { | ||
| [Dependency] private readonly INetManager _net = default!; | ||
| [Dependency] private readonly IPrototypeManager _prototype = default!; | ||
CrimeMoot marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| [Dependency] private readonly IRobustRandom _random = default!; | ||
|
|
||
| protected override void Effect(Entity<TransformComponent> entity, ref EntityEffectEvent<SpawnRandomEntity> args) | ||
| { | ||
| var quantity = args.Effect.Number * (int)Math.Floor(args.Scale); | ||
|
|
||
| if (!args.Effect.Predicted && !_net.IsServer) | ||
| return; | ||
|
|
||
| if (args.Effect.Prototypes == null || args.Effect.Prototypes.Count == 0) | ||
| return; | ||
|
|
||
| for (var i = 0; i < quantity; i++) | ||
| { | ||
| var protoId = _random.Pick(args.Effect.Prototypes); | ||
| if (args.Effect.Predicted) | ||
CrimeMoot marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| { | ||
| PredictedSpawnNextToOrDrop(protoId, entity, entity.Comp); | ||
| } | ||
| else | ||
| { | ||
| SpawnNextToOrDrop(protoId, entity, entity.Comp); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Effect that spawns a random entity from a list of prototypes. | ||
| /// </summary> | ||
| [DataDefinition] | ||
| public sealed partial class SpawnRandomEntity : EntityEffectBase<SpawnRandomEntity> | ||
| { | ||
| /// <summary> | ||
| /// Amount of entities we're spawning | ||
| /// </summary> | ||
| [DataField] | ||
| public int Number = 1; | ||
|
|
||
| /// <summary> | ||
| /// List of prototypes to randomly choose from when spawning. | ||
| /// </summary> | ||
| [DataField(required: true)] | ||
| public List<EntProtoId> Prototypes = new(); | ||
|
|
||
| /// <summary> | ||
| /// Whether this spawning is predicted. Set false to not predict the spawn. | ||
| /// Entities with animations or that have random elements when spawned should set this to false. | ||
| /// </summary> | ||
| [DataField] | ||
| public bool Predicted = true; | ||
|
|
||
| public override string EntityEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) | ||
| => Loc.GetString("entity-effect-guidebook-spawn-entity", | ||
| ("chance", Probability), | ||
| ("entname", Loc.GetString("entity-effect-random-item")), | ||
| ("amount", Number)); | ||
CrimeMoot marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.