Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local anotherPowerDownLibrary = {}
- local pm = require("playermanager")
- anotherPowerDownLibrary.enabled = true
- anotherPowerDownLibrary.customForcedState = 751
- function anotherPowerDownLibrary.onInitAPI()
- registerEvent(anotherPowerDownLibrary, "onTick", "onTick", true)
- end
- local playerData = {}
- function anotherPowerDownLibrary.onTick()
- if not isOverworld and anotherPowerDownLibrary.enabled then
- for _, p in ipairs(Player.get()) do
- local ps = PlayerSettings.get(pm.getCharacters()[p.character].base, p.CurrentPowerup)
- playerData[p] = playerData[p] or {}
- playerData[p].curState = playerData[p].curState or 0
- if p.forcedTimer == 0 then --if not in a forcedState, track player powerup
- playerData[p].curState = p.CurrentPowerup
- end
- if p.forcedState == 2 then --if powering down, change it the custom state
- if playerData[p].curState == 2 then return end --cancel if the player is big
- p.forcedState = anotherPowerDownLibrary.customForcedState
- end
- if p.forcedState == anotherPowerDownLibrary.customForcedState then --taken from modPlayer.bas, line 7477
- if p:mem(0x12E, FIELD_BOOL) == true then --ducking state, seemingly wouldn't work if using player.InDuckingPosition?
- p:mem(0x132, FIELD_BOOL, true) --standing value?? seems to corrilates to .stand in modPlayer.bas, is player.Unknown132
- p:mem(0x12E, FIELD_BOOL, false) --ducking state
- p.height = ps.hitboxDuckHeight
- p.y = p.y - ps.hitboxHeight + ps.hitboxDuckHeight
- end
- p.forcedTimer = p.forcedTimer + 1
- p.CurrentPlayerSprite = 1
- if p.forcedTimer % 5 == 0 then
- if p.CurrentPowerup == 2 then
- p.CurrentPowerup = playerData[p].curState
- else
- p.CurrentPowerup = 2
- end
- end
- if p.forcedTimer >= 50 then
- if p.CurrentPowerup == playerData[p].curState then
- p.CurrentPowerup = 2
- end
- p.BlinkTimer = 150
- p.BlinkState = true
- p.forcedState = 0
- p.forcedTimer = 0
- end
- end
- end
- end
- end
- return anotherPowerDownLibrary
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement