-
Notifications
You must be signed in to change notification settings - Fork 1
Player Handling
Procedurline also provides its users with facilities to modify graphical aspects of the player. This functionality is contained in the PlayerManager
class, an instance of which can be obtained using the ProcedurlineModule
. Currently, its primary purpose is to allow for the modification of the player's hair using three IDataProcessor
s.
This CompositeDataProcessor<Player, VoidBox, PlayerHairSettingsData>
allows for the modification of the player's hair's settings by modifying the values in the referenced PlayerHairSettingsData
which is given as an argument. PlayerHairSettingsData
holds values such as the number of hair nodes, and step values and vectors using which the hair's physics are simulated.
This processor will be called every frame, and as such isn't given a scope key, though do not rely on this behavior, and ensure that if a ScopeKey
were to be given, it would be properly handled!
This CompositeDataProcessor<Player, VoidBox, PlayerHairColorData>
allows one to override the player's hair color in various states. In contrast to simply hooking PlayerHair.GetColor
, this mechanism overrides the source values used by the player code to set the hair's color, and as such correctly deals with color interpolation. PlayerHairColorData
also contains helper methods to e.g. easily apply a color matrix to all colors.
This processor will be called every frame, and as such isn't given a scope key, though do not rely on this behavior, and ensure that if a ScopeKey
were to be given, it would be properly handled!
This CompositeDataProcessor<PlayerHair, int, PlayerHairNodeData>
allows one to modify the attributes of a hair node, like color, scale and texture, before it is rendered.
This processor will be called every frame, and as such isn't given a scope key, though do not rely on this behavior, and ensure that if a ScopeKey
were to be given, it would be properly handled!
In contrast to other sprites, PlayerSprite
s also have some metadata attached to every frame of their animations, like if it has hair, or the Y coordinate offset at which grabbed objects should be positioned. To properly deal with this metadata, Procedurline contains a subclass of Sprite.Animation
called PlayerSpriteAnimation
, and a subclass of SpriteAnimationData
called PlayerSpriteAnimationData
. These classes contain an additional array of PlayerSpriteAnimationFrameData
structures, which contain all the metadata for a specific frame. Getting the animation data, and creating animations from these classes will result in an instance of the respective other class, containing the same metadata.
The PlayerManager
then replaces all Sprite.Animation
s of PlayerSprite
s after construction with PlayerSpriteAnimation
instances (warning if a conflict with another mod was detected), and using the data it stores when possible. As such, e.g. dynamic sprite processors are able to access and modify the animation's metadata by checking if the sprite animation data is an instance of PlayerSpriteAnimationData
.
For custom sprite animations which wish to modify this data as well, Procedurline provides the IPlayerSpriteAnimation
interface. If this interface is implemented by a Sprite.Animation
instance, Procedurline will utilize it to obtain the animation's metadata. This same interface can also be implemented by SpriteAnimationData
subclasses to be utilized during sprite animation creation.