Some sort of object associated to players, similarish to maids, which enables you to apply temp effects (such as speed, health, size, camera, body transparency, etc)
An easy way to 'revert' to the original state, for everything and/or specific items
Have server changes replicate to client one?
Some predefined params (like health, speed, etc) and custom ones (like an apply and remove function)
Consider up and down tendencies (for instance, one buff may want to increase speed by 10 (from 16 to 26) but only works after buffs with forced down speed of 0 have been removed)
To do:
[x] Setup a single Buff object module which tracks players internally
[x] actions - a function with which applies a value
[x] increment
[x] set
[x] consider a custom fade function
[x] custom function
[x] Consider and act more strongly about reset on spawn
[x] if true, clearing the buffs should do nothing, else if false then the buffs surely need to be reapplied?
[x] How does this tie-in with tasks which have different persistences (e.g. some while alive, some when respawn, some continue)
[x] How is the base value decided?
[x] for instance, what to do in scenarious where the property values change outside of buff (such as for health regeneration)
[x] maybe getpropertychangedsignal?
[x] For numbers calculate the difference between the current value and buff value
[x] For fixed values simply record the default value when the very first buff is applied. Once all buffs have been removed, 'forget' the default value.
[x] weight
[x] if not specified defaults to 1
[x] buffs of higher weights have higher priority
[x] if buffs have same weight, buffs created more recently take higher priority
[x] Now setup the reduce and applier:
[x] consider weights
[x] consider default/difference values
[x] if 'override' present in any buffs then only apply the buff with override and the highest weight (or clock value)
[x] ensure increment only works for number values (do consider some may have tables such as BodyGroupTransparency)
[x] when reduceAndUpdate is called, if a buff already has a 'difference' value, then deduct that from the finalValue
[x] setup a maid (which is given to the main maid) for every reduceAndUpdate
[x] setup tweens. give the new maid a 'cleanup function' that cancels and destroys these tweens, and also sets the propertys value and difference value to the end of tween value
[x] make sure to update assassinate so it accounts for new difference/original/base values
[x] apply default value for non-numerical items
[x] apply default value for numerical items
[x] effects - a function which returns a property or a table of properties
[x] health
[x] speed
[x] jump
[x] transparency -- records each individual partTransparency
[x] bodyGroupTransparency
[x] classTransparency -- transparency of classes (e.g. accessories)
[x] material -- this may require forcing parts on top, see hd admin, must work for glass, neon, etc
[x] bodyGroupMaterial
[x] reflectance
[x] custom function
[x] shirt
[x] pants
[x] appearance (humanoiddescription)
[x] face
[x] value
[x] can also be a table
[x] consider how this works inline with effects and actions (e.g. bodyGroupTransparency)
[x] buff:destroy/Destroy()
[x] buffs should not just be 'applied' and 'removed', all their effects should be reduced in a central environment (i.e. when a buff new or destroyed), reset players effects and apply again in central environment
[x] increment must only be used on numbers
[x] fix logic:
[x] 'instance name' should not be used as a key - instead create a table where the instance is used as the key
[x] defaultGroup[additionalString] (i.e. non-numerical items) should also be recording the specific instance (otherwise how can individual colors, transparencies, etc be remembered when applying to a whole body then reverting)
[x] when a player respawns, always assassinate all buffs, but if 'remain' is true, then create new buffs of the same values (this means instance keys remain up to date)
[x] ammend numerical calculations
[x] instead of recording the 'difference', record 'appliedValue'
[x] if appliedValue is nil, then increment property by value
[x] if appliedValue is different to buff value, then increment the difference between that
[x] else do nothing
[x] consider what happens if changing between :set :increment etc
[x] ok do this instead: record 'previousOverride' - if this is different (and not nil) and applied value and buff value are different two, then at the top, set previousOverride to nil and take away previousOverride from the finalValue
[x] add decrement and tweenDecrement
[x] have the agent automatically tracked and destroyed when player removing
[x] have destroyed reversion values reduced inside the main method
[x] have a .destroyed property set to true when buff destroyed
[x] nilling of buff should be handled in the reducer
[x] if destroyed buff in reducer, should it be ignored from buffs array?
[x] this should now enable the tween effect to appear
[x] test
[x] test buff modifications after applied
[x] applying multiple of the same buffs, then removing these
[x] retest all the tests with the new destroy reductions in the main method
[x] also ensure all buffs are destroyed correctly under different circumstances
[x] setting colors does not appear to work?
[x] resetting with a buffs
[x] tweening while died/respawning?
[x] introduce a canBeNegative bool for numerical effects which prevents/allows value differences calculating past -0
[x] the current test setup does not apply values correctly after reset
[x] if died while tweening buff and keep on respawn true then does not persist
[x] all effects
[x] setup cloneable parts for MATERIAL and COLOR
[x] if the corresponding part changed (e.g. color, transparency, material, size, etc), do same for clone
[x] have cloned parts removed when no longer needed
[x] organise cloning of parts into a method in BodyUtil
[x] face transparency
[x] get head and face to work too
[x] test for r15 and r6
[x] consider how to combine transparency with material, reflectance, etc
[x] all actions (such as tweens)
[x] health regeneration
[x] applying multiple effects at once
[x] applying same effects but different additional
[x] remove buffs incrementally
[x] removing set buffs
[x] lots of random combos
[x] if player leaves game it errors (maybe silently kill buffs)
[x] convert to new head for Agent/Buff
[x] ensure all buffs are destroyed when task killed
[x] Have a task:buff(...) method which abstracts user agent and creates a buff based upon the task.callerUserIdtask:buff("Health"):set(50)
[x] also consider abstracting task.maid:give() to task:give()
[x] consider making into a package
[x] also consider updating the 'remotes' package so it has a more flexible or auto generated parent folder
Client stuff
[x] Some sort of way to dynamically create, get and remove agents?
[x] A clone system that reverts effects like transparencies etc which may be applied
Notes:
To do:
agent:buff("Health"):increment(50)
agent:buff("Health"):increment(15)
agent:buff("WalkSpeed", 5):set(0)
agent:buff("WalkSpeed", 1):set(40)
agent:buff("BodyTransparency"):set(1)
agent:buff("BodyGroupTransparency", "LeftArm"):set(0.5, TweenInfo.new())
agent:buff("BodyGroupTransparency", 5, "LeftArm"):increment(0.5, TweenInfo.new())
task:buff(...)
method which abstracts user agent and creates a buff based upon thetask.callerUserId
task:buff("Health"):set(50)
task.maid:give()
totask:give()
Client stuff