-
Notifications
You must be signed in to change notification settings - Fork 97
Add customisability for surface index dust particles #867
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
Add customisability for surface index dust particles #867
Conversation
microlith57
left a comment
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.
- good idea, thanks for implementing this!
- not so keen on the idea of defining custom particletypes in the tileset xml; there really ought to be eg. a
ParticleTypes.xmlfor that specific purpose - would it be possible for modded entities to choose to have a custom particle type per entity? eg. a block with an instance field
Color dustColorfor the dust created when climbing / landing on that block- maybe this could be a component with a callback?
I think so, but I'll figure it out later when I get to it. |
|
@SilverDorian46 Any updates on this PR? |
not really |
|
Considering this isn't finished yet, I think the PR should be changed to a draft, would you agree? |
|
Due to a lack of activity, we decided to close this PR. Please reopen the PR or make a new one if this feature will be picked up again in the future. |
Jumping off, landing on the top, or sliding down the side of a Platform will make dust particles appear. In vanilla, the same dust particles are used for every surface index except the Glitch one (used in
sci-fitiles), which uses different particles. This is tied to surface index, instead of tile type as one would likely expect, but that does mean it applies across every sort of Platform.These additions allow mappers to define their own dust particle types for use with their tilesets. As this is tied to surface indices, the
soundattribute will still be required, and it is recommended to set its value greater than the range that is already defined (50is a good number to start from). The new attributes forTilesetare as follows:soundParam: Makes this surface index play a different sound, by setting the"surface_index"parameter to the value. For example, setting a value of"40"makes it play the Glitch sound. The purpose of this is to make new surface indices play already existing sounds without having to set up a different event for them. This is also useful in cases where a different event is used with thesoundPathattribute.dustParticles: Assigns a dust particle type for this surface index. This links to an element of the same name as the value, defined as a child node of aDustParticleselement. The setup for that will be explained below.After defining the
Tilesetelements withdustParticles, mappers will need to create a new separate element on the same level (should be a direct child ofData) namedDustParticles. This will hold child elements that each represent a particle type. The name of each child element is linked to by the respectivedustParticlesattribute in aTileset, allowing for reuse. The attributes for child elements ofDustParticlesare as follows:copy: By default, dust particle types copy fromParticleTypes.Dust. However, if this attribute is defined, the value indicates which particle type to copy from. An element of the same name as the value must be defined before this element. Exceptions include the preset valuesDustandSparkyDust, which makes the particle type copy fromParticleTypes.DustandParticleTypes.SparkyDustrespectively. Note thatSparkyDustitself copies fromDust, albeit with its own values. This input is case-insensitive.sourceChooser: Provides a set of textures for each particle of this type to randomly choose from. In the same way as defining an animation, this looks for numbered textures in a given path. The value is the path to those textures, relative to theGameplayatlas. For particle types copying fromDust(by default), the value is equivalent to"particles/smoke", and for those copying fromSparkyDust,"particles/zappySmoke".color: Gives this particle type a colour through a hexadecimal value. Particle types copying fromDust(by default) have the value of"ffffff", while those copying fromSparkyDusthave the value of"5be1cd".color2: Gives this particle type a secondary colour through a hexadecimal value. By default, the value is"ffffff", but particle types copying fromSparkyDusthave the value of"aafab6".colorMode: Defines how the colours of this particle type are handled. This accepts one of four values (case-insensitive):"Static","Choose","Blink", and"Fade". The default value is"Static", but particle types copying fromSparkyDusthave the value of"Blink"."Static"sets the particle colour tocolor."Choose"randomly chooses betweencolorandcolor2for each particle."Blink"swaps the particle colour betweencolorandcolor2every tenth of a second."Fade"makes the particle colour fade fromcolortocolor2from start to end of life.wallSlideOffsetX: When the player slides down a wall, the position of the emitted particles differs depending on the particle type. The vanilla code checks for whether the particle is of typeParticleTypes.Dust, and if so, it is offset by5pixels in the X-axis from the player's center, otherwise it is offset by2pixels. As a result, theDustparticles are emitted further into the wall than theSparkyDustparticles. This attribute allows setting a number of pixels in the X-axis relative to the player's center, to customise how far into the wall to emit the particles.On the side of Everest, we create the dictionaries
SurfaceIndex.IndexToSoundParamandSurfaceIndex.IndexToDustParticlesto add thesoundParamand dust particle type definitions into respectively, as well as the dictionarySurfaceIndex.DustParticlesToWallSlideOffsetXfor the particle offsets while sliding down a wall.SurfaceIndex.GetSoundParamFromIndexmethod, working alongsideSurfaceIndex.GetPathFromIndex, to modify the value to which the"sound_index"audio parameter is set, with the original value as a fallback.DustParticleFromSurfaceIndexnow uses ourSurfaceIndex.GetDustParticleTypeFromIndexat the start to check if the index has a defined dust particle type. If the check passes, that particle type is returned, and if it fails, the rest of the method is run.CreateWallSlideParticlesnow uses a patch method to try to retrieve a value from theSurfaceIndex.DustParticlesToWallSlideOffsetXdictionary. If no value is retrieved, or if the particle is not a custom dust particle type, then it falls back to the original assignment.As always, feedback on the implementation, as well as additional testing and any changes to suggest, would be appreciated.
Resolves: #748