1
0
Fork 0

Not like this, not like this!

This commit is contained in:
Akira Olivia Pink 2025-04-20 15:03:10 -03:00
parent 1b401f32bc
commit e36e5d3eae
79 changed files with 56114 additions and 24 deletions

2
.obsidian/app.json vendored
View file

@ -1,3 +1,3 @@
{
"readableLineLength": false
"readableLineLength": true
}

View file

@ -1,5 +1,5 @@
{
"accentColor": "#ff24a4",
"accentColor": "#e7a923",
"cssTheme": "Lumines",
"interfaceFontFamily": "Inter,Work Sans,Inter Frozen,Aptos Narrow,Averia Libre,B612,Minecraft Seven v2",
"textFontFamily": "Inter,Work Sans,Inter Frozen,Aptos Narrow,Averia Libre,B612,Minecraft Seven v2",

View file

@ -13,12 +13,12 @@
"state": {
"type": "markdown",
"state": {
"file": "writings/SharedCollective/Story Overture.md",
"file": "writings/SharedCollective/Story Overture (copy).md",
"mode": "source",
"source": false
},
"icon": "lucide-file",
"title": "Story Overture"
"title": "Story Overture (copy)"
}
}
]
@ -151,10 +151,10 @@
"command-palette:Open command palette": false
}
},
"active": "5fa6f35bf176de81",
"active": "450f6f981a62c1a1",
"lastOpenFiles": [
"writings/SharedCollective/Story Overture (copy).md",
"writings/SharedCollective/Story Overture.md",
"writings/SharedCollective/Story Overture (copy).md",
"writings/SharedCollective/Mandarin Labs.md",
"writings/SharedCollective/Missy's Talk - Life, Identity, Death.md",
"writings/SharedCollective/Federal Bureau of Xenorelations.md",

View file

@ -20,8 +20,23 @@
"icon": "lucide-file",
"title": "Story Overture (copy)"
}
},
{
"id": "9838d81e3d14d8d7",
"type": "leaf",
"state": {
"type": "markdown",
"state": {
"file": "writings/SharedCollective/Story Overture (copy).md",
"mode": "source",
"source": false
},
"icon": "lucide-file",
"title": "Story Overture (copy)"
}
}
]
],
"currentTab": 1
}
],
"direction": "vertical"
@ -56,7 +71,7 @@
"query": "",
"matchingCase": false,
"explainSearch": false,
"collapseAll": false,
"collapseAll": true,
"extraContext": false,
"sortOrder": "alphabetical"
},
@ -168,18 +183,23 @@
"command-palette:Open command palette": false
}
},
"active": "ce7a7b044ff28163",
"active": "9838d81e3d14d8d7",
"lastOpenFiles": [
"drawings/akirapink-FWD-astra_underscore-astraverse.aseprite",
"writings/SharedCollective/Story Overture.md",
"writings/SharedCollective/Obesk Embassy.md",
"writings/SharedCollective/Story Overture (copy).md",
"drawings/com_azuamdeline_sonadrawing.png",
"drawings/com_azuamdeline_sonadrawing.aseprite",
"drawings/net_Akirapink_ppdat.aseprite",
"memes/net.akirapink.gordon_secured_powered_by_the_dragon.xcf",
"TH.md",
"writings/SharedCollective/Obesk Embassy.md",
"writings/SharedCollective/Mandarin Labs.md",
"3d_models/akira/akiracombined.png",
"drawings/net_akirapink_signature_aki.png",
"writings/SharedCollective/Missy's Talk - Life, Identity, Death.md",
"writings/SharedCollective/Federal Bureau of Xenorelations.md",
"README.md",
"drawings/com_azuamdeline_sonadrawing.png",
"drawings/com_azuamdeline_sonadrawing.aseprite",
"3d_models/akira/akiracombined.png",
"drawings/net_akirapink_signature_aki.png",
"graphic_design/junk/lavender_software_business_cards/not that active here/lunanova.xcf",
"graphic_design/junk/lavender_software_business_cards/not that active here/ella.xcf",
"graphic_design/junk/lavender_software_business_cards/not that active here/earsng.xcf",
@ -187,9 +207,6 @@
"graphic_design/junk/lavender_software_business_cards/maia.xcf",
"graphic_design/junk/lavender_software_business_cards/charlotte.xcf",
"graphic_design/junk/lavender_software_business_cards/annie.xcf",
"graphic_design/junk/lavender_software_business_cards/akira.xcf",
"graphic_design/junk/lavender_software_business_cards/agatha.xcf",
"writings/SharedCollective/Missy's Talk - Life, Identity, Death.md",
"drawings/junk/net_akirapink_c_ob_what.png",
"drawings/net-akirapink-please_dont_hurt_me.png",
"drawings/net-akirapink-going_insane.png",

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 679 B

File diff suppressed because one or more lines are too long

View file

Before

Width:  |  Height:  |  Size: 3.1 MiB

After

Width:  |  Height:  |  Size: 3.1 MiB

View file

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,924 @@
-- + Made by Jimmy Hellp
-- + V6 for 0.1.0 and above
-- + Thank you GrandpaScout for helping with the library stuff!
-- + Automatically compatible with GSAnimBlend for automatic smooth animation blending
-- + Also includes Manuel's Run Later script
local animsList = {
-- Exclusive Animations
idle="idling",
walk="walking",
walkback="walking backwards",
jumpup="jumping up caused via the jump key",
jumpdown="jumping down after a jump up",
fall="falling after a while",
sprint = "sprinting",
sprintjumpup="sprinting and jumping up caused via the jump key",
sprintjumpdown="sprinting and jumping down after a jump up",
crouch = "crouching",
crouchwalk = "crouching and walking",
crouchwalkback = "crouching and walking backwards",
crouchjumpup = "crouching and jumping up caused via the jump key",
crouchjumpdown = "crouching and jumping down after a jump up",
elytra = "elytra flying",
elytradown = "flying down/diving while elytra flying",
trident = "riptide trident lunging",
sleep = "sleeping",
swim = "while swimming",
sit = "while in any vehicle or modded sitting",
sitmove = "while in any vehicle and moving",
sitmoveback = "while in any vehicle and moving backwards",
sitjumpup = "while in any vehicle and jumping up",
sitjumpdown = "while in any vehicle and jumping down",
sitpass = "while in any vehicle as a passenger",
crawl = "crawling and moving",
crawlstill = "crawling and still",
fly = "creative flying",
flywalk = "flying and moving",
flywalkback = "flying and moving backwards",
flysprint = "flying and sprinting",
flyup = "flying and going up",
flydown = "flying and going down",
climb = "climbing a ladder",
climbstill = "not moving on a ladder without crouching (hitting a ceiling usually)",
climbdown = "going down a ladder",
climbcrouch = "crouching on a ladder",
climbcrouchwalk = "crouching on a ladder and moving",
water = "being in water without swimming",
waterwalk = "in water and moving",
waterwalkback = "in water and moving backwards",
waterup = "in water and going up",
waterdown = "in water and going down",
watercrouch = "in water and crouching",
watercrouchwalk = "in water and crouching and walking",
watercrouchwalkback = "in water and crouching and walking backwards",
watercrouchdown = "in water and crouching and going down",
watercrouchup = "in water and crouching and going up. only possible in bubble columns",
hurt = "MUST BE IN PLAY ONCE LOOP MODE. when hurt",
death = "dying",
-- Inclusive Animations:
attackR = "MUST BE IN PLAY ONCE LOOP MODE. attacking with the right hand",
attackL = "MUST BE IN PLAY ONCE LOOP MODE. attacking with the left hand",
mineR = "MUST BE IN PLAY ONCE LOOP MODE. mining with the right hand",
mineL = "MUST BE IN PLAY ONCE LOOP MODE. mining with the left hand",
eatR = "eating from the right hand",
eatL = "eating from the left hand",
drinkR = "drinking from the right hand",
drinkL = "drinking from the left hand",
blockR = "blocking from the right hand",
blockL = "blocking from the left hand",
bowR = "drawing back a bow from the right hand",
bowL = "drawing back a bow from the left hand",
loadR = "loading a crossbow from the right hand",
loadL = "loading a crossbow from the left hand",
crossbowR = "holding a loaded crossbow in the right hand",
crossbowL = "holding a loaded crossbow in the left hand",
spearR = "holding up a trident in the right hand",
spearL = "holding up a trident in the left hand",
spyglassR = "holding up a spyglass from the right hand",
spyglassL = "holding up a spyglass from the left hand",
hornR = "using a horn in the right hand",
hornL = "using a horn in the left hand",
brushR = "using a brush in the right hand",
brushL = "using a brush in the left hand",
holdR = "holding an item in the right hand",
holdL = "holding an item in the left hand",
}
------------------------------------------------------------------------------------------------------------------------
local function errors(paths,dismiss)
assert(
next(paths),
"§aCustom Script Warning: §6No blockbench models were found, or the blockbench model found contained no animations. \n" .." Check that there are no typos in the given bbmodel name, or that the bbmodel has animations by using this line of code at the top of your script: \n"
.."§f logTable(animations.BBMODEL_NAME_HERE) \n ".."§6If this returns nil your bbmodel name is wrong or it has no animations. You can use \n".."§f logTable(models:getChildren()) \n".."§6 to get the name of every bbmodel in your avatar.§c"
)
for _, path in pairs(paths) do
for _, anim in pairs(path) do
if anim:getName():find("%.") and not dismiss then
error(
"§aCustom Script Warning: §6The animation §b'"..anim:getName().."'§6 has a period ( . ) in its name, the handler can't use that animation and it must be renamed to fit the handler's accepted animation names. \n" ..
" If the animation isn't meant for the handler, you can dismiss this error by adding §fanims.dismiss = true§6 after the require but before setting the bbmodel.§c")
end
end
end
end
local setAllOnVar = true
local setIncluOnVar = true
local setExcluOnVar = true
local allAnims = {}
local excluAnims = {}
local incluAnims = {}
local animsTable= {
allVar = false,
excluVar = false,
incluVar = false
}
local excluState
local incluState
local holdRanims = {}
local holdLanims = {}
local attackRanims = {}
local attackLanims = {}
local mineRanims = {}
local mineLanims = {}
local hasJumped = false
local oneJump = false
local hitBlock
local cFlying = false
local oldcFlying = cFlying
local flying = false
local updateTimer = 0
local flyinit = false
local distinit = false
local dist = 4.5
local oldDist = dist
local reach = 4.5
local yvel
local cooldown
local grounded
local oldgrounded
local fallVel = -0.6
-- wait code from Manuel
local timers = {}
local function wait(ticks,next)
table.insert(timers,{t=world.getTime()+ticks,n=next})
end
events.TICK:register(function()
for key,timer in pairs(timers) do
if world.getTime() >= timer.t then
timer.n()
timers[key] = nil
end
end
end)
--
local bbmodels = {} -- don't put things in here
function pings.JimmyAnims_cFly(x)
flying = x
end
function pings.JimmyAnims_Distance(x)
reach = x
end
function pings.JimmyAnims_Update(fly,dis)
flying = fly
reach = dis
end
local prev
local function JimmyAnims_Swing(anim)
-- test how this works with multiple bbmodels
for _,path in pairs(bbmodels) do
if path[prev] then path[prev]:stop() end
if path[anim] then path[anim]:play() end
prev = anim
end
end
local function anims()
for _, value in ipairs(allAnims) do
if value:isPlaying() then
animsTable.allVar = true
break
else
animsTable.allVar = false or not setAllOnVar
end
end
if next(allAnims) == nil then
animsTable.allVar = not setAllOnVar
end
for _, value in ipairs(excluAnims) do
if value:isPlaying() then
animsTable.excluVar = true
break
else
animsTable.excluVar = false or not setExcluOnVar
end
end
if next(excluAnims) == nil then
animsTable.excluVar = not setExcluOnVar
end
for _, value in ipairs(incluAnims) do
if value:isPlaying() then
animsTable.incluVar = true
break
else
animsTable.incluVar = false or not setIncluOnVar
end
end
if next(incluAnims) == nil then
animsTable.incluVar = not setIncluOnVar
end
excluState = not animsTable.allVar and not animsTable.excluVar
incluState = not animsTable.allVar and not animsTable.incluVar
if host:isHost() then
if flyinit and not distinit then
cFlying = host:isFlying()
if cFlying ~= oldcFlying then
pings.JimmyAnims_cFly(cFlying)
end
oldcFlying = cFlying
updateTimer = updateTimer + 1
if updateTimer % 200 == 0 then
pings.JimmyAnims_cFly(cFlying)
end
elseif distinit and not flyinit then
dist = host:getReachDistance()
if dist ~= oldDist then
pings.JimmyAnims_Distance(dist)
end
oldDist = dist
updateTimer = updateTimer + 1
if updateTimer % 200 == 0 then
pings.JimmyAnims_Distance(dist)
end
elseif distinit and flyinit then
cFlying = host:isFlying()
if cFlying ~= oldcFlying then
pings.JimmyAnims_cFly(cFlying)
end
oldcFlying = cFlying
dist = host:getReachDistance()
if dist ~= oldDist then
pings.JimmyAnims_Distance(dist)
end
oldDist = dist
updateTimer = updateTimer + 1
if updateTimer % 200 == 0 then
pings.JimmyAnims_Update(cFlying,dist)
end
end
end
local pose = player:getPose()
local velocity = player:getVelocity()
local moving = velocity.xz:length() > 0.01
local sprinty = player:isSprinting()
local vehicle = player:getVehicle()
local sitting = vehicle ~= nil or pose == "SITTING" -- if you're reading this code and see this, "SITTING" isn't a vanilla pose, this is for mods
local passenger = vehicle and vehicle:getControllingPassenger() ~= player
local creativeFlying = flying and not sitting
local standing = pose == "STANDING"
local crouching = pose == "CROUCHING" and not creativeFlying
local gliding = pose == "FALL_FLYING"
local spin = pose == "SPIN_ATTACK"
local sleeping = pose == "SLEEPING"
local swimming = pose == "SWIMMING"
local inWater = player:isUnderwater() and not sitting
local inLiquid = player:isInWater() or player:isInLava()
local liquidSwim = swimming and inLiquid
local crawling = swimming and not inLiquid
-- hasJumped stuff
yvel = velocity.y
local hover = yvel < .01 and yvel > -.01
local goingUp = yvel > .01
local goingDown = yvel < -.01
local falling = yvel < fallVel
local playerGround = world.getBlockState(player:getPos():add(0,-.1,0))
local vehicleGround = sitting and world.getBlockState(vehicle:getPos():add(0,-.1,0))
oldgrounded = grounded
grounded = playerGround:isSolidBlock() or player:isOnGround() or (sitting and vehicleGround:isSolidBlock() or sitting and vehicle:isOnGround())
local pv = velocity:mul(1, 0, 1):normalize()
local pl = models:partToWorldMatrix():applyDir(0,0,-1):mul(1, 0, 1):normalize()
local fwd = pv:dot(pl)
local backwards = fwd < -.8
--local sideways = pv:cross(pl)
--local right = sideways.y > .6
--local left = sideways.y < -.6
-- canJump stuff
local webbed = world.getBlockState(player:getPos()).id == "minecraft:cobweb"
local ladder = player:isClimbing() and not grounded and not flying
local canJump = not (inLiquid or webbed or grounded)
local hp = player:getHealth() + player:getAbsorptionAmount()
if oldgrounded ~= grounded and not grounded and yvel > 0 then
cooldown = true
wait(10,function() cooldown = false end)
end
if (oldgrounded ~= grounded and not grounded and yvel > 0) and canJump then hasJumped = true end
if (grounded and (yvel <= 0 and yvel > -0.1)) or (gliding or inLiquid) then hasJumped = false end
local neverJump = not (gliding or spin or sleeping or swimming or ladder)
local jumpingUp = hasJumped and goingUp and neverJump
local jumpingDown = hasJumped and goingDown and not falling and neverJump or (cooldown and not jumpingUp)
local isJumping = jumpingUp or jumpingDown or falling
local sprinting = sprinty and standing and not inLiquid and not sitting
local walking = moving and not sprinting and not isJumping and not sitting
local forward = walking and not backwards
local backward = walking and backwards
-- we be holding items tho
local handedness = player:isLeftHanded()
local rightActive = handedness and "OFF_HAND" or "MAIN_HAND"
local leftActive = not handedness and "OFF_HAND" or "MAIN_HAND"
local activeness = player:getActiveHand()
local using = player:isUsingItem()
local rightSwing = player:getSwingArm() == rightActive and not sleeping
local leftSwing = player:getSwingArm() == leftActive and not sleeping
local targetEntity = type(player:getTargetedEntity()) == "PlayerAPI" or type(player:getTargetedEntity()) == "LivingEntityAPI"
local targetBlock = player:getTargetedBlock(true, reach)
local swingTime = player:getSwingTime() == 1
local success, result = pcall(targetBlock.getTextures, targetBlock)
if success then hitBlock = not (next(result) == nil) else hitBlock = true end
local rightMine = rightSwing and hitBlock and not targetEntity
local leftMine = leftSwing and hitBlock and not targetEntity
local rightAttack = rightSwing and (not hitBlock or targetEntity)
local leftAttack = leftSwing and (not hitBlock or targetEntity)
local rightItem = player:getHeldItem(handedness)
local leftItem = player:getHeldItem(not handedness)
local usingR = activeness == rightActive and rightItem:getUseAction()
local usingL = activeness == leftActive and leftItem:getUseAction()
local crossR = rightItem.tag and rightItem.tag["Charged"] == 1
local crossL = leftItem.tag and leftItem.tag["Charged"] == 1
local drinkRState = using and usingR == "DRINK"
local drinkLState = using and usingL == "DRINK"
local eatRState = using and usingR == "EAT"
local eatLState = using and usingL == "EAT"
local blockRState = using and usingR == "BLOCK"
local blockLState = using and usingL == "BLOCK"
local bowRState = using and usingR == "BOW"
local bowLState = using and usingL == "BOW"
local spearRState = using and usingR == "SPEAR"
local spearLState = using and usingL == "SPEAR"
local spyglassRState = using and usingR == "SPYGLASS"
local spyglassLState = using and usingL == "SPYGLASS"
local hornRState = using and usingR == "TOOT_HORN"
local hornLState = using and usingL == "TOOT_HORN"
local loadRState = using and usingR == "CROSSBOW"
local loadLState = using and usingL == "CROSSBOW"
local brushRState = using and usingR == "BRUSH"
local brushLState = using and usingL == "BRUSH"
local exclude = not (using or crossR or crossL)
local rightHoldState = rightItem.id ~= "minecraft:air" and exclude
local leftHoldState = leftItem.id ~= "minecraft:air" and exclude
-- anim states
for _, path in pairs(bbmodels) do
local flywalkbackState = creativeFlying and backward and (not (goingDown or goingUp))
local flysprintState = creativeFlying and sprinting and not isJumping and (not (goingDown or goingUp))
local flyupState = creativeFlying and goingUp
local flydownState = creativeFlying and goingDown
local flywalkState = creativeFlying and forward and (not (goingDown or goingUp)) and not sleeping or (flysprintState and not path.flysprint) or (flywalkbackState and not path.flywalkback)
or (flyupState and not path.flyup) or (flydownState and not path.flydown)
local flyState = creativeFlying and not sprinting and not moving and standing and not isJumping and (not (goingDown or goingUp)) and not sleeping or (flywalkState and not path.flywalk)
local watercrouchwalkbackState = inWater and crouching and backward and not goingDown
local watercrouchwalkState = inWater and crouching and forward and not (goingDown or goingUp) or (watercrouchwalkbackState and not path.watercrouchwalkback)
local watercrouchupState = inWater and crouching and goingUp
local watercrouchdownState = inWater and crouching and goingDown or (watercrouchupState and not path.watercrouchup)
local watercrouchState = inWater and crouching and not moving and not (goingDown or goingUp) or (watercrouchdownState and not path.watercrouchdown) or (watercrouchwalkState and not path.watercrouchwalk)
local waterdownState = inWater and goingDown and not falling and standing and not creativeFlying
local waterupState = inWater and goingUp and standing and not creativeFlying
local waterwalkbackState = inWater and backward and hover and standing and not creativeFlying
local waterwalkState = inWater and forward and hover and standing and not creativeFlying or (waterwalkbackState and not path.waterwalkback) or (waterdownState and not path.waterdown)
or (waterupState and not path.waterup)
local waterState = inWater and not moving and standing and hover and not creativeFlying or (waterwalkState and not path.waterwalk)
local crawlstillState = crawling and not moving
local crawlState = crawling and moving or (crawlstillState and not path.crawlstill)
local swimState = liquidSwim or (crawlState and not path.crawl)
local elytradownState = gliding and goingDown
local elytraState = gliding and not goingDown or (elytradownState and not path.elytradown)
local sitpassState = passenger and standing
local sitjumpdownState = sitting and not passenger and standing and (jumpingDown or falling)
local sitjumpupState = sitting and not passenger and jumpingUp and standing or (sitjumpdownState and not path.sitjumpdown)
local sitmovebackState = sitting and not passenger and not isJumping and backwards and standing
local sitmoveState = velocity:length() > 0 and not passenger and not backwards and standing and sitting and not isJumping or (sitmovebackState and not path.sitmoveback) or (sitjumpupState and not path.sitjumpup)
local sitState = sitting and not passenger and velocity:length() == 0 and not isJumping and standing or (sitmoveState and not path.sitmove) or (sitpassState and not path.sitpass)
local tridentState = spin
local sleepState = sleeping
local climbcrouchwalkState = ladder and crouching and (moving or yvel ~= 0)
local climbcrouchState = ladder and crouching and hover and not moving or (climbcrouchwalkState and not path.climbcrouchwalk)
local climbdownState = ladder and goingDown
local climbstillState = ladder and not crouching and hover
local climbState = ladder and goingUp and not crouching or (climbdownState and not path.climbdown) or (climbstillState and not path.climbstill)
local crouchjumpdownState = crouching and jumpingDown and not ladder and not inWater
local crouchjumpupState = crouching and jumpingUp and not ladder or (not oneJump and (crouchjumpdownState and not path.crouchjumpdown))
local crouchwalkbackState = backward and crouching and not ladder and not inWater or (watercrouchwalkbackState and not path.watercrouchwalkback and not path.watercrouchwalk and not path.watercrouch)
local crouchwalkState = forward and crouching and not ladder and not inWater or (crouchwalkbackState and not path.crouchwalkback) or (not oneJump and (crouchjumpupState and not path.crouchjumpup)) or ((watercrouchwalkState and not watercrouchwalkbackState) and not path.watercrouchwalk and not path.watercrouch)
local crouchState = crouching and not walking and not isJumping and not ladder and not inWater and not cooldown or (crouchwalkState and not path.crouchwalk) or (climbcrouchState and not path.climbcrouch) or ((watercrouchState and not watercrouchwalkState) and not path.watercrouch)
local fallState = falling and not gliding and not creativeFlying and not sitting
local sprintjumpdownState = jumpingDown and sprinting and not creativeFlying and not ladder
local sprintjumpupState = jumpingUp and sprinting and not creativeFlying and not ladder or (not oneJump and (sprintjumpdownState and not path.sprintjumpdown))
local jumpdownState = jumpingDown and not sprinting and not crouching and not sitting and not gliding and not creativeFlying and not spin and not inWater or (fallState and not path.fall) or (oneJump and (sprintjumpdownState and not path.sprintjumpdown)) or (oneJump and (crouchjumpdownState and not path.crouchjumpdown))
local jumpupState = jumpingUp and not sprinting and not crouching and not sitting and not creativeFlying and not inWater or (jumpdownState and not path.jumpdown) or (tridentState and not path.trident) or (oneJump and (sprintjumpupState and not path.sprintjumpup)) or (oneJump and (crouchjumpupState and not path.crouchjumpup))
local sprintState = sprinting and not isJumping and not creativeFlying and not ladder and not cooldown or (not oneJump and (sprintjumpupState and not path.sprintjumpup))
local walkbackState = backward and standing and not creativeFlying and not ladder and not inWater or (flywalkbackState and not path.flywalkback and not path.flywalk and not path.fly)
local walkState = forward and standing and not creativeFlying and not ladder and not inWater and not cooldown or (walkbackState and not path.walkback) or (sprintState and not path.sprint) or (climbState and not path.climb)
or (swimState and not path.swim) or (elytraState and not path.elytra) or (jumpupState and not path.jumpup) or (waterwalkState and (not path.waterwalk and not path.water)) or ((flywalkState and not flywalkbackState) and not path.flywalk and not path.fly)
or (crouchwalkState and not path.crouch)
local idleState = not moving and not sprinting and standing and not isJumping and not sitting and not creativeFlying and not ladder and not inWater or (sleepState and not path.sleep) or (sitState and not path.sit)
or ((waterState and not waterwalkState) and not path.water) or ((flyState and not flywalkState) and not path.fly) or ((crouchState and not crouchwalkState) and not path.crouch)
local deadState = hp <= 0
if path.death then path.death:playing(excluState and deadState) end
-- anim play testing
if path.hurt and player:getNbt().HurtTime == 9 then
path.hurt:restart()
end
if path.idle then path.idle:playing(excluState and idleState) end
if path.walk then path.walk:playing(excluState and walkState) end
if path.walkback then path.walkback:playing(excluState and walkbackState) end
if path.sprint then path.sprint:playing(excluState and sprintState) end
if path.sprintjumpup then path.sprintjumpup:playing(excluState and sprintjumpupState) end
if path.sprintjumpdown then path.sprintjumpdown:playing(excluState and sprintjumpdownState) end
if path.crouch then path.crouch:playing(excluState and crouchState) end
if path.crouchwalk then path.crouchwalk:playing(excluState and crouchwalkState) end
if path.crouchwalkback then path.crouchwalkback:playing(excluState and crouchwalkbackState) end
if path.crouchjumpup then path.crouchjumpup:playing(excluState and crouchjumpupState) end
if path.crouchjumpdown then path.crouchjumpdown:playing(excluState and crouchjumpdownState) end
if path.jumpup then path.jumpup:playing(excluState and jumpupState) end
if path.jumpdown then path.jumpdown:playing(excluState and jumpdownState) end
if path.fall then path.fall:playing(excluState and fallState) end
if path.elytra then path.elytra:playing(excluState and elytraState) end
if path.elytradown then path.elytradown:playing(excluState and elytradownState) end
if path.trident then path.trident:playing(excluState and tridentState) end
if path.sleep then path.sleep:playing(excluState and sleepState) end
if path.swim then path.swim:playing(excluState and swimState) end
if path.sit then path.sit:playing(excluState and sitState) end
if path.sitmove then path.sitmove:playing(excluState and sitmoveState) end
if path.sitmoveback then path.sitmoveback:playing(excluState and sitmovebackState) end
if path.sitjumpup then path.sitjumpup:playing(excluState and sitjumpupState) end
if path.sitjumpdown then path.sitjumpdown:playing(excluState and sitjumpdownState) end
if path.sitpass then path.sitpass:playing(excluState and sitpassState) end
if path.crawl then path.crawl:playing(excluState and crawlState) end
if path.crawlstill then path.crawlstill:playing(excluState and crawlstillState) end
if path.fly then path.fly:playing(excluState and flyState) end
if path.flywalk then path.flywalk:playing(excluState and flywalkState) end
if path.flywalkback then path.flywalkback:playing(excluState and flywalkbackState) end
if path.flysprint then path.flysprint:playing(excluState and flysprintState) end
if path.flyup then path.flyup:playing(excluState and flyupState) end
if path.flydown then path.flydown:playing(excluState and flydownState) end
if path.climb then path.climb:playing(excluState and climbState) end
if path.climbstill then path.climbstill:playing(excluState and climbstillState) end
if path.climbdown then path.climbdown:playing(excluState and climbdownState) end
if path.climbcrouch then path.climbcrouch:playing(excluState and climbcrouchState) end
if path.climbcrouchwalk then path.climbcrouchwalk:playing(excluState and climbcrouchwalkState) end
if path.water then path.water:playing(excluState and waterState) end
if path.waterwalk then path.waterwalk:playing(excluState and waterwalkState) end
if path.waterwalkback then path.waterwalkback:playing(excluState and waterwalkbackState) end
if path.waterup then path.waterup:playing(excluState and waterupState) end
if path.waterdown then path.waterdown:playing(excluState and waterdownState) end
if path.watercrouch then path.watercrouch:playing(excluState and watercrouchState) end
if path.watercrouchwalk then path.watercrouchwalk:playing(excluState and watercrouchwalkState) end
if path.watercrouchwalkback then path.watercrouchwalkback:playing(excluState and watercrouchwalkbackState) end
if path.watercrouchdown then path.watercrouchdown:playing(excluState and watercrouchdownState) end
if path.watercrouchup then path.watercrouchup:playing(excluState and watercrouchupState) end
if path.eatR then path.eatR:playing(incluState and eatRState or (drinkRState and not path.drinkR)) end
if path.eatL then path.eatL:playing(incluState and eatLState or (drinkLState and not path.drinkL)) end
if path.drinkR then path.drinkR:playing(incluState and drinkRState) end
if path.drinkL then path.drinkL:playing(incluState and drinkLState) end
if path.blockR then path.blockR:playing(incluState and blockRState) end
if path.blockL then path.blockL:playing(incluState and blockLState) end
if path.bowR then path.bowR:playing(incluState and bowRState) end
if path.bowL then path.bowL:playing(incluState and bowLState) end
if path.loadR then path.loadR:playing(incluState and loadRState) end
if path.loadL then path.loadL:playing(incluState and loadLState) end
if path.crossbowR then path.crossbowR:playing(incluState and crossR) end
if path.crossbowL then path.crossbowL:playing(incluState and crossL) end
if path.spearR then path.spearR:playing(incluState and spearRState) end
if path.spearL then path.spearL:playing(incluState and spearLState) end
if path.spyglassR then path.spyglassR:playing(incluState and spyglassRState) end
if path.spyglassL then path.spyglassL:playing(incluState and spyglassLState) end
if path.hornR then path.hornR:playing(incluState and hornRState) end
if path.hornL then path.hornL:playing(incluState and hornLState) end
if path.brushR then path.brushR:playing(incluState and brushRState) end
if path.brushL then path.brushL:playing(incluState and brushLState) end
if path.holdR then path.holdR:playing(incluState and rightHoldState) end
if path.holdL then path.holdL:playing(incluState and leftHoldState) end
end
if swingTime then
local specialAttack = false
if rightAttack and incluState then
for _, value in pairs(attackRanims) do
if value:getName():find("ID_") then
if rightItem.id:find(value:getName():gsub("_attackR",""):gsub("ID_","")) then
JimmyAnims_Swing(value:getName())
specialAttack = true
end
elseif value:getName():find("Name_") then
if rightItem:getName():find(value:getName():gsub("_attackR",""):gsub("Name_","")) then
JimmyAnims_Swing(value:getName())
specialAttack = true
end
end
end
if not specialAttack then
JimmyAnims_Swing("attackR")
end
elseif leftAttack and incluState then
for _, value in pairs(attackLanims) do
if value:getName():find("ID_") then
if leftItem.id:find(value:getName():gsub("_attackL",""):gsub("ID_","")) then
JimmyAnims_Swing(value:getName())
specialAttack = true
end
elseif value:getName():find("Name_") then
if leftItem:getName():find(value:getName():gsub("_attackL",""):gsub("Name_","")) then
JimmyAnims_Swing(value:getName())
specialAttack = true
end
end
end
if specialAttack == false then
JimmyAnims_Swing("attackL")
end
elseif rightMine and incluState then
for _, value in pairs(mineRanims) do
if value:getName():find("ID_") then
if rightItem.id:find(value:getName():gsub("_mineR",""):gsub("ID_","")) then
JimmyAnims_Swing(value:getName())
specialAttack = true
end
elseif value:getName():find("Name_") then
if rightItem:getName():find(value:getName():gsub("_mineR",""):gsub("Name_","")) then
JimmyAnims_Swing(value:getName())
specialAttack = true
end
end
end
if not specialAttack then
JimmyAnims_Swing("mineR")
end
elseif leftMine and incluState then
for _, value in pairs(mineLanims) do
if value:getName():find("ID_") then
if leftItem.id:find(value:getName():gsub("_mineL",""):gsub("ID_","")) then
JimmyAnims_Swing(value:getName())
specialAttack = true
end
elseif value:getName():find("Name_") then
if leftItem:getName():find(value:getName():gsub("_mineL",""):gsub("Name_","")) then
JimmyAnims_Swing(value:getName())
specialAttack = true
end
end
end
if not specialAttack then
JimmyAnims_Swing("mineL")
end
end
end
for _,value in pairs(holdRanims) do
if value:getName():find("ID_") then
value:setPlaying(rightItem.id:find(value:getName():gsub("_holdR",""):gsub("ID_","")) and incluState and exclude)
elseif value:getName():find("Name_") then
value:setPlaying(rightItem:getName():find(value:getName():gsub("_holdR",""):gsub("Name_","")) and incluState and exclude)
end
if value:isPlaying() then
for _, path in pairs(bbmodels) do
if path.holdR then path.holdR:stop() end
end
end
end
for _,value in pairs(holdLanims) do
if value:getName():find("ID_") then
value:setPlaying(leftItem.id:find(value:getName():gsub("_holdL",""):gsub("ID_","")) and incluState and exclude)
elseif value:getName():find("Name_") then
value:setPlaying(leftItem:getName():find(value:getName():gsub("_holdL",""):gsub("Name_","")) and incluState and exclude)
end
if value:isPlaying() then
for _, path in pairs(bbmodels) do
if path.holdL then path.holdL:stop() end
end
end
end
end
local attackinit = true
local function animInit()
for _, path in pairs(bbmodels) do
for _,anim in pairs(path) do
if (anim:getName():find("attackR") or anim:getName():find("attackL") or anim:getName():find("mineR") or anim:getName():find("mineL")) and attackinit then
attackinit = false
distinit = true
end
if anim:getName():find("^fly") then
flyinit = true
end
if anim:getName():find("_holdR") then
holdRanims[#holdRanims+1] = anim
end
if anim:getName():find("_holdL") then
holdLanims[#holdLanims+1] = anim
end
if anim:getName():find("_attackR") then
attackRanims[#attackRanims+1] = anim
end
if anim:getName():find("_attackL") then
attackLanims[#attackLanims+1] = anim
end
if anim:getName():find("_mineR") then
mineRanims[#mineRanims+1] = anim
end
if anim:getName():find("_mineL") then
mineLanims[#mineLanims+1] = anim
end
end
end
end
local function tick()
anims()
end
local GSAnimBlend
for _, key in ipairs(listFiles(nil,true)) do
if key:find("GSAnimBlend$") then
GSAnimBlend = require(key)
break
end
end
if GSAnimBlend then GSAnimBlend.safe = false end
local function blend(paths, time, itemTime)
if not GSAnimBlend then return end
for _, path in pairs(paths) do
if path.walk then path.walk:blendTime(time) end
if path.idle then path.idle:blendTime(time) end
if path.crouch then path.crouch:blendTime(time) end
if path.walkback then path.walkback:blendTime(time) end
if path.sprint then path.sprint:blendTime(time) end
if path.crouchwalk then path.crouchwalk:blendTime(time) end
if path.crouchwalkback then path.crouchwalkback:blendTime(time) end
if path.elytra then path.elytra:blendTime(time) end
if path.elytradown then path.elytradown:blendTime(time) end
if path.fly then path.fly:blendTime(time) end
if path.flywalk then path.flywalk:blendTime(time) end
if path.flywalkback then path.flywalkback:blendTime(time) end
if path.flysprint then path.flysprint:blendTime(time) end
if path.flyup then path.flyup:blendTime(time) end
if path.flydown then path.flydown:blendTime(time) end
if path.sit then path.sit:blendTime(time) end
if path.sitmove then path.sitmove:blendTime(time) end
if path.sitmoveback then path.sitmoveback:blendTime(time) end
if path.sitjumpup then path.sitjumpup:blendTime(time) end
if path.sitjumpdown then path.sitjumpdown:blendTime(time) end
if path.sitpass then path.sitpass:blendTime(time) end
if path.sleep then path.sleep:blendTime(time) end
if path.climb then path.climb:blendTime(time) end
if path.climbstill then path.climbstill:blendTime(time) end
if path.climbdown then path.climbdown:blendTime(time) end
if path.climbcrouch then path.climbcrouch:blendTime(time) end
if path.climbcrouchwalk then path.climbcrouchwalk:blendTime(time) end
if path.swim then path.swim:blendTime(time) end
if path.crawl then path.crawl:blendTime(time) end
if path.crawlstill then path.crawlstill:blendTime(time) end
if path.fall then path.fall:blendTime(time) end
if path.jumpup then path.jumpup:blendTime(time) end
if path.jumpdown then path.jumpdown:blendTime(time) end
if path.sprintjumpup then path.sprintjumpup:blendTime(time) end
if path.sprintjumpdown then path.sprintjumpdown:blendTime(time) end
if path.crouchjumpup then path.crouchjumpup:blendTime(time) end
if path.crouchjumpdown then path.crouchjumpdown:blendTime(time) end
if path.trident then path.trident:blendTime(time) end
if path.death then path.death:blendTime(time) end
if path.water then path.water:blendTime(time) end
if path.waterwalk then path.waterwalk:blendTime(time) end
if path.waterwalkback then path.waterwalkback:blendTime(time) end
if path.waterup then path.waterup:blendTime(time) end
if path.waterdown then path.waterdown:blendTime(time) end
if path.watercrouch then path.watercrouch:blendTime(time) end
if path.watercrouchwalk then path.watercrouchwalk:blendTime(time) end
if path.watercrouchwakback then path.watercrouchwakback:blendTime(time) end
if path.watercrouchdown then path.watercrouchdown:blendTime(time) end
if path.watercrouchup then path.watercrouchup:blendTime(time) end
if path.eatR then path.eatR:blendTime(itemTime) end
if path.eatL then path.eatL:blendTime(itemTime) end
if path.drinkR then path.drinkR:blendTime(itemTime) end
if path.drinkL then path.drinkL:blendTime(itemTime) end
if path.blockR then path.blockR:blendTime(itemTime) end
if path.blockL then path.blockL:blendTime(itemTime) end
if path.bowR then path.bowR:blendTime(itemTime) end
if path.bowL then path.bowL:blendTime(itemTime) end
if path.crossbowR then path.crossbowR:blendTime(itemTime) end
if path.crossbowL then path.crossbowL:blendTime(itemTime) end
if path.loadR then path.loadR:blendTime(itemTime) end
if path.loadL then path.loadL:blendTime(itemTime) end
if path.spearR then path.spearR:blendTime(itemTime) end
if path.spearL then path.spearL:blendTime(itemTime) end
if path.spyglassR then path.spyglassR:blendTime(itemTime) end
if path.spyglassL then path.spyglassL:blendTime(itemTime) end
if path.hornR then path.hornR:blendTime(itemTime) end
if path.hornL then path.hornL:blendTime(itemTime) end
if path.brushR then path.brushR:blendTime(itemTime) end
if path.brushL then path.brushL:blendTime(itemTime) end
if path.attackR then path.attackR:blendTime(itemTime) end
if path.attackL then path.attackL:blendTime(itemTime) end
if path.mineR then path.mineR:blendTime(itemTime) end
if path.mineL then path.mineL:blendTime(itemTime) end
if path.holdR then path.holdR:blendTime(itemTime) end
if path.holdL then path.holdL:blendTime(itemTime) end
end
for _,value in pairs(holdRanims) do
value:blendTime(itemTime)
end
for _,value in pairs(holdLanims) do
value:blendTime(itemTime)
end
for _,value in pairs(attackRanims) do
value:blendTime(itemTime)
end
for _,value in pairs(attackLanims) do
value:blendTime(itemTime)
end
for _,value in pairs(mineRanims) do
value:blendTime(itemTime)
end
for _,value in pairs(mineLanims) do
value:blendTime(itemTime)
end
end
wait(20,function()
assert(
next(bbmodels),
"§aCustom Script Warning: §6JimmyAnims isn't being required, or a blockbench model isn't being provided to it. \n".."§6 Put this code in a DIFFERENT script to use JimmyAnims: \n".."§flocal anims = require('JimmyAnims') \n"..
"§fanims(animations.BBMODEL_NAME_HERE) \n".."§6 Where you replace BBMODEL_NAME_HERE with the name of your bbmodel. \n".."§6 Or go to the top of the script or to the top of the Discord forum for more complete instructions.".."§c")
end)
local init = false
local animMT = {__call = function(self, ...)
local paths = {...}
local should_blend = true
if self.autoBlend ~= nil then should_blend = self.autoBlend end
if self.fall ~= nil then fallVel = self.fall end
errors(paths,self.dismiss)
for _, v in ipairs(paths) do
bbmodels[#bbmodels+1] = v
end
if #bbmodels >= 64 then
error(
"§aCustom Script Warning: §6You've reached the max limit of 64 bbmodels that can be added to JimmyAnims. To save your FPS the script has been stopped. \n"..
"To prevent this from happening accidentally you should move the function call out of any function it is in.§c"
,2
)
end
-- Init stuff.
if init then return end
animInit()
if should_blend then blend(paths, self.excluBlendTime or 4, self.incluBlendTime or 4) end
events.TICK:register(tick)
init = true
end}
local function addAllAnimsController(...)
if #allAnims >= 1024 then
error(
"§aCustom Script Warning: §6You've reached the max limit of 1024 animations that can be added to the addAllAnimsController. To save your FPS the script has been stopped. \n"..
"To prevent this from happening accidentally you should move the function call out of any function it is in.§c"
,2
)
end
for _, v in ipairs{...} do
assert(
type(v) == "Animation",
"§aCustom Script Warning: §6addAllAnimsController was given something that isn't an animation, check its spelling for errors.§c")
allAnims[#allAnims+1] = v
end
end
local function addExcluAnimsController(...)
if #excluAnims >= 1024 then
error(
"§aCustom Script Warning: §6You've reached the max limit of 1024 animations that can be added to the addExcluAnimsController. To save your FPS the script has been stopped. \n"..
"To prevent this from happening accidentally you should move the function call out of any function it is in.§c"
,2
)
end
for _, v in ipairs{...} do
assert(
type(v) == "Animation",
"§aCustom Script Warning: §6addExcluAnimsController was given something that isn't an animation, check its spelling for errors.§c")
excluAnims[#excluAnims+1] = v
end
end
local function addIncluAnimsController(...)
if #incluAnims >= 1024 then
error(
"§aCustom Script Warning: §6You've reached the max limit of 1024 animations that can be added to the addIncluAnimsController. To save your FPS the script has been stopped. \n"..
"To prevent this from happening accidentally you should move the function call out of any function it is in.§c"
,2
)
end
for _, v in ipairs{...} do
assert(
type(v) == "Animation",
"§aCustom Script Warning: §6addIncluAnimsController was given something that isn't an animation, check its spelling for errors.§c")
incluAnims[#incluAnims+1] = v
end
end
local function setAllOn(x)
setAllOnVar = x
end
local function setExcluOn(x)
setExcluOnVar = x
end
local function setIncluOn(x)
setIncluOnVar = x
end
local function oneJumpFunc(x)
oneJump = x
end
-- If you're choosing to edit this script, don't put anything beneath the return line
return setmetatable(
{
animsList = animsList,
addAllAnimsController = addAllAnimsController,
addExcluAnimsController = addExcluAnimsController,
addIncluAnimsController = addIncluAnimsController,
setAllOn = setAllOn,
setExcluOn = setExcluOn,
setIncluOn = setIncluOn,
oneJump = oneJumpFunc,
},
animMT
)

View file

@ -0,0 +1,7 @@
{
"authors": [
"akirapink"
],
"name": "Perfect System DX",
"description":"The Iceberg Explained!"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,37 @@
vanilla_model.PLAYER:setVisible(false)
vanilla_model.ARMOR:setVisible(false)
vanilla_model.HELD_ITEMS:setVisible(true)
vanilla_model.ELYTRA:setVisible(true)
models.humanoid_model:setVisible(true)
models.squid_model:setVisible(false)
local anims = require("JimmyAnims")
anims(animations.humanoid_model,animations.squid_model)
--change texture
local mainPage = action_wheel:newPage()
action_wheel:setPage(mainPage)
function pings.Humanoid()
models.humanoid_model:setVisible(true)
animations.humanoid_model.transform_out:play()
end
function pings.Squid()
models.humanoid_model:setVisible(false)
animations.squid_model.squid_transform:play()
end
mainPage:newAction()
:title("Humanoid")
:item("minecraft:orange_dye")
:hoverColor(0,0,0)
:onLeftClick(pings.Humanoid)
mainPage:newAction()
:title("Squid")
:item("minecraft:glow_ink_sac")
:hoverColor(1,1,1)
:onLeftClick(pings.Squid)

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,924 @@
-- + Made by Jimmy Hellp
-- + V6 for 0.1.0 and above
-- + Thank you GrandpaScout for helping with the library stuff!
-- + Automatically compatible with GSAnimBlend for automatic smooth animation blending
-- + Also includes Manuel's Run Later script
local animsList = {
-- Exclusive Animations
idle="idling",
walk="walking",
walkback="walking backwards",
jumpup="jumping up caused via the jump key",
jumpdown="jumping down after a jump up",
fall="falling after a while",
sprint = "sprinting",
sprintjumpup="sprinting and jumping up caused via the jump key",
sprintjumpdown="sprinting and jumping down after a jump up",
crouch = "crouching",
crouchwalk = "crouching and walking",
crouchwalkback = "crouching and walking backwards",
crouchjumpup = "crouching and jumping up caused via the jump key",
crouchjumpdown = "crouching and jumping down after a jump up",
elytra = "elytra flying",
elytradown = "flying down/diving while elytra flying",
trident = "riptide trident lunging",
sleep = "sleeping",
swim = "while swimming",
sit = "while in any vehicle or modded sitting",
sitmove = "while in any vehicle and moving",
sitmoveback = "while in any vehicle and moving backwards",
sitjumpup = "while in any vehicle and jumping up",
sitjumpdown = "while in any vehicle and jumping down",
sitpass = "while in any vehicle as a passenger",
crawl = "crawling and moving",
crawlstill = "crawling and still",
fly = "creative flying",
flywalk = "flying and moving",
flywalkback = "flying and moving backwards",
flysprint = "flying and sprinting",
flyup = "flying and going up",
flydown = "flying and going down",
climb = "climbing a ladder",
climbstill = "not moving on a ladder without crouching (hitting a ceiling usually)",
climbdown = "going down a ladder",
climbcrouch = "crouching on a ladder",
climbcrouchwalk = "crouching on a ladder and moving",
water = "being in water without swimming",
waterwalk = "in water and moving",
waterwalkback = "in water and moving backwards",
waterup = "in water and going up",
waterdown = "in water and going down",
watercrouch = "in water and crouching",
watercrouchwalk = "in water and crouching and walking",
watercrouchwalkback = "in water and crouching and walking backwards",
watercrouchdown = "in water and crouching and going down",
watercrouchup = "in water and crouching and going up. only possible in bubble columns",
hurt = "MUST BE IN PLAY ONCE LOOP MODE. when hurt",
death = "dying",
-- Inclusive Animations:
attackR = "MUST BE IN PLAY ONCE LOOP MODE. attacking with the right hand",
attackL = "MUST BE IN PLAY ONCE LOOP MODE. attacking with the left hand",
mineR = "MUST BE IN PLAY ONCE LOOP MODE. mining with the right hand",
mineL = "MUST BE IN PLAY ONCE LOOP MODE. mining with the left hand",
eatR = "eating from the right hand",
eatL = "eating from the left hand",
drinkR = "drinking from the right hand",
drinkL = "drinking from the left hand",
blockR = "blocking from the right hand",
blockL = "blocking from the left hand",
bowR = "drawing back a bow from the right hand",
bowL = "drawing back a bow from the left hand",
loadR = "loading a crossbow from the right hand",
loadL = "loading a crossbow from the left hand",
crossbowR = "holding a loaded crossbow in the right hand",
crossbowL = "holding a loaded crossbow in the left hand",
spearR = "holding up a trident in the right hand",
spearL = "holding up a trident in the left hand",
spyglassR = "holding up a spyglass from the right hand",
spyglassL = "holding up a spyglass from the left hand",
hornR = "using a horn in the right hand",
hornL = "using a horn in the left hand",
brushR = "using a brush in the right hand",
brushL = "using a brush in the left hand",
holdR = "holding an item in the right hand",
holdL = "holding an item in the left hand",
}
------------------------------------------------------------------------------------------------------------------------
local function errors(paths,dismiss)
assert(
next(paths),
"§aCustom Script Warning: §6No blockbench models were found, or the blockbench model found contained no animations. \n" .." Check that there are no typos in the given bbmodel name, or that the bbmodel has animations by using this line of code at the top of your script: \n"
.."§f logTable(animations.BBMODEL_NAME_HERE) \n ".."§6If this returns nil your bbmodel name is wrong or it has no animations. You can use \n".."§f logTable(models:getChildren()) \n".."§6 to get the name of every bbmodel in your avatar.§c"
)
for _, path in pairs(paths) do
for _, anim in pairs(path) do
if anim:getName():find("%.") and not dismiss then
error(
"§aCustom Script Warning: §6The animation §b'"..anim:getName().."'§6 has a period ( . ) in its name, the handler can't use that animation and it must be renamed to fit the handler's accepted animation names. \n" ..
" If the animation isn't meant for the handler, you can dismiss this error by adding §fanims.dismiss = true§6 after the require but before setting the bbmodel.§c")
end
end
end
end
local setAllOnVar = true
local setIncluOnVar = true
local setExcluOnVar = true
local allAnims = {}
local excluAnims = {}
local incluAnims = {}
local animsTable= {
allVar = false,
excluVar = false,
incluVar = false
}
local excluState
local incluState
local holdRanims = {}
local holdLanims = {}
local attackRanims = {}
local attackLanims = {}
local mineRanims = {}
local mineLanims = {}
local hasJumped = false
local oneJump = false
local hitBlock
local cFlying = false
local oldcFlying = cFlying
local flying = false
local updateTimer = 0
local flyinit = false
local distinit = false
local dist = 4.5
local oldDist = dist
local reach = 4.5
local yvel
local cooldown
local grounded
local oldgrounded
local fallVel = -0.6
-- wait code from Manuel
local timers = {}
local function wait(ticks,next)
table.insert(timers,{t=world.getTime()+ticks,n=next})
end
events.TICK:register(function()
for key,timer in pairs(timers) do
if world.getTime() >= timer.t then
timer.n()
timers[key] = nil
end
end
end)
--
local bbmodels = {} -- don't put things in here
function pings.JimmyAnims_cFly(x)
flying = x
end
function pings.JimmyAnims_Distance(x)
reach = x
end
function pings.JimmyAnims_Update(fly,dis)
flying = fly
reach = dis
end
local prev
local function JimmyAnims_Swing(anim)
-- test how this works with multiple bbmodels
for _,path in pairs(bbmodels) do
if path[prev] then path[prev]:stop() end
if path[anim] then path[anim]:play() end
prev = anim
end
end
local function anims()
for _, value in ipairs(allAnims) do
if value:isPlaying() then
animsTable.allVar = true
break
else
animsTable.allVar = false or not setAllOnVar
end
end
if next(allAnims) == nil then
animsTable.allVar = not setAllOnVar
end
for _, value in ipairs(excluAnims) do
if value:isPlaying() then
animsTable.excluVar = true
break
else
animsTable.excluVar = false or not setExcluOnVar
end
end
if next(excluAnims) == nil then
animsTable.excluVar = not setExcluOnVar
end
for _, value in ipairs(incluAnims) do
if value:isPlaying() then
animsTable.incluVar = true
break
else
animsTable.incluVar = false or not setIncluOnVar
end
end
if next(incluAnims) == nil then
animsTable.incluVar = not setIncluOnVar
end
excluState = not animsTable.allVar and not animsTable.excluVar
incluState = not animsTable.allVar and not animsTable.incluVar
if host:isHost() then
if flyinit and not distinit then
cFlying = host:isFlying()
if cFlying ~= oldcFlying then
pings.JimmyAnims_cFly(cFlying)
end
oldcFlying = cFlying
updateTimer = updateTimer + 1
if updateTimer % 200 == 0 then
pings.JimmyAnims_cFly(cFlying)
end
elseif distinit and not flyinit then
dist = host:getReachDistance()
if dist ~= oldDist then
pings.JimmyAnims_Distance(dist)
end
oldDist = dist
updateTimer = updateTimer + 1
if updateTimer % 200 == 0 then
pings.JimmyAnims_Distance(dist)
end
elseif distinit and flyinit then
cFlying = host:isFlying()
if cFlying ~= oldcFlying then
pings.JimmyAnims_cFly(cFlying)
end
oldcFlying = cFlying
dist = host:getReachDistance()
if dist ~= oldDist then
pings.JimmyAnims_Distance(dist)
end
oldDist = dist
updateTimer = updateTimer + 1
if updateTimer % 200 == 0 then
pings.JimmyAnims_Update(cFlying,dist)
end
end
end
local pose = player:getPose()
local velocity = player:getVelocity()
local moving = velocity.xz:length() > 0.01
local sprinty = player:isSprinting()
local vehicle = player:getVehicle()
local sitting = vehicle ~= nil or pose == "SITTING" -- if you're reading this code and see this, "SITTING" isn't a vanilla pose, this is for mods
local passenger = vehicle and vehicle:getControllingPassenger() ~= player
local creativeFlying = flying and not sitting
local standing = pose == "STANDING"
local crouching = pose == "CROUCHING" and not creativeFlying
local gliding = pose == "FALL_FLYING"
local spin = pose == "SPIN_ATTACK"
local sleeping = pose == "SLEEPING"
local swimming = pose == "SWIMMING"
local inWater = player:isUnderwater() and not sitting
local inLiquid = player:isInWater() or player:isInLava()
local liquidSwim = swimming and inLiquid
local crawling = swimming and not inLiquid
-- hasJumped stuff
yvel = velocity.y
local hover = yvel < .01 and yvel > -.01
local goingUp = yvel > .01
local goingDown = yvel < -.01
local falling = yvel < fallVel
local playerGround = world.getBlockState(player:getPos():add(0,-.1,0))
local vehicleGround = sitting and world.getBlockState(vehicle:getPos():add(0,-.1,0))
oldgrounded = grounded
grounded = playerGround:isSolidBlock() or player:isOnGround() or (sitting and vehicleGround:isSolidBlock() or sitting and vehicle:isOnGround())
local pv = velocity:mul(1, 0, 1):normalize()
local pl = models:partToWorldMatrix():applyDir(0,0,-1):mul(1, 0, 1):normalize()
local fwd = pv:dot(pl)
local backwards = fwd < -.8
--local sideways = pv:cross(pl)
--local right = sideways.y > .6
--local left = sideways.y < -.6
-- canJump stuff
local webbed = world.getBlockState(player:getPos()).id == "minecraft:cobweb"
local ladder = player:isClimbing() and not grounded and not flying
local canJump = not (inLiquid or webbed or grounded)
local hp = player:getHealth() + player:getAbsorptionAmount()
if oldgrounded ~= grounded and not grounded and yvel > 0 then
cooldown = true
wait(10,function() cooldown = false end)
end
if (oldgrounded ~= grounded and not grounded and yvel > 0) and canJump then hasJumped = true end
if (grounded and (yvel <= 0 and yvel > -0.1)) or (gliding or inLiquid) then hasJumped = false end
local neverJump = not (gliding or spin or sleeping or swimming or ladder)
local jumpingUp = hasJumped and goingUp and neverJump
local jumpingDown = hasJumped and goingDown and not falling and neverJump or (cooldown and not jumpingUp)
local isJumping = jumpingUp or jumpingDown or falling
local sprinting = sprinty and standing and not inLiquid and not sitting
local walking = moving and not sprinting and not isJumping and not sitting
local forward = walking and not backwards
local backward = walking and backwards
-- we be holding items tho
local handedness = player:isLeftHanded()
local rightActive = handedness and "OFF_HAND" or "MAIN_HAND"
local leftActive = not handedness and "OFF_HAND" or "MAIN_HAND"
local activeness = player:getActiveHand()
local using = player:isUsingItem()
local rightSwing = player:getSwingArm() == rightActive and not sleeping
local leftSwing = player:getSwingArm() == leftActive and not sleeping
local targetEntity = type(player:getTargetedEntity()) == "PlayerAPI" or type(player:getTargetedEntity()) == "LivingEntityAPI"
local targetBlock = player:getTargetedBlock(true, reach)
local swingTime = player:getSwingTime() == 1
local success, result = pcall(targetBlock.getTextures, targetBlock)
if success then hitBlock = not (next(result) == nil) else hitBlock = true end
local rightMine = rightSwing and hitBlock and not targetEntity
local leftMine = leftSwing and hitBlock and not targetEntity
local rightAttack = rightSwing and (not hitBlock or targetEntity)
local leftAttack = leftSwing and (not hitBlock or targetEntity)
local rightItem = player:getHeldItem(handedness)
local leftItem = player:getHeldItem(not handedness)
local usingR = activeness == rightActive and rightItem:getUseAction()
local usingL = activeness == leftActive and leftItem:getUseAction()
local crossR = rightItem.tag and rightItem.tag["Charged"] == 1
local crossL = leftItem.tag and leftItem.tag["Charged"] == 1
local drinkRState = using and usingR == "DRINK"
local drinkLState = using and usingL == "DRINK"
local eatRState = using and usingR == "EAT"
local eatLState = using and usingL == "EAT"
local blockRState = using and usingR == "BLOCK"
local blockLState = using and usingL == "BLOCK"
local bowRState = using and usingR == "BOW"
local bowLState = using and usingL == "BOW"
local spearRState = using and usingR == "SPEAR"
local spearLState = using and usingL == "SPEAR"
local spyglassRState = using and usingR == "SPYGLASS"
local spyglassLState = using and usingL == "SPYGLASS"
local hornRState = using and usingR == "TOOT_HORN"
local hornLState = using and usingL == "TOOT_HORN"
local loadRState = using and usingR == "CROSSBOW"
local loadLState = using and usingL == "CROSSBOW"
local brushRState = using and usingR == "BRUSH"
local brushLState = using and usingL == "BRUSH"
local exclude = not (using or crossR or crossL)
local rightHoldState = rightItem.id ~= "minecraft:air" and exclude
local leftHoldState = leftItem.id ~= "minecraft:air" and exclude
-- anim states
for _, path in pairs(bbmodels) do
local flywalkbackState = creativeFlying and backward and (not (goingDown or goingUp))
local flysprintState = creativeFlying and sprinting and not isJumping and (not (goingDown or goingUp))
local flyupState = creativeFlying and goingUp
local flydownState = creativeFlying and goingDown
local flywalkState = creativeFlying and forward and (not (goingDown or goingUp)) and not sleeping or (flysprintState and not path.flysprint) or (flywalkbackState and not path.flywalkback)
or (flyupState and not path.flyup) or (flydownState and not path.flydown)
local flyState = creativeFlying and not sprinting and not moving and standing and not isJumping and (not (goingDown or goingUp)) and not sleeping or (flywalkState and not path.flywalk)
local watercrouchwalkbackState = inWater and crouching and backward and not goingDown
local watercrouchwalkState = inWater and crouching and forward and not (goingDown or goingUp) or (watercrouchwalkbackState and not path.watercrouchwalkback)
local watercrouchupState = inWater and crouching and goingUp
local watercrouchdownState = inWater and crouching and goingDown or (watercrouchupState and not path.watercrouchup)
local watercrouchState = inWater and crouching and not moving and not (goingDown or goingUp) or (watercrouchdownState and not path.watercrouchdown) or (watercrouchwalkState and not path.watercrouchwalk)
local waterdownState = inWater and goingDown and not falling and standing and not creativeFlying
local waterupState = inWater and goingUp and standing and not creativeFlying
local waterwalkbackState = inWater and backward and hover and standing and not creativeFlying
local waterwalkState = inWater and forward and hover and standing and not creativeFlying or (waterwalkbackState and not path.waterwalkback) or (waterdownState and not path.waterdown)
or (waterupState and not path.waterup)
local waterState = inWater and not moving and standing and hover and not creativeFlying or (waterwalkState and not path.waterwalk)
local crawlstillState = crawling and not moving
local crawlState = crawling and moving or (crawlstillState and not path.crawlstill)
local swimState = liquidSwim or (crawlState and not path.crawl)
local elytradownState = gliding and goingDown
local elytraState = gliding and not goingDown or (elytradownState and not path.elytradown)
local sitpassState = passenger and standing
local sitjumpdownState = sitting and not passenger and standing and (jumpingDown or falling)
local sitjumpupState = sitting and not passenger and jumpingUp and standing or (sitjumpdownState and not path.sitjumpdown)
local sitmovebackState = sitting and not passenger and not isJumping and backwards and standing
local sitmoveState = velocity:length() > 0 and not passenger and not backwards and standing and sitting and not isJumping or (sitmovebackState and not path.sitmoveback) or (sitjumpupState and not path.sitjumpup)
local sitState = sitting and not passenger and velocity:length() == 0 and not isJumping and standing or (sitmoveState and not path.sitmove) or (sitpassState and not path.sitpass)
local tridentState = spin
local sleepState = sleeping
local climbcrouchwalkState = ladder and crouching and (moving or yvel ~= 0)
local climbcrouchState = ladder and crouching and hover and not moving or (climbcrouchwalkState and not path.climbcrouchwalk)
local climbdownState = ladder and goingDown
local climbstillState = ladder and not crouching and hover
local climbState = ladder and goingUp and not crouching or (climbdownState and not path.climbdown) or (climbstillState and not path.climbstill)
local crouchjumpdownState = crouching and jumpingDown and not ladder and not inWater
local crouchjumpupState = crouching and jumpingUp and not ladder or (not oneJump and (crouchjumpdownState and not path.crouchjumpdown))
local crouchwalkbackState = backward and crouching and not ladder and not inWater or (watercrouchwalkbackState and not path.watercrouchwalkback and not path.watercrouchwalk and not path.watercrouch)
local crouchwalkState = forward and crouching and not ladder and not inWater or (crouchwalkbackState and not path.crouchwalkback) or (not oneJump and (crouchjumpupState and not path.crouchjumpup)) or ((watercrouchwalkState and not watercrouchwalkbackState) and not path.watercrouchwalk and not path.watercrouch)
local crouchState = crouching and not walking and not isJumping and not ladder and not inWater and not cooldown or (crouchwalkState and not path.crouchwalk) or (climbcrouchState and not path.climbcrouch) or ((watercrouchState and not watercrouchwalkState) and not path.watercrouch)
local fallState = falling and not gliding and not creativeFlying and not sitting
local sprintjumpdownState = jumpingDown and sprinting and not creativeFlying and not ladder
local sprintjumpupState = jumpingUp and sprinting and not creativeFlying and not ladder or (not oneJump and (sprintjumpdownState and not path.sprintjumpdown))
local jumpdownState = jumpingDown and not sprinting and not crouching and not sitting and not gliding and not creativeFlying and not spin and not inWater or (fallState and not path.fall) or (oneJump and (sprintjumpdownState and not path.sprintjumpdown)) or (oneJump and (crouchjumpdownState and not path.crouchjumpdown))
local jumpupState = jumpingUp and not sprinting and not crouching and not sitting and not creativeFlying and not inWater or (jumpdownState and not path.jumpdown) or (tridentState and not path.trident) or (oneJump and (sprintjumpupState and not path.sprintjumpup)) or (oneJump and (crouchjumpupState and not path.crouchjumpup))
local sprintState = sprinting and not isJumping and not creativeFlying and not ladder and not cooldown or (not oneJump and (sprintjumpupState and not path.sprintjumpup))
local walkbackState = backward and standing and not creativeFlying and not ladder and not inWater or (flywalkbackState and not path.flywalkback and not path.flywalk and not path.fly)
local walkState = forward and standing and not creativeFlying and not ladder and not inWater and not cooldown or (walkbackState and not path.walkback) or (sprintState and not path.sprint) or (climbState and not path.climb)
or (swimState and not path.swim) or (elytraState and not path.elytra) or (jumpupState and not path.jumpup) or (waterwalkState and (not path.waterwalk and not path.water)) or ((flywalkState and not flywalkbackState) and not path.flywalk and not path.fly)
or (crouchwalkState and not path.crouch)
local idleState = not moving and not sprinting and standing and not isJumping and not sitting and not creativeFlying and not ladder and not inWater or (sleepState and not path.sleep) or (sitState and not path.sit)
or ((waterState and not waterwalkState) and not path.water) or ((flyState and not flywalkState) and not path.fly) or ((crouchState and not crouchwalkState) and not path.crouch)
local deadState = hp <= 0
if path.death then path.death:playing(excluState and deadState) end
-- anim play testing
if path.hurt and player:getNbt().HurtTime == 9 then
path.hurt:restart()
end
if path.idle then path.idle:playing(excluState and idleState) end
if path.walk then path.walk:playing(excluState and walkState) end
if path.walkback then path.walkback:playing(excluState and walkbackState) end
if path.sprint then path.sprint:playing(excluState and sprintState) end
if path.sprintjumpup then path.sprintjumpup:playing(excluState and sprintjumpupState) end
if path.sprintjumpdown then path.sprintjumpdown:playing(excluState and sprintjumpdownState) end
if path.crouch then path.crouch:playing(excluState and crouchState) end
if path.crouchwalk then path.crouchwalk:playing(excluState and crouchwalkState) end
if path.crouchwalkback then path.crouchwalkback:playing(excluState and crouchwalkbackState) end
if path.crouchjumpup then path.crouchjumpup:playing(excluState and crouchjumpupState) end
if path.crouchjumpdown then path.crouchjumpdown:playing(excluState and crouchjumpdownState) end
if path.jumpup then path.jumpup:playing(excluState and jumpupState) end
if path.jumpdown then path.jumpdown:playing(excluState and jumpdownState) end
if path.fall then path.fall:playing(excluState and fallState) end
if path.elytra then path.elytra:playing(excluState and elytraState) end
if path.elytradown then path.elytradown:playing(excluState and elytradownState) end
if path.trident then path.trident:playing(excluState and tridentState) end
if path.sleep then path.sleep:playing(excluState and sleepState) end
if path.swim then path.swim:playing(excluState and swimState) end
if path.sit then path.sit:playing(excluState and sitState) end
if path.sitmove then path.sitmove:playing(excluState and sitmoveState) end
if path.sitmoveback then path.sitmoveback:playing(excluState and sitmovebackState) end
if path.sitjumpup then path.sitjumpup:playing(excluState and sitjumpupState) end
if path.sitjumpdown then path.sitjumpdown:playing(excluState and sitjumpdownState) end
if path.sitpass then path.sitpass:playing(excluState and sitpassState) end
if path.crawl then path.crawl:playing(excluState and crawlState) end
if path.crawlstill then path.crawlstill:playing(excluState and crawlstillState) end
if path.fly then path.fly:playing(excluState and flyState) end
if path.flywalk then path.flywalk:playing(excluState and flywalkState) end
if path.flywalkback then path.flywalkback:playing(excluState and flywalkbackState) end
if path.flysprint then path.flysprint:playing(excluState and flysprintState) end
if path.flyup then path.flyup:playing(excluState and flyupState) end
if path.flydown then path.flydown:playing(excluState and flydownState) end
if path.climb then path.climb:playing(excluState and climbState) end
if path.climbstill then path.climbstill:playing(excluState and climbstillState) end
if path.climbdown then path.climbdown:playing(excluState and climbdownState) end
if path.climbcrouch then path.climbcrouch:playing(excluState and climbcrouchState) end
if path.climbcrouchwalk then path.climbcrouchwalk:playing(excluState and climbcrouchwalkState) end
if path.water then path.water:playing(excluState and waterState) end
if path.waterwalk then path.waterwalk:playing(excluState and waterwalkState) end
if path.waterwalkback then path.waterwalkback:playing(excluState and waterwalkbackState) end
if path.waterup then path.waterup:playing(excluState and waterupState) end
if path.waterdown then path.waterdown:playing(excluState and waterdownState) end
if path.watercrouch then path.watercrouch:playing(excluState and watercrouchState) end
if path.watercrouchwalk then path.watercrouchwalk:playing(excluState and watercrouchwalkState) end
if path.watercrouchwalkback then path.watercrouchwalkback:playing(excluState and watercrouchwalkbackState) end
if path.watercrouchdown then path.watercrouchdown:playing(excluState and watercrouchdownState) end
if path.watercrouchup then path.watercrouchup:playing(excluState and watercrouchupState) end
if path.eatR then path.eatR:playing(incluState and eatRState or (drinkRState and not path.drinkR)) end
if path.eatL then path.eatL:playing(incluState and eatLState or (drinkLState and not path.drinkL)) end
if path.drinkR then path.drinkR:playing(incluState and drinkRState) end
if path.drinkL then path.drinkL:playing(incluState and drinkLState) end
if path.blockR then path.blockR:playing(incluState and blockRState) end
if path.blockL then path.blockL:playing(incluState and blockLState) end
if path.bowR then path.bowR:playing(incluState and bowRState) end
if path.bowL then path.bowL:playing(incluState and bowLState) end
if path.loadR then path.loadR:playing(incluState and loadRState) end
if path.loadL then path.loadL:playing(incluState and loadLState) end
if path.crossbowR then path.crossbowR:playing(incluState and crossR) end
if path.crossbowL then path.crossbowL:playing(incluState and crossL) end
if path.spearR then path.spearR:playing(incluState and spearRState) end
if path.spearL then path.spearL:playing(incluState and spearLState) end
if path.spyglassR then path.spyglassR:playing(incluState and spyglassRState) end
if path.spyglassL then path.spyglassL:playing(incluState and spyglassLState) end
if path.hornR then path.hornR:playing(incluState and hornRState) end
if path.hornL then path.hornL:playing(incluState and hornLState) end
if path.brushR then path.brushR:playing(incluState and brushRState) end
if path.brushL then path.brushL:playing(incluState and brushLState) end
if path.holdR then path.holdR:playing(incluState and rightHoldState) end
if path.holdL then path.holdL:playing(incluState and leftHoldState) end
end
if swingTime then
local specialAttack = false
if rightAttack and incluState then
for _, value in pairs(attackRanims) do
if value:getName():find("ID_") then
if rightItem.id:find(value:getName():gsub("_attackR",""):gsub("ID_","")) then
JimmyAnims_Swing(value:getName())
specialAttack = true
end
elseif value:getName():find("Name_") then
if rightItem:getName():find(value:getName():gsub("_attackR",""):gsub("Name_","")) then
JimmyAnims_Swing(value:getName())
specialAttack = true
end
end
end
if not specialAttack then
JimmyAnims_Swing("attackR")
end
elseif leftAttack and incluState then
for _, value in pairs(attackLanims) do
if value:getName():find("ID_") then
if leftItem.id:find(value:getName():gsub("_attackL",""):gsub("ID_","")) then
JimmyAnims_Swing(value:getName())
specialAttack = true
end
elseif value:getName():find("Name_") then
if leftItem:getName():find(value:getName():gsub("_attackL",""):gsub("Name_","")) then
JimmyAnims_Swing(value:getName())
specialAttack = true
end
end
end
if specialAttack == false then
JimmyAnims_Swing("attackL")
end
elseif rightMine and incluState then
for _, value in pairs(mineRanims) do
if value:getName():find("ID_") then
if rightItem.id:find(value:getName():gsub("_mineR",""):gsub("ID_","")) then
JimmyAnims_Swing(value:getName())
specialAttack = true
end
elseif value:getName():find("Name_") then
if rightItem:getName():find(value:getName():gsub("_mineR",""):gsub("Name_","")) then
JimmyAnims_Swing(value:getName())
specialAttack = true
end
end
end
if not specialAttack then
JimmyAnims_Swing("mineR")
end
elseif leftMine and incluState then
for _, value in pairs(mineLanims) do
if value:getName():find("ID_") then
if leftItem.id:find(value:getName():gsub("_mineL",""):gsub("ID_","")) then
JimmyAnims_Swing(value:getName())
specialAttack = true
end
elseif value:getName():find("Name_") then
if leftItem:getName():find(value:getName():gsub("_mineL",""):gsub("Name_","")) then
JimmyAnims_Swing(value:getName())
specialAttack = true
end
end
end
if not specialAttack then
JimmyAnims_Swing("mineL")
end
end
end
for _,value in pairs(holdRanims) do
if value:getName():find("ID_") then
value:setPlaying(rightItem.id:find(value:getName():gsub("_holdR",""):gsub("ID_","")) and incluState and exclude)
elseif value:getName():find("Name_") then
value:setPlaying(rightItem:getName():find(value:getName():gsub("_holdR",""):gsub("Name_","")) and incluState and exclude)
end
if value:isPlaying() then
for _, path in pairs(bbmodels) do
if path.holdR then path.holdR:stop() end
end
end
end
for _,value in pairs(holdLanims) do
if value:getName():find("ID_") then
value:setPlaying(leftItem.id:find(value:getName():gsub("_holdL",""):gsub("ID_","")) and incluState and exclude)
elseif value:getName():find("Name_") then
value:setPlaying(leftItem:getName():find(value:getName():gsub("_holdL",""):gsub("Name_","")) and incluState and exclude)
end
if value:isPlaying() then
for _, path in pairs(bbmodels) do
if path.holdL then path.holdL:stop() end
end
end
end
end
local attackinit = true
local function animInit()
for _, path in pairs(bbmodels) do
for _,anim in pairs(path) do
if (anim:getName():find("attackR") or anim:getName():find("attackL") or anim:getName():find("mineR") or anim:getName():find("mineL")) and attackinit then
attackinit = false
distinit = true
end
if anim:getName():find("^fly") then
flyinit = true
end
if anim:getName():find("_holdR") then
holdRanims[#holdRanims+1] = anim
end
if anim:getName():find("_holdL") then
holdLanims[#holdLanims+1] = anim
end
if anim:getName():find("_attackR") then
attackRanims[#attackRanims+1] = anim
end
if anim:getName():find("_attackL") then
attackLanims[#attackLanims+1] = anim
end
if anim:getName():find("_mineR") then
mineRanims[#mineRanims+1] = anim
end
if anim:getName():find("_mineL") then
mineLanims[#mineLanims+1] = anim
end
end
end
end
local function tick()
anims()
end
local GSAnimBlend
for _, key in ipairs(listFiles(nil,true)) do
if key:find("GSAnimBlend$") then
GSAnimBlend = require(key)
break
end
end
if GSAnimBlend then GSAnimBlend.safe = false end
local function blend(paths, time, itemTime)
if not GSAnimBlend then return end
for _, path in pairs(paths) do
if path.walk then path.walk:blendTime(time) end
if path.idle then path.idle:blendTime(time) end
if path.crouch then path.crouch:blendTime(time) end
if path.walkback then path.walkback:blendTime(time) end
if path.sprint then path.sprint:blendTime(time) end
if path.crouchwalk then path.crouchwalk:blendTime(time) end
if path.crouchwalkback then path.crouchwalkback:blendTime(time) end
if path.elytra then path.elytra:blendTime(time) end
if path.elytradown then path.elytradown:blendTime(time) end
if path.fly then path.fly:blendTime(time) end
if path.flywalk then path.flywalk:blendTime(time) end
if path.flywalkback then path.flywalkback:blendTime(time) end
if path.flysprint then path.flysprint:blendTime(time) end
if path.flyup then path.flyup:blendTime(time) end
if path.flydown then path.flydown:blendTime(time) end
if path.sit then path.sit:blendTime(time) end
if path.sitmove then path.sitmove:blendTime(time) end
if path.sitmoveback then path.sitmoveback:blendTime(time) end
if path.sitjumpup then path.sitjumpup:blendTime(time) end
if path.sitjumpdown then path.sitjumpdown:blendTime(time) end
if path.sitpass then path.sitpass:blendTime(time) end
if path.sleep then path.sleep:blendTime(time) end
if path.climb then path.climb:blendTime(time) end
if path.climbstill then path.climbstill:blendTime(time) end
if path.climbdown then path.climbdown:blendTime(time) end
if path.climbcrouch then path.climbcrouch:blendTime(time) end
if path.climbcrouchwalk then path.climbcrouchwalk:blendTime(time) end
if path.swim then path.swim:blendTime(time) end
if path.crawl then path.crawl:blendTime(time) end
if path.crawlstill then path.crawlstill:blendTime(time) end
if path.fall then path.fall:blendTime(time) end
if path.jumpup then path.jumpup:blendTime(time) end
if path.jumpdown then path.jumpdown:blendTime(time) end
if path.sprintjumpup then path.sprintjumpup:blendTime(time) end
if path.sprintjumpdown then path.sprintjumpdown:blendTime(time) end
if path.crouchjumpup then path.crouchjumpup:blendTime(time) end
if path.crouchjumpdown then path.crouchjumpdown:blendTime(time) end
if path.trident then path.trident:blendTime(time) end
if path.death then path.death:blendTime(time) end
if path.water then path.water:blendTime(time) end
if path.waterwalk then path.waterwalk:blendTime(time) end
if path.waterwalkback then path.waterwalkback:blendTime(time) end
if path.waterup then path.waterup:blendTime(time) end
if path.waterdown then path.waterdown:blendTime(time) end
if path.watercrouch then path.watercrouch:blendTime(time) end
if path.watercrouchwalk then path.watercrouchwalk:blendTime(time) end
if path.watercrouchwakback then path.watercrouchwakback:blendTime(time) end
if path.watercrouchdown then path.watercrouchdown:blendTime(time) end
if path.watercrouchup then path.watercrouchup:blendTime(time) end
if path.eatR then path.eatR:blendTime(itemTime) end
if path.eatL then path.eatL:blendTime(itemTime) end
if path.drinkR then path.drinkR:blendTime(itemTime) end
if path.drinkL then path.drinkL:blendTime(itemTime) end
if path.blockR then path.blockR:blendTime(itemTime) end
if path.blockL then path.blockL:blendTime(itemTime) end
if path.bowR then path.bowR:blendTime(itemTime) end
if path.bowL then path.bowL:blendTime(itemTime) end
if path.crossbowR then path.crossbowR:blendTime(itemTime) end
if path.crossbowL then path.crossbowL:blendTime(itemTime) end
if path.loadR then path.loadR:blendTime(itemTime) end
if path.loadL then path.loadL:blendTime(itemTime) end
if path.spearR then path.spearR:blendTime(itemTime) end
if path.spearL then path.spearL:blendTime(itemTime) end
if path.spyglassR then path.spyglassR:blendTime(itemTime) end
if path.spyglassL then path.spyglassL:blendTime(itemTime) end
if path.hornR then path.hornR:blendTime(itemTime) end
if path.hornL then path.hornL:blendTime(itemTime) end
if path.brushR then path.brushR:blendTime(itemTime) end
if path.brushL then path.brushL:blendTime(itemTime) end
if path.attackR then path.attackR:blendTime(itemTime) end
if path.attackL then path.attackL:blendTime(itemTime) end
if path.mineR then path.mineR:blendTime(itemTime) end
if path.mineL then path.mineL:blendTime(itemTime) end
if path.holdR then path.holdR:blendTime(itemTime) end
if path.holdL then path.holdL:blendTime(itemTime) end
end
for _,value in pairs(holdRanims) do
value:blendTime(itemTime)
end
for _,value in pairs(holdLanims) do
value:blendTime(itemTime)
end
for _,value in pairs(attackRanims) do
value:blendTime(itemTime)
end
for _,value in pairs(attackLanims) do
value:blendTime(itemTime)
end
for _,value in pairs(mineRanims) do
value:blendTime(itemTime)
end
for _,value in pairs(mineLanims) do
value:blendTime(itemTime)
end
end
wait(20,function()
assert(
next(bbmodels),
"§aCustom Script Warning: §6JimmyAnims isn't being required, or a blockbench model isn't being provided to it. \n".."§6 Put this code in a DIFFERENT script to use JimmyAnims: \n".."§flocal anims = require('JimmyAnims') \n"..
"§fanims(animations.BBMODEL_NAME_HERE) \n".."§6 Where you replace BBMODEL_NAME_HERE with the name of your bbmodel. \n".."§6 Or go to the top of the script or to the top of the Discord forum for more complete instructions.".."§c")
end)
local init = false
local animMT = {__call = function(self, ...)
local paths = {...}
local should_blend = true
if self.autoBlend ~= nil then should_blend = self.autoBlend end
if self.fall ~= nil then fallVel = self.fall end
errors(paths,self.dismiss)
for _, v in ipairs(paths) do
bbmodels[#bbmodels+1] = v
end
if #bbmodels >= 64 then
error(
"§aCustom Script Warning: §6You've reached the max limit of 64 bbmodels that can be added to JimmyAnims. To save your FPS the script has been stopped. \n"..
"To prevent this from happening accidentally you should move the function call out of any function it is in.§c"
,2
)
end
-- Init stuff.
if init then return end
animInit()
if should_blend then blend(paths, self.excluBlendTime or 4, self.incluBlendTime or 4) end
events.TICK:register(tick)
init = true
end}
local function addAllAnimsController(...)
if #allAnims >= 1024 then
error(
"§aCustom Script Warning: §6You've reached the max limit of 1024 animations that can be added to the addAllAnimsController. To save your FPS the script has been stopped. \n"..
"To prevent this from happening accidentally you should move the function call out of any function it is in.§c"
,2
)
end
for _, v in ipairs{...} do
assert(
type(v) == "Animation",
"§aCustom Script Warning: §6addAllAnimsController was given something that isn't an animation, check its spelling for errors.§c")
allAnims[#allAnims+1] = v
end
end
local function addExcluAnimsController(...)
if #excluAnims >= 1024 then
error(
"§aCustom Script Warning: §6You've reached the max limit of 1024 animations that can be added to the addExcluAnimsController. To save your FPS the script has been stopped. \n"..
"To prevent this from happening accidentally you should move the function call out of any function it is in.§c"
,2
)
end
for _, v in ipairs{...} do
assert(
type(v) == "Animation",
"§aCustom Script Warning: §6addExcluAnimsController was given something that isn't an animation, check its spelling for errors.§c")
excluAnims[#excluAnims+1] = v
end
end
local function addIncluAnimsController(...)
if #incluAnims >= 1024 then
error(
"§aCustom Script Warning: §6You've reached the max limit of 1024 animations that can be added to the addIncluAnimsController. To save your FPS the script has been stopped. \n"..
"To prevent this from happening accidentally you should move the function call out of any function it is in.§c"
,2
)
end
for _, v in ipairs{...} do
assert(
type(v) == "Animation",
"§aCustom Script Warning: §6addIncluAnimsController was given something that isn't an animation, check its spelling for errors.§c")
incluAnims[#incluAnims+1] = v
end
end
local function setAllOn(x)
setAllOnVar = x
end
local function setExcluOn(x)
setExcluOnVar = x
end
local function setIncluOn(x)
setIncluOnVar = x
end
local function oneJumpFunc(x)
oneJump = x
end
-- If you're choosing to edit this script, don't put anything beneath the return line
return setmetatable(
{
animsList = animsList,
addAllAnimsController = addAllAnimsController,
addExcluAnimsController = addExcluAnimsController,
addIncluAnimsController = addIncluAnimsController,
setAllOn = setAllOn,
setExcluOn = setExcluOn,
setIncluOn = setIncluOn,
oneJump = oneJumpFunc,
},
animMT
)

View file

@ -0,0 +1,8 @@
{
"authors": [
"Perfect System DX",
"akirapink"
],
"name": "Perfect System DX (v2.2)",
"description":"Then the future is in your hands"
}

View file

@ -0,0 +1,853 @@
-- Physbone 2.0 by ChloeSpacedOut <3
-- Some funny additions made by Superpowers04 :3
local physBone = {
-- DO NOT ENABLE THIS UNLESS YOU KNOW WHAT YOU'RE DOING, THIS APPENDS THE INDEX OF THE PHYSBONE TO IT'S NAME IF THERE'S A DUPLICATE AND CAN CAUSE ISSUES
allowDuplicates = false,
-- Diabled debug mode
disableDebugMode = false,
children = {},
collider = {},
index = {},
}
local doDebugMode = host:isHost() and not physBone.disableDebugMode
local physBoneIndex = physBone.index
local boneID = 0
local lastDeltaTime,lasterDeltaTime,lastestDeltaTime,lastDelta = 1,1,1,1
local physBonePresets = {}
local debugMode = false
local whiteTexture = textures:newTexture("white",1,1)
:setPixel(0,0,vec(1,1,1))
local colliderTexture = textures:newTexture("collider",1,1)
:setPixel(0,0,vec(0,0,0,0))
local nodeTexture = textures:newTexture("node",1,1)
:setPixel(0,0,vec(0,0.7,1))
physBone.getVals = function(val1,val2,val3,val4)
local type = type(val1)
if type == "Vector2" or type == "Vector3" then
return val1
elseif val3 then
return vec(val1,val2,val3)
else
return vec(val2,val2)
end
end
physBone.vecToRot = function(vec3)
vec3 = vec3:copy():normalize()
local pitch = math.deg(math.asin(-vec3.y))
local yaw = math.deg(math.atan2(vec3.x,vec3.z))
return pitch,yaw
end
physBone.vecToRotMat = function(vec3)
local w = vec3:copy():normalize()
local u = vec(1,0,0)
if math.abs(u:copy():dot(w)) > 0.7 then
u = vec(0,1,0)
end
local v = w:copy():cross(u)
u = v:copy():cross(w)
return matrices.mat4(vec(u.x,u.y,u.z,0),vec(v.x,v.y,v.z,0),vec(w.x,w.y,w.z,0),vec(0,0,0,1))
end
-- Physbone metatable
local physBoneBase = {
setMass =
function(self,data)
self.mass = data
return self
end,
getMass =
function(self)
return self.mass
end,
setLength =
function(self,data)
self.length = data
if doDebugMode and self.path.PB_Debug_Direction then
self.path.PB_Debug_Direction.child:setScale(1,data,1)
end
return self
end,
getLength =
function(self)
return self.length
end,
setGravity =
function(self,data)
self.gravity = data
return self
end,
getGravity =
function(self)
return self.gravity
end,
setAirResistance =
function(self,data)
self.airResistance = data
return self
end,
getAirResistance =
function(self)
return self.airResistance
end,
setSimSpeed =
function(self,data)
self.simSpeed = data
return self
end,
getSimSpeed =
function(self)
return self.simSpeed
end,
setSpringForce =
function(self,data)
self.springForce = data
if doDebugMode and self.path.PB_Debug_SpringForce then
local springForceGroup = self.path.PB_Debug_SpringForce
springForceGroup:setScale(1,self.springForce/50,1)
end
return self
end,
getSpringForce =
function(self)
return self.springForce
end,
setEquilibrium =
function(self,val1,val2,val3)
local data = physBone.getVals(val1,val2,val3)
self.equilibrium = data
if doDebugMode and self.path.PB_Debug_SpringForce then
local springForceGroup = self.path.PB_Debug_SpringForce
local equilib = vectors.rotateAroundAxis(90,data,vec(0,-1,0))
equilib = vectors.rotateAroundAxis(90,equilib,vec(-1,0,0))
local pitch,yaw = physBone.vecToRot(equilib)
springForceGroup:setRot(pitch,0,yaw)
end
return self
end,
getEquilibrium =
function(self)
return self.equilibrium
end,
setForce =
function(self,val1,val2,val3)
local data = physBone.getVals(val1,val2,val3)
self.force = data
return self
end,
getForce =
function(self)
return self.force
end,
setRotMod =
function(self,val1,val2,val3)
local data = physBone.getVals(val1,val2,val3)
self.rotMod = data
return self
end,
getRotMod =
function(self)
return self.upsideDown
end,
setVecMod =
function(self,val1,val2,val3)
local data = physBone.getVals(val1,val2,val3)
self.vecMod = data
return self
end,
getVecMod =
function(self)
return self.vecMod
end,
setRollMod =
function(self,data)
self.rollMod = data
return self
end,
getRollMod =
function(self)
return self.rollMod
end,
setNodeStart =
function(self,data)
self.nodeStart = data
if doDebugMode and self.path.PB_Debug_NodeRadius then
self.path.PB_Debug_NodeRadius:remove()
physBone.addDebugNodes(self.path,data,self.nodeEnd,self.nodeRadius,self.nodeDensity)
self.path.PB_Debug_NodeRadius:setVisible(debugMode)
end
return self
end,
getNodeStart =
function(self)
return self.nodeStart
end,
setNodeEnd =
function(self,data)
self.nodeEnd = data
if doDebugMode and self.path.PB_Debug_NodeRadius then
self.path.PB_Debug_NodeRadius:remove()
physBone.addDebugNodes(self.path,self.nodeStart,data,self.nodeRadius,self.nodeDensity)
self.path.PB_Debug_NodeRadius:setVisible(debugMode)
end
return self
end,
getNodeEnd =
function(self)
return self.nodeEnd
end,
setNodeDensity =
function(self,data)
self.nodeDensity = data
if doDebugMode and self.path.PB_Debug_NodeRadius then
self.path.PB_Debug_NodeRadius:remove()
physBone.addDebugNodes(self.path,self.nodeStart,self.nodeEnd,self.nodeRadius,data)
self.path.PB_Debug_NodeRadius:setVisible(debugMode)
end
return self
end,
getNodeDensity =
function(self)
return self.nodeDensity
end,
setNodeRadius =
function(self,data)
self.nodeRadius = data
if doDebugMode and self.path.PB_Debug_NodeRadius then
self.path.PB_Debug_NodeRadius:remove()
physBone.addDebugNodes(self.path,self.nodeStart,self.nodeEnd,data,self.nodeDensity)
self.path.PB_Debug_NodeRadius:setVisible(debugMode)
end
return self
end,
getNodeRadius =
function(self)
return self.nodeRadius
end,
setBounce =
function(self,data)
self.bounce = data
return self
end,
getBounce =
function(self)
return self.bounce
end,
updateWithPreset =
function(self,presetID)
assert(presetID,'error making physBone: your preset can not be nil')
local preset = type(presetID) == "table" and presetID or physBonePresets[presetID]
assert(preset,'error making physBone: preset "'..tostring(presetID)..'" does not exist')
for k,v in pairs {"mass","length","gravity","airResistance","simSpeed","equilibrium","springForce","force","rotMod","vecMod","rollMod","nodeStart","nodeEnd","nodeDensity","nodeRadius","bounce"} do
if preset[v] then
local funct = "set"..string.upper(string.sub(v,0,1))..string.sub(v,2,-1)
self[funct](self,preset[v])
end
end
return self
end,
remove =
function(self)
local path = self.path
local ID = self.ID
boneID = 0
local newIndex = {}
for k,v in pairs(physBoneIndex) do
if v ~= ID then
boneID = boneID + 1
newIndex[boneID] = v
end
end
physBoneIndex = newIndex
physBone[ID] = nil
for k,v in pairs(path:getChildren()) do
v:setRot(v:getRot())
end
path:setRot(0,0,0)
end
}
local physBoneMT = {__index=physBoneBase}
-- Internal Function: Returns physbone metatable from set values
physBone.newPhysBoneFromValues = function(self,path,mass,length,gravity,airResistance,simSpeed,equilibrium,springForce,force,rotMod,vecMod,rollMod,nodeStart,nodeEnd,nodeDensity,nodeRadius,bounce,id,name)
if(self ~= physBone) then
-- Literally just offsets everything so self is used as the base
path,mass,length,gravity,airResistance,simSpeed,equilibrium,springForce,force,rotMod,vecMod,rollMod,nodeStart,nodeEnd,nodeDensity,nodeRadius,bounce,id,name = self,path,mass,length,gravity,airResistance,simSpeed,equilibrium,springForce,force,rotMod,vecMod,rollMod,nodeStart,nodeEnd,nodeDensity,nodeRadius,bounce,id,name
end
assert(user:isLoaded(),'error making physBone: attempt to create part before entity init')
assert(path,'error making physBone: part is null!')
local ID = name or path:getName()
local pos = path:partToWorldMatrix():apply()
local velocity = vec(0,0,0)
return setmetatable({
index=nil,
ID = ID,
path = path,
pos = pos,
velocity = velocity,
mass = mass,
length = length,
gravity = gravity,
airResistance = airResistance,
simSpeed = simSpeed,
equilibrium = equilibrium,
springForce = springForce,
force = force,
rotMod = rotMod,
vecMod = vecMod,
rollMod = rollMod,
nodeStart = nodeStart,
nodeEnd = nodeEnd,
nodeDensity = nodeDensity,
nodeRadius = nodeRadius,
bounce = bounce
},physBoneMT)
end
-- Internal Function: Creates a physbone based on the provided metatable
physBone.addPhysBone = function(self,part,index)
if self ~= physBone then
index,part=part,index
end
assert(part,'error making physBone: part is null!')
local ID = part.ID
if(index == nil) then
boneID = boneID + 1
index = boneID
end
assert(not physBoneIndex[index],'error adding physBone: a physBone with index "'..index..'" already exists')
physBoneIndex[index] = ID
part.index = index
physBone[ID] = part
return part
end
-- Creates a new physBone
physBone.newPhysBone = function(self,part,physBonePreset)
if self ~= physBone then
physBonePreset,part=part,self
end
assert(part,'error making physBone: part is null!')
local ID = part:getName()
if(physBone.allowDuplicates and physBone[ID]) then
ID = ID..boneID+1
end
assert(not physBone[ID],'error making physBone: this physBone "'..ID..'" already exists')
assert(physBonePreset,'error making physBone: your preset can not be nil')
local preset = type(physBonePreset) == "table" and physBonePreset or physBonePresets[physBonePreset]
assert(preset,'error making physBone: preset "'..tostring(physBonePreset)..'" does not exist')
part:setRot(0,90,0)
local p = physBone:addPhysBone(
physBone.newPhysBoneFromValues(part,preset.mass,preset.length,preset.gravity,preset.airResistance,preset.simSpeed,preset.equilibrium,preset.springForce,preset.force,preset.rotMod,preset.vecMod,preset.rollMod,preset.nodeStart,preset.nodeEnd,preset.nodeDensity,preset.nodeRadius,preset.bounce,boneID,ID)
)
if doDebugMode then
physBone.addDebugParts(part,preset)
end
return p
end
-- Returns your physBone
physBone.getPhysBone = function(self,part)
if self ~= physBone then
part = self
end
assert(part,'cannot get physBone: part is null!')
local ID = self:getName()
assert(physBone[ID],('cannot get physBone: this part does not have a physBone'))
return physBone[ID]
end
-- Internal function to get part parents
local function getParents(part,parentsTable)
local parent = part:getParent()
if not parent then return parentsTable end
parentsTable[#parentsTable + 1] = parent
getParents(parent,parentsTable)
return parentsTable
end
-- Creates a new collider
physBone.newCollider = function(self,part)
assert(part,'error making collider: part is null!')
local ID = part:getName()
assert(not physBone.collider[ID],'error making collider: this collider "'..ID..'" already exists')
local parents = getParents(part,{part})
local nbtIndex = avatar:getNBT()
for i = #parents, 1, -1 do
for k,v in pairs(nbtIndex) do
if v.name == parents[i]:getName() then
if v.chld then
nbtIndex = v.chld
else
nbtIndex = v
end
end
end
end
assert(nbtIndex.cube_data,"error making collider '"..ID.."'. This part isn't a cube")
if next(nbtIndex.cube_data) == nil then
error("error making collider '"..ID.."'. This cube either has no texture applied to it in Blockbench or has all faces disabled")
end
part:setVisible(true)
part:setPrimaryTexture("CUSTOM", colliderTexture)
local t = nbtIndex.t
local f = nbtIndex.f
local piv = nbtIndex.piv
local rot = nbtIndex.rot
if not t then t = {0,0,0} end
if not f then f = {0,0,0} end
if not piv then piv = {0,0,0} end
if not rot then rot = {0,0,0} end
t = vec(t[1],t[2],t[3])
f = vec(f[1],f[2],f[3])
piv = vec(piv[1],piv[2],piv[3])
local offset = t - piv
local size = t - f
local faces = {}
for k,v in pairs(nbtIndex.cube_data) do
faces[k] = true
end
local pivot = part:getPivot()
part:setMatrix(matrices.mat4():translate(-pivot):rotate(part:getRot()):translate(pivot) * 0.15)
:setLight(15)
-- temp code for steph to replace
physBone.collider[ID] = {
ID = ID,
part = part,
offset = offset,
size = size,
faces = faces
}
end
-- Creates a new or sets the value of an existing preset
physBone.setPreset = function(self,ID,mass,length,gravity,airResistance,simSpeed,equilibrium,springForce,force,rotMod,vecMod,rollMod,nodeStart,nodeEnd,nodeDensity,nodeRadius,bounce)
local presetCache = {}
local references = {mass = mass, length = length, gravity = gravity, airResistance = airResistance, simSpeed = simSpeed, equilibrium = equilibrium, springForce = springForce, force = force, rotMod = rotMod, vecMod = vecMod, rollMod = rollMod, nodeStart = nodeStart, nodeEnd = nodeEnd, nodeDensity = nodeDensity, nodeRadius = nodeRadius, bounce = bounce}
local fallbacks = {mass = 1, length = 16, gravity = -9.81, airResistance = 0.1, simSpeed = 1, equilibrium = vec(0,-1,0), springForce = 0, force = vec(0,0,0), rotMod = vec(0,0,0), vecMod = vec(1,1,1), rollMod = 0, nodeStart = 0, nodeEnd = 16, nodeDensity = 1, nodeRadius = 0, bounce = 0.75}
for valID, fallbackVal in pairs(fallbacks) do
local presetVal = references[valID]
if presetVal then
presetCache[valID] = presetVal
else
presetCache[valID] = fallbackVal
end
end
physBonePresets[ID] = presetCache
end
-- Removes an existing preset
physBone.removePreset = function(self,ID)
if not physBonePresets[ID] then error('error removing preset: preset "'..ID..'" does not exist') end
physBonePresets[ID] = nil
end
-- Default presets
physBone:setPreset("physBone")
physBone:setPreset("PhysBone")
physBone:setPreset("physBoob",2,nil,nil,0.5,nil,vec(0,0,-1),200,nil,vec(-90,0,0),nil,nil,nil,nil,0)
physBone:setPreset("PhysBoob",2,nil,nil,0.5,nil,vec(0,0,-1),200,nil,vec(-90,0,0),nil,nil,nil,nil,0)
-- models API function: method by GS
local old_class_index = figuraMetatables.ModelPart.__index
local class_methods = {
newPhysBone = function(self,physBonePreset)
return physBone:newPhysBone(self,physBonePreset)
end,
getPhysBone = function(self)
return physBone:getPhysBone(self)
end
}
function figuraMetatables.ModelPart:__index(key)
if class_methods[key] then
return class_methods[key]
else
return old_class_index(self, key)
end
end
--
-- Generates sphere mesh
function physBone.newSphere(part,ID)
for i = 0, 9 do
local faces = {}
for j = 1,5 do
faces["face"..j] = part:newSprite(ID..i..j)
:setTexture(nodeTexture,1,1)
:setUVPixels(2,2)
end
local face1,face2,face3,face4,face5 = faces.face1,faces.face2,faces.face3,faces.face4,faces.face5
face1:getVertices()[1]:setPos(0,8,0)
face1:getVertices()[2]:setPos(0,8,0)
face1:getVertices()[3]:setPos(-1.5279,6.4721,-4.7023)
face1:getVertices()[4]:setPos(1.5279,6.4721,-4.7023)
face1:setRot(0,i*36,0):setRenderType("EMISSIVE_SOLID")
face2:getVertices()[1]:setPos(1.5279,6.4721,-4.7023)
face2:getVertices()[2]:setPos(-1.5279,6.4721,-4.7023)
face2:getVertices()[3]:setPos(-2.4721,2.4721,-7.6085)
face2:getVertices()[4]:setPos(2.4721,2.4721,-7.6085)
face2:setRot(0,i*36,0):setRenderType("EMISSIVE_SOLID")
face3:getVertices()[1]:setPos(2.4721,2.4721,-7.6085)
face3:getVertices()[2]:setPos(-2.4721,2.4721,-7.6085)
face3:getVertices()[3]:setPos(-2.4721,-2.4721,-7.6085)
face3:getVertices()[4]:setPos(2.4721,-2.4721,-7.6085)
face3:setRot(0,i*36,0):setRenderType("EMISSIVE_SOLID")
face4:getVertices()[1]:setPos(2.4721,-2.4721,-7.6085)
face4:getVertices()[2]:setPos(-2.4721,-2.4721,-7.6085)
face4:getVertices()[3]:setPos(-1.5279,-6.4721,-4.7023)
face4:getVertices()[4]:setPos(1.5279,-6.4721,-4.7023)
face4:setRot(0,i*36,0):setRenderType("EMISSIVE_SOLID")
face5:getVertices()[1]:setPos(1.5279,-6.4721,-4.7023)
face5:getVertices()[2]:setPos(-1.5279,-6.4721,-4.7023)
face5:getVertices()[3]:setPos(0,-8,0)
face5:getVertices()[4]:setPos(0,-8,0)
face5:setRot(0,i*36,0):setRenderType("EMISSIVE_SOLID")
end
end
-- Generates physbone debug nodes
function physBone.addDebugNodes(part,nodeStart,nodeEnd,nodeRadius,nodeDensity)
local nodeRadiusGroup = part:newPart("PB_Debug_NodeRadius")
if nodeRadius == 0 then
for i = 1, nodeDensity do
local nodeParent = nodeRadiusGroup:newPart("nodeParent"..i)
local nodeLength = nodeEnd * ((nodeEnd - nodeStart) / nodeEnd) * (i / nodeDensity) + nodeStart
nodeParent:setPos(0,-nodeLength,0)
local node = nodeParent:newPart("node"..i,"CAMERA")
node:newSprite("nodeRadius")
:setTexture(nodeTexture,1,1)
:setRenderType("EMISSIVE_SOLID")
:setMatrix(matrices.mat4():translate(0.5,0.5,0.5):scale(0.5,0.5,0.5):rotate(0,0,0) * 0.1)
end
else
for i = 1, nodeDensity do
local nodeParent = nodeRadiusGroup:newPart("nodeParent"..i)
local nodeLength = nodeEnd * ((nodeEnd - nodeStart) / nodeEnd) * (i / nodeDensity) + nodeStart
nodeParent:setPos(0,-nodeLength,0)
local node = nodeParent:newPart("node"..i)
physBone.newSphere(node,"sphere"..i)
local pivot = node:getPivot()
node:setMatrix(matrices.mat4():translate(-pivot):scale(0.125 * nodeRadius):translate(pivot) * 0.1)
end
end
end
-- Generates a physBone's debug model
function physBone.addDebugParts(part,preset)
local pivotGroup = part:newPart("PB_Debug_Pivot","Camera")
pivotGroup:newSprite("pivot")
:setTexture(whiteTexture,1,1)
:setColor(1,0,0)
:setRenderType("EMISSIVE_SOLID")
:setMatrix(matrices.mat4():translate(0.5,0.5,0.5):scale(0.5,0.5,0.5):rotate(0,0,0) * 0.1)
local directionGroup = part:newPart("PB_Debug_Direction"):newPart("child")
for k = 0, 3 do
directionGroup:newSprite("line"..k)
:setTexture(whiteTexture,1,1)
:setRenderType("EMISSIVE_SOLID")
:setMatrix(matrices.mat4():translate(0.5,0,0.5):scale(0.5,1,0.5):rotate(0,k*90,0) * 0.12)
end
directionGroup:setScale(1,preset.length,1)
local springForceGroup = part:newPart("PB_Debug_SpringForce")
for k = 0, 3 do
springForceGroup:newSprite("line"..k)
:setTexture(whiteTexture,1,1)
:setColor(0,0,1)
:setRenderType("EMISSIVE_SOLID")
:setMatrix(matrices.mat4():translate(0.5,0,0.5):scale(0.25,3,0.25):rotate(0,k*90,0) * 0.11)
end
local equilib = vectors.rotateAroundAxis(90,preset.equilibrium,vec(0,-1,0))
equilib = vectors.rotateAroundAxis(90,equilib,vec(-1,0,0))
local pitch,yaw = physBone.vecToRot(equilib)
springForceGroup:setRot(pitch,0,yaw)
:setScale(1,preset.springForce/50,1)
physBone.addDebugNodes(part,preset.nodeStart,preset.nodeEnd,preset.nodeRadius,preset.nodeDensity)
for k,v in pairs({"PB_Debug_Pivot","PB_Debug_Direction","PB_Debug_SpringForce","PB_Debug_NodeRadius"}) do
part[v]:setVisible(false)
end
end
-- Generate physBones and colliders from model parts
events.entity_init:register(function()
local function findCustomParentTypes(path)
for _,part in pairs(path:getChildren()) do
local ID = part:getName()
local ID_sub = ID:sub(0,8)
if ID_sub == "collider" or ID_sub == "Collider" then
physBone:newCollider(part)
end
for presetID,preset in pairs(physBonePresets) do
if ID:sub(0,#presetID) == presetID then
physBone.newPhysBone(part,preset)
for _,child in pairs(part:getChildren()) do
local ID_child = child:getName()
local ID_child_BEsub = ID_child:sub(0,7)
local ID_child_SFsub = ID_child:sub(0,11)
if ID_child_BEsub == "boneEnd" or ID_child_BEsub == "BoneEnd" then
local childPos = child:getPivot() - part:getPivot()
local rotModVec = vectors.rotateAroundAxis(90,childPos:normalized(),vec(-1,0,0))
local pitch,yaw = physBone.vecToRot(rotModVec)
local length = childPos:length()
physBone[ID]:setRotMod(vec(-pitch,0,-yaw))
physBone[ID]:setRollMod(child:getRot().y)
physBone[ID]:setLength(length)
physBone[ID]:setNodeEnd(length)
elseif ID_child_SFsub == "springForce" or ID_child_SFsub == "SpringForce" then
local childPos = child:getPivot() - part:getPivot()
local equalibVec = childPos:normalized()
physBone[ID]:setEquilibrium(equalibVec)
physBone[ID]:setSpringForce(child:getRot().y)
end
end
part:setRot(0,90,0)
break
end
end
findCustomParentTypes(part)
end
end
findCustomParentTypes(models)
end,'PHYSBONE.generateFromModelParts')
-- Debug keybind
local debugKeybind = keybinds:newKeybind("Toggle PhysBone Debug Mode","key.keyboard.grave.accent")
function debugKeybind.press(mod)
if not (mod == 1) or not doDebugMode then return end
debugMode = not debugMode
for _,boneID in pairs(physBoneIndex) do
physBone[boneID].path.PB_Debug_Pivot:setVisible(debugMode)
physBone[boneID].path.PB_Debug_Direction:setVisible(debugMode)
physBone[boneID].path.PB_Debug_SpringForce:setVisible(debugMode)
physBone[boneID].path.PB_Debug_NodeRadius:setVisible(debugMode)
end
if debugMode then
colliderTexture:setPixel(0,0,vec(1,0.5,0)):update()
else
colliderTexture:setPixel(0,0,vec(0,0,0,0)):update()
end
end
-- Simple clock
local physClock = 0
events.tick:register(function()
physClock = physClock + 1
end,'PHYSBONE.physClock')
-- Render function prep
local deg = math.deg
local atan2 = math.atan2
local asin = math.asin
local zeroVec = vec(0,0,0)
local invalidContexts = {
PAPERDOLL = true,
MINECRAFT_GUI = true,
FIGURA_GUI = true
}
-- Render function
events.RENDER:register(function (delta,context)
if(invalidContexts[context] or client:isPaused()) then
return
end
-- Time calculations
local time = (physClock + delta)
local deltaTime = time - lastDelta
-- If world time / render somehow runs twice, don't run
if deltaTime == 0 then return end
-- Collider setup
local colliderGroups = {}
for colID,collider in pairs(physBone.collider) do
colliderGroups[colID] = {}
local colGroup = colliderGroups[colID]
local colMatrix = collider.part:partToWorldMatrix() * (1/0.15)
local partPos = colMatrix:apply()
local size = collider.size
local colTransMat = colMatrix:copy():translate(-partPos)
local offsetMat = matrices.mat4():translate(collider.offset)
local colNormalX = colMatrix:applyDir(vec(1,0,0)):normalize()
local colNormalY = colMatrix:applyDir(vec(0,1,0)):normalize()
local colNormalZ = colMatrix:applyDir(vec(0,0,1)):normalize()
local faces = collider.faces
if faces.s then
local colPos = (colTransMat * offsetMat:copy()):translate(partPos):apply()
colGroup.s = {pos = colPos, normals = {colNormalX,colNormalY,colNormalZ}, size = vec(size.x,size.y,size.z)}
end
if faces.n then
local colPos = (colTransMat * offsetMat:copy():translate(-size)):translate(partPos):apply()
colGroup.n = {pos = colPos, normals = {-colNormalX,-colNormalY,-colNormalZ}, size = vec(size.x,size.y,size.z)}
end
if faces.e then
local colPos = (colTransMat * offsetMat:copy():translate(-size * vec(0,1,0))):translate(partPos):apply()
colGroup.e = {pos = colPos, normals = {colNormalZ,-colNormalY,colNormalX}, size = vec(size.z,size.y,size.x)}
end
if faces.w then
local colPos = (colTransMat * offsetMat:copy():translate(-size * vec(1,0,1))):translate(partPos):apply()
colGroup.w = {pos = colPos, normals = {-colNormalZ,colNormalY,-colNormalX}, size = vec(size.z,size.y,size.x)}
end
if faces.u then
local colPos = (colTransMat * offsetMat:copy():translate(-size * vec(0,0,1))):translate(partPos):apply()
colGroup.u = {pos = colPos, normals = {colNormalX,-colNormalZ,colNormalY}, size = vec(size.x,size.z,size.y)}
end
if faces.d then
local colPos = (colTransMat * offsetMat:copy():translate(-size * vec(1,1,0))):translate(partPos):apply()
colGroup.d = {pos = colPos, normals = {-colNormalX,colNormalZ,-colNormalY}, size = vec(size.x,size.z,size.y)}
end
end
for _,curPhysBoneID in pairs(physBoneIndex) do
local curPhysBone = physBone[curPhysBoneID]
local worldPartMat = curPhysBone.path:partToWorldMatrix()
-- Pendulum logic
local pendulumBase = worldPartMat:apply()
if pendulumBase.x ~= pendulumBase.x then return end -- avoid physics breaking if partToWorldMatrix returns NaN
local velocity = curPhysBone.velocity / lastestDeltaTime / ((curPhysBone.simSpeed * curPhysBone.mass)/100)
-- Air resistance
local airResistanceFactor = curPhysBone.airResistance
if airResistanceFactor ~= 0 then
local airResistance = velocity * (-airResistanceFactor)
velocity = velocity + airResistance * lasterDeltaTime / curPhysBone.mass
end
-- Spring force
if curPhysBone.springForce ~= 0 then
local equilib = physBone.vecToRotMat(-curPhysBone.equilibrium)
local relativeDirMat = worldPartMat:copy() * equilib:rotate(0,-90,0)
local relativeDir = relativeDirMat:applyDir(0,0,-1):normalized()
local springForce = relativeDir * curPhysBone.springForce
velocity = velocity + springForce * lasterDeltaTime / curPhysBone.mass^2
end
-- Custom force
if curPhysBone.force ~= zeroVec then
velocity = velocity + curPhysBone.force * lasterDeltaTime / curPhysBone.mass^2
end
-- Gravity
velocity = velocity + vec(0, curPhysBone.gravity,0) * lasterDeltaTime / curPhysBone.mass
-- Collisions
local direction = ((curPhysBone.pos + velocity * lasterDeltaTime * ((curPhysBone.simSpeed * curPhysBone.mass)/100)) - pendulumBase):normalized()
local nodeDir = direction
local hasCollided = false
local planeNormal
local distance
local colNodePos
for node = 1, curPhysBone.nodeDensity do
local nodeLength = (curPhysBone.nodeEnd * ((curPhysBone.nodeEnd - curPhysBone.nodeStart) / curPhysBone.nodeEnd) * (node / curPhysBone.nodeDensity) + curPhysBone.nodeStart) / math.worldScale
local nodePos = pendulumBase + nodeDir * (nodeLength / 16)
for groupID,group in pairs(colliderGroups) do
for _,face in pairs(group) do
local normalX = face.normals[1]
local normalY = face.normals[2]
local normalZ = face.normals[3]
local diff = nodePos - face.pos
local distanceX = diff:dot(normalX) / normalX:length()
local distanceY = diff:dot(normalY) / normalY:length()
local distanceZ = diff:dot(normalZ) / normalZ:length()
local worldScale = 16*math.worldScale
local pendulumThickness = 0/worldScale
local size = vec(face.size.x,face.size.y,face.size.z) / worldScale
local penetration = (distanceZ + pendulumThickness) / size.z
local radius = curPhysBone.nodeRadius / worldScale
local isXCollided = (distanceZ - radius) <= 0 and -size.z <= distanceZ
local isYCollided = distanceY <= penetration * size.y and (penetration * -size.y) - size.y <= distanceY and penetration >= -0.5
local isZCollided = distanceX <= penetration * size.x and (penetration * -size.x) - size.x <= distanceX and penetration >= -0.5
if isXCollided and isYCollided and isZCollided then
planeNormal = normalZ
distance = distanceZ - radius
hasCollided = true
nodeDir = (nodePos - pendulumBase):normalized()
colNodePos = nodeLength
end
end
end
end
-- Finalise physics
if not hasCollided then
local nextPos = pendulumBase + direction * (curPhysBone.length / 16 / math.worldScale)
curPhysBone.velocity = nextPos - curPhysBone.pos
curPhysBone.pos = nextPos
else
local bounce = curPhysBone.bounce * 2.61
local colNextPos = direction * (colNodePos / 16 / math.worldScale) - distance * planeNormal
local nextPos = pendulumBase + colNextPos:normalized() * (curPhysBone.length / 16 / math.worldScale)
curPhysBone.velocity = (velocity - bounce * velocity:dot(planeNormal) * planeNormal) * lasterDeltaTime * ((curPhysBone.simSpeed * curPhysBone.mass)/100)
curPhysBone.pos = nextPos
end
-- Rotation calcualtion
local relativeVec = (worldPartMat:copy()):invert():apply(pendulumBase + (curPhysBone.pos - pendulumBase)):normalize()
relativeVec = (relativeVec * curPhysBone.vecMod.zyx):normalized()
relativeVec = vectors.rotateAroundAxis(90,relativeVec,vec(-1,0,0))
local pitch,yaw = physBone.vecToRot(relativeVec)
-- Transform matrix
if curPhysBone.path:getVisible() then
local parentPivot = curPhysBone.path:getPivot()
for _,part in pairs(curPhysBone.path:getChildren()) do
if part:getVisible() then
local partID = part:getName()
if partID ~= "PB_Debug_Pivot" and partID ~= "PB_Debug_SpringForce" then
local pivot = part:getPivot()
local mat = matrices.mat4()
local rot = part:getRot()
mat:translate(-pivot)
:rotate(rot.x,rot.y,rot.z)
:translate(pivot)
:translate(-parentPivot)
if partID ~= "PB_Debug_Direction" and partID ~= "PB_Debug_NodeRadius" then
mat:rotate(vec(0,0,curPhysBone.rotMod.z))
:rotate(vec(0,curPhysBone.rotMod.y,0))
:rotate(vec(curPhysBone.rotMod.x,0,0))
:rotate(vec(0,curPhysBone.rollMod,0))
end
mat:rotate(0,-90,0)
:rotate(pitch,0,yaw)
:translate(parentPivot)
part:setMatrix(mat)
end
end
end
end
end
-- Store deltaTime values
lastestDeltaTime,lasterDeltaTime,lastDeltaTime,lastDelta = lasterDeltaTime,lastDeltaTime,deltaTime,time
end,'PHYSBONE.RENDER')
setmetatable(physBone,{__index=physBone.children,__newindex=function(this,key,value)
rawget(this,'children')[key]= value
end})
return physBone

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 695 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 751 B

View file

@ -0,0 +1,40 @@
require("GSAnimBlend")
local anims = require('JimmyAnims')
local physBone = require('physBoneAPI')
anims(animations.player_bipedal,animations.player_swim)
vanilla_model.PLAYER:setVisible(false)
vanilla_model.ARMOR:setVisible(false)
vanilla_model.HELD_ITEMS:setVisible(true)
vanilla_model.ELYTRA:setVisible(true)
vanilla_model.CAPE:setVisible(false)
models.player_bipedal:setVisible(true)
models.player_swim:setVisible(false)
BlendTime = 2
-- physics
-- function events.entity_init()
-- physBone.physBoneLeftTentacle1:setNodeEnd(1)
-- physBone.physBoneLeftTentacle2:setNodeEnd(4)
-- physBone.physBoneLeftTentacle3:setNodeEnd(4)
-- physBone.physBoneRightTentacle1:setNodeEnd(1)
-- physBone.physBoneRightTentacle2:setNodeEnd(4)
-- physBone.physBoneRightTentacle3:setNodeEnd(4)
--end
local wasThing =false
function events.tick()
local isThing =(player:getPose() == "SWIMMING" and not player:isInWater())
if wasThing ~= isThing then
animations.player_bipedal.getdown_bipedal:setPlaying(isThing)
animations.player_swim.getdown_swim:setPlaying(isThing)
animations.player_bipedal.getup_bipedal:setPlaying(not isThing)
animations.player_swim.getup_swim:setPlaying(not isThing)
end
wasThing = isThing
end

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,924 @@
-- + Made by Jimmy Hellp
-- + V6 for 0.1.0 and above
-- + Thank you GrandpaScout for helping with the library stuff!
-- + Automatically compatible with GSAnimBlend for automatic smooth animation blending
-- + Also includes Manuel's Run Later script
local animsList = {
-- Exclusive Animations
idle="idling",
walk="walking",
walkback="walking backwards",
jumpup="jumping up caused via the jump key",
jumpdown="jumping down after a jump up",
fall="falling after a while",
sprint = "sprinting",
sprintjumpup="sprinting and jumping up caused via the jump key",
sprintjumpdown="sprinting and jumping down after a jump up",
crouch = "crouching",
crouchwalk = "crouching and walking",
crouchwalkback = "crouching and walking backwards",
crouchjumpup = "crouching and jumping up caused via the jump key",
crouchjumpdown = "crouching and jumping down after a jump up",
elytra = "elytra flying",
elytradown = "flying down/diving while elytra flying",
trident = "riptide trident lunging",
sleep = "sleeping",
swim = "while swimming",
sit = "while in any vehicle or modded sitting",
sitmove = "while in any vehicle and moving",
sitmoveback = "while in any vehicle and moving backwards",
sitjumpup = "while in any vehicle and jumping up",
sitjumpdown = "while in any vehicle and jumping down",
sitpass = "while in any vehicle as a passenger",
crawl = "crawling and moving",
crawlstill = "crawling and still",
fly = "creative flying",
flywalk = "flying and moving",
flywalkback = "flying and moving backwards",
flysprint = "flying and sprinting",
flyup = "flying and going up",
flydown = "flying and going down",
climb = "climbing a ladder",
climbstill = "not moving on a ladder without crouching (hitting a ceiling usually)",
climbdown = "going down a ladder",
climbcrouch = "crouching on a ladder",
climbcrouchwalk = "crouching on a ladder and moving",
water = "being in water without swimming",
waterwalk = "in water and moving",
waterwalkback = "in water and moving backwards",
waterup = "in water and going up",
waterdown = "in water and going down",
watercrouch = "in water and crouching",
watercrouchwalk = "in water and crouching and walking",
watercrouchwalkback = "in water and crouching and walking backwards",
watercrouchdown = "in water and crouching and going down",
watercrouchup = "in water and crouching and going up. only possible in bubble columns",
hurt = "MUST BE IN PLAY ONCE LOOP MODE. when hurt",
death = "dying",
-- Inclusive Animations:
attackR = "MUST BE IN PLAY ONCE LOOP MODE. attacking with the right hand",
attackL = "MUST BE IN PLAY ONCE LOOP MODE. attacking with the left hand",
mineR = "MUST BE IN PLAY ONCE LOOP MODE. mining with the right hand",
mineL = "MUST BE IN PLAY ONCE LOOP MODE. mining with the left hand",
eatR = "eating from the right hand",
eatL = "eating from the left hand",
drinkR = "drinking from the right hand",
drinkL = "drinking from the left hand",
blockR = "blocking from the right hand",
blockL = "blocking from the left hand",
bowR = "drawing back a bow from the right hand",
bowL = "drawing back a bow from the left hand",
loadR = "loading a crossbow from the right hand",
loadL = "loading a crossbow from the left hand",
crossbowR = "holding a loaded crossbow in the right hand",
crossbowL = "holding a loaded crossbow in the left hand",
spearR = "holding up a trident in the right hand",
spearL = "holding up a trident in the left hand",
spyglassR = "holding up a spyglass from the right hand",
spyglassL = "holding up a spyglass from the left hand",
hornR = "using a horn in the right hand",
hornL = "using a horn in the left hand",
brushR = "using a brush in the right hand",
brushL = "using a brush in the left hand",
holdR = "holding an item in the right hand",
holdL = "holding an item in the left hand",
}
------------------------------------------------------------------------------------------------------------------------
local function errors(paths,dismiss)
assert(
next(paths),
"§aCustom Script Warning: §6No blockbench models were found, or the blockbench model found contained no animations. \n" .." Check that there are no typos in the given bbmodel name, or that the bbmodel has animations by using this line of code at the top of your script: \n"
.."§f logTable(animations.BBMODEL_NAME_HERE) \n ".."§6If this returns nil your bbmodel name is wrong or it has no animations. You can use \n".."§f logTable(models:getChildren()) \n".."§6 to get the name of every bbmodel in your avatar.§c"
)
for _, path in pairs(paths) do
for _, anim in pairs(path) do
if anim:getName():find("%.") and not dismiss then
error(
"§aCustom Script Warning: §6The animation §b'"..anim:getName().."'§6 has a period ( . ) in its name, the handler can't use that animation and it must be renamed to fit the handler's accepted animation names. \n" ..
" If the animation isn't meant for the handler, you can dismiss this error by adding §fanims.dismiss = true§6 after the require but before setting the bbmodel.§c")
end
end
end
end
local setAllOnVar = true
local setIncluOnVar = true
local setExcluOnVar = true
local allAnims = {}
local excluAnims = {}
local incluAnims = {}
local animsTable= {
allVar = false,
excluVar = false,
incluVar = false
}
local excluState
local incluState
local holdRanims = {}
local holdLanims = {}
local attackRanims = {}
local attackLanims = {}
local mineRanims = {}
local mineLanims = {}
local hasJumped = false
local oneJump = false
local hitBlock
local cFlying = false
local oldcFlying = cFlying
local flying = false
local updateTimer = 0
local flyinit = false
local distinit = false
local dist = 4.5
local oldDist = dist
local reach = 4.5
local yvel
local cooldown
local grounded
local oldgrounded
local fallVel = -0.6
-- wait code from Manuel
local timers = {}
local function wait(ticks,next)
table.insert(timers,{t=world.getTime()+ticks,n=next})
end
events.TICK:register(function()
for key,timer in pairs(timers) do
if world.getTime() >= timer.t then
timer.n()
timers[key] = nil
end
end
end)
--
local bbmodels = {} -- don't put things in here
function pings.JimmyAnims_cFly(x)
flying = x
end
function pings.JimmyAnims_Distance(x)
reach = x
end
function pings.JimmyAnims_Update(fly,dis)
flying = fly
reach = dis
end
local prev
local function JimmyAnims_Swing(anim)
-- test how this works with multiple bbmodels
for _,path in pairs(bbmodels) do
if path[prev] then path[prev]:stop() end
if path[anim] then path[anim]:play() end
prev = anim
end
end
local function anims()
for _, value in ipairs(allAnims) do
if value:isPlaying() then
animsTable.allVar = true
break
else
animsTable.allVar = false or not setAllOnVar
end
end
if next(allAnims) == nil then
animsTable.allVar = not setAllOnVar
end
for _, value in ipairs(excluAnims) do
if value:isPlaying() then
animsTable.excluVar = true
break
else
animsTable.excluVar = false or not setExcluOnVar
end
end
if next(excluAnims) == nil then
animsTable.excluVar = not setExcluOnVar
end
for _, value in ipairs(incluAnims) do
if value:isPlaying() then
animsTable.incluVar = true
break
else
animsTable.incluVar = false or not setIncluOnVar
end
end
if next(incluAnims) == nil then
animsTable.incluVar = not setIncluOnVar
end
excluState = not animsTable.allVar and not animsTable.excluVar
incluState = not animsTable.allVar and not animsTable.incluVar
if host:isHost() then
if flyinit and not distinit then
cFlying = host:isFlying()
if cFlying ~= oldcFlying then
pings.JimmyAnims_cFly(cFlying)
end
oldcFlying = cFlying
updateTimer = updateTimer + 1
if updateTimer % 200 == 0 then
pings.JimmyAnims_cFly(cFlying)
end
elseif distinit and not flyinit then
dist = host:getReachDistance()
if dist ~= oldDist then
pings.JimmyAnims_Distance(dist)
end
oldDist = dist
updateTimer = updateTimer + 1
if updateTimer % 200 == 0 then
pings.JimmyAnims_Distance(dist)
end
elseif distinit and flyinit then
cFlying = host:isFlying()
if cFlying ~= oldcFlying then
pings.JimmyAnims_cFly(cFlying)
end
oldcFlying = cFlying
dist = host:getReachDistance()
if dist ~= oldDist then
pings.JimmyAnims_Distance(dist)
end
oldDist = dist
updateTimer = updateTimer + 1
if updateTimer % 200 == 0 then
pings.JimmyAnims_Update(cFlying,dist)
end
end
end
local pose = player:getPose()
local velocity = player:getVelocity()
local moving = velocity.xz:length() > 0.01
local sprinty = player:isSprinting()
local vehicle = player:getVehicle()
local sitting = vehicle ~= nil or pose == "SITTING" -- if you're reading this code and see this, "SITTING" isn't a vanilla pose, this is for mods
local passenger = vehicle and vehicle:getControllingPassenger() ~= player
local creativeFlying = flying and not sitting
local standing = pose == "STANDING"
local crouching = pose == "CROUCHING" and not creativeFlying
local gliding = pose == "FALL_FLYING"
local spin = pose == "SPIN_ATTACK"
local sleeping = pose == "SLEEPING"
local swimming = pose == "SWIMMING"
local inWater = player:isUnderwater() and not sitting
local inLiquid = player:isInWater() or player:isInLava()
local liquidSwim = swimming and inLiquid
local crawling = swimming and not inLiquid
-- hasJumped stuff
yvel = velocity.y
local hover = yvel < .01 and yvel > -.01
local goingUp = yvel > .01
local goingDown = yvel < -.01
local falling = yvel < fallVel
local playerGround = world.getBlockState(player:getPos():add(0,-.1,0))
local vehicleGround = sitting and world.getBlockState(vehicle:getPos():add(0,-.1,0))
oldgrounded = grounded
grounded = playerGround:isSolidBlock() or player:isOnGround() or (sitting and vehicleGround:isSolidBlock() or sitting and vehicle:isOnGround())
local pv = velocity:mul(1, 0, 1):normalize()
local pl = models:partToWorldMatrix():applyDir(0,0,-1):mul(1, 0, 1):normalize()
local fwd = pv:dot(pl)
local backwards = fwd < -.8
--local sideways = pv:cross(pl)
--local right = sideways.y > .6
--local left = sideways.y < -.6
-- canJump stuff
local webbed = world.getBlockState(player:getPos()).id == "minecraft:cobweb"
local ladder = player:isClimbing() and not grounded and not flying
local canJump = not (inLiquid or webbed or grounded)
local hp = player:getHealth() + player:getAbsorptionAmount()
if oldgrounded ~= grounded and not grounded and yvel > 0 then
cooldown = true
wait(10,function() cooldown = false end)
end
if (oldgrounded ~= grounded and not grounded and yvel > 0) and canJump then hasJumped = true end
if (grounded and (yvel <= 0 and yvel > -0.1)) or (gliding or inLiquid) then hasJumped = false end
local neverJump = not (gliding or spin or sleeping or swimming or ladder)
local jumpingUp = hasJumped and goingUp and neverJump
local jumpingDown = hasJumped and goingDown and not falling and neverJump or (cooldown and not jumpingUp)
local isJumping = jumpingUp or jumpingDown or falling
local sprinting = sprinty and standing and not inLiquid and not sitting
local walking = moving and not sprinting and not isJumping and not sitting
local forward = walking and not backwards
local backward = walking and backwards
-- we be holding items tho
local handedness = player:isLeftHanded()
local rightActive = handedness and "OFF_HAND" or "MAIN_HAND"
local leftActive = not handedness and "OFF_HAND" or "MAIN_HAND"
local activeness = player:getActiveHand()
local using = player:isUsingItem()
local rightSwing = player:getSwingArm() == rightActive and not sleeping
local leftSwing = player:getSwingArm() == leftActive and not sleeping
local targetEntity = type(player:getTargetedEntity()) == "PlayerAPI" or type(player:getTargetedEntity()) == "LivingEntityAPI"
local targetBlock = player:getTargetedBlock(true, reach)
local swingTime = player:getSwingTime() == 1
local success, result = pcall(targetBlock.getTextures, targetBlock)
if success then hitBlock = not (next(result) == nil) else hitBlock = true end
local rightMine = rightSwing and hitBlock and not targetEntity
local leftMine = leftSwing and hitBlock and not targetEntity
local rightAttack = rightSwing and (not hitBlock or targetEntity)
local leftAttack = leftSwing and (not hitBlock or targetEntity)
local rightItem = player:getHeldItem(handedness)
local leftItem = player:getHeldItem(not handedness)
local usingR = activeness == rightActive and rightItem:getUseAction()
local usingL = activeness == leftActive and leftItem:getUseAction()
local crossR = rightItem.tag and rightItem.tag["Charged"] == 1
local crossL = leftItem.tag and leftItem.tag["Charged"] == 1
local drinkRState = using and usingR == "DRINK"
local drinkLState = using and usingL == "DRINK"
local eatRState = using and usingR == "EAT"
local eatLState = using and usingL == "EAT"
local blockRState = using and usingR == "BLOCK"
local blockLState = using and usingL == "BLOCK"
local bowRState = using and usingR == "BOW"
local bowLState = using and usingL == "BOW"
local spearRState = using and usingR == "SPEAR"
local spearLState = using and usingL == "SPEAR"
local spyglassRState = using and usingR == "SPYGLASS"
local spyglassLState = using and usingL == "SPYGLASS"
local hornRState = using and usingR == "TOOT_HORN"
local hornLState = using and usingL == "TOOT_HORN"
local loadRState = using and usingR == "CROSSBOW"
local loadLState = using and usingL == "CROSSBOW"
local brushRState = using and usingR == "BRUSH"
local brushLState = using and usingL == "BRUSH"
local exclude = not (using or crossR or crossL)
local rightHoldState = rightItem.id ~= "minecraft:air" and exclude
local leftHoldState = leftItem.id ~= "minecraft:air" and exclude
-- anim states
for _, path in pairs(bbmodels) do
local flywalkbackState = creativeFlying and backward and (not (goingDown or goingUp))
local flysprintState = creativeFlying and sprinting and not isJumping and (not (goingDown or goingUp))
local flyupState = creativeFlying and goingUp
local flydownState = creativeFlying and goingDown
local flywalkState = creativeFlying and forward and (not (goingDown or goingUp)) and not sleeping or (flysprintState and not path.flysprint) or (flywalkbackState and not path.flywalkback)
or (flyupState and not path.flyup) or (flydownState and not path.flydown)
local flyState = creativeFlying and not sprinting and not moving and standing and not isJumping and (not (goingDown or goingUp)) and not sleeping or (flywalkState and not path.flywalk)
local watercrouchwalkbackState = inWater and crouching and backward and not goingDown
local watercrouchwalkState = inWater and crouching and forward and not (goingDown or goingUp) or (watercrouchwalkbackState and not path.watercrouchwalkback)
local watercrouchupState = inWater and crouching and goingUp
local watercrouchdownState = inWater and crouching and goingDown or (watercrouchupState and not path.watercrouchup)
local watercrouchState = inWater and crouching and not moving and not (goingDown or goingUp) or (watercrouchdownState and not path.watercrouchdown) or (watercrouchwalkState and not path.watercrouchwalk)
local waterdownState = inWater and goingDown and not falling and standing and not creativeFlying
local waterupState = inWater and goingUp and standing and not creativeFlying
local waterwalkbackState = inWater and backward and hover and standing and not creativeFlying
local waterwalkState = inWater and forward and hover and standing and not creativeFlying or (waterwalkbackState and not path.waterwalkback) or (waterdownState and not path.waterdown)
or (waterupState and not path.waterup)
local waterState = inWater and not moving and standing and hover and not creativeFlying or (waterwalkState and not path.waterwalk)
local crawlstillState = crawling and not moving
local crawlState = crawling and moving or (crawlstillState and not path.crawlstill)
local swimState = liquidSwim or (crawlState and not path.crawl)
local elytradownState = gliding and goingDown
local elytraState = gliding and not goingDown or (elytradownState and not path.elytradown)
local sitpassState = passenger and standing
local sitjumpdownState = sitting and not passenger and standing and (jumpingDown or falling)
local sitjumpupState = sitting and not passenger and jumpingUp and standing or (sitjumpdownState and not path.sitjumpdown)
local sitmovebackState = sitting and not passenger and not isJumping and backwards and standing
local sitmoveState = velocity:length() > 0 and not passenger and not backwards and standing and sitting and not isJumping or (sitmovebackState and not path.sitmoveback) or (sitjumpupState and not path.sitjumpup)
local sitState = sitting and not passenger and velocity:length() == 0 and not isJumping and standing or (sitmoveState and not path.sitmove) or (sitpassState and not path.sitpass)
local tridentState = spin
local sleepState = sleeping
local climbcrouchwalkState = ladder and crouching and (moving or yvel ~= 0)
local climbcrouchState = ladder and crouching and hover and not moving or (climbcrouchwalkState and not path.climbcrouchwalk)
local climbdownState = ladder and goingDown
local climbstillState = ladder and not crouching and hover
local climbState = ladder and goingUp and not crouching or (climbdownState and not path.climbdown) or (climbstillState and not path.climbstill)
local crouchjumpdownState = crouching and jumpingDown and not ladder and not inWater
local crouchjumpupState = crouching and jumpingUp and not ladder or (not oneJump and (crouchjumpdownState and not path.crouchjumpdown))
local crouchwalkbackState = backward and crouching and not ladder and not inWater or (watercrouchwalkbackState and not path.watercrouchwalkback and not path.watercrouchwalk and not path.watercrouch)
local crouchwalkState = forward and crouching and not ladder and not inWater or (crouchwalkbackState and not path.crouchwalkback) or (not oneJump and (crouchjumpupState and not path.crouchjumpup)) or ((watercrouchwalkState and not watercrouchwalkbackState) and not path.watercrouchwalk and not path.watercrouch)
local crouchState = crouching and not walking and not isJumping and not ladder and not inWater and not cooldown or (crouchwalkState and not path.crouchwalk) or (climbcrouchState and not path.climbcrouch) or ((watercrouchState and not watercrouchwalkState) and not path.watercrouch)
local fallState = falling and not gliding and not creativeFlying and not sitting
local sprintjumpdownState = jumpingDown and sprinting and not creativeFlying and not ladder
local sprintjumpupState = jumpingUp and sprinting and not creativeFlying and not ladder or (not oneJump and (sprintjumpdownState and not path.sprintjumpdown))
local jumpdownState = jumpingDown and not sprinting and not crouching and not sitting and not gliding and not creativeFlying and not spin and not inWater or (fallState and not path.fall) or (oneJump and (sprintjumpdownState and not path.sprintjumpdown)) or (oneJump and (crouchjumpdownState and not path.crouchjumpdown))
local jumpupState = jumpingUp and not sprinting and not crouching and not sitting and not creativeFlying and not inWater or (jumpdownState and not path.jumpdown) or (tridentState and not path.trident) or (oneJump and (sprintjumpupState and not path.sprintjumpup)) or (oneJump and (crouchjumpupState and not path.crouchjumpup))
local sprintState = sprinting and not isJumping and not creativeFlying and not ladder and not cooldown or (not oneJump and (sprintjumpupState and not path.sprintjumpup))
local walkbackState = backward and standing and not creativeFlying and not ladder and not inWater or (flywalkbackState and not path.flywalkback and not path.flywalk and not path.fly)
local walkState = forward and standing and not creativeFlying and not ladder and not inWater and not cooldown or (walkbackState and not path.walkback) or (sprintState and not path.sprint) or (climbState and not path.climb)
or (swimState and not path.swim) or (elytraState and not path.elytra) or (jumpupState and not path.jumpup) or (waterwalkState and (not path.waterwalk and not path.water)) or ((flywalkState and not flywalkbackState) and not path.flywalk and not path.fly)
or (crouchwalkState and not path.crouch)
local idleState = not moving and not sprinting and standing and not isJumping and not sitting and not creativeFlying and not ladder and not inWater or (sleepState and not path.sleep) or (sitState and not path.sit)
or ((waterState and not waterwalkState) and not path.water) or ((flyState and not flywalkState) and not path.fly) or ((crouchState and not crouchwalkState) and not path.crouch)
local deadState = hp <= 0
if path.death then path.death:playing(excluState and deadState) end
-- anim play testing
if path.hurt and player:getNbt().HurtTime == 9 then
path.hurt:restart()
end
if path.idle then path.idle:playing(excluState and idleState) end
if path.walk then path.walk:playing(excluState and walkState) end
if path.walkback then path.walkback:playing(excluState and walkbackState) end
if path.sprint then path.sprint:playing(excluState and sprintState) end
if path.sprintjumpup then path.sprintjumpup:playing(excluState and sprintjumpupState) end
if path.sprintjumpdown then path.sprintjumpdown:playing(excluState and sprintjumpdownState) end
if path.crouch then path.crouch:playing(excluState and crouchState) end
if path.crouchwalk then path.crouchwalk:playing(excluState and crouchwalkState) end
if path.crouchwalkback then path.crouchwalkback:playing(excluState and crouchwalkbackState) end
if path.crouchjumpup then path.crouchjumpup:playing(excluState and crouchjumpupState) end
if path.crouchjumpdown then path.crouchjumpdown:playing(excluState and crouchjumpdownState) end
if path.jumpup then path.jumpup:playing(excluState and jumpupState) end
if path.jumpdown then path.jumpdown:playing(excluState and jumpdownState) end
if path.fall then path.fall:playing(excluState and fallState) end
if path.elytra then path.elytra:playing(excluState and elytraState) end
if path.elytradown then path.elytradown:playing(excluState and elytradownState) end
if path.trident then path.trident:playing(excluState and tridentState) end
if path.sleep then path.sleep:playing(excluState and sleepState) end
if path.swim then path.swim:playing(excluState and swimState) end
if path.sit then path.sit:playing(excluState and sitState) end
if path.sitmove then path.sitmove:playing(excluState and sitmoveState) end
if path.sitmoveback then path.sitmoveback:playing(excluState and sitmovebackState) end
if path.sitjumpup then path.sitjumpup:playing(excluState and sitjumpupState) end
if path.sitjumpdown then path.sitjumpdown:playing(excluState and sitjumpdownState) end
if path.sitpass then path.sitpass:playing(excluState and sitpassState) end
if path.crawl then path.crawl:playing(excluState and crawlState) end
if path.crawlstill then path.crawlstill:playing(excluState and crawlstillState) end
if path.fly then path.fly:playing(excluState and flyState) end
if path.flywalk then path.flywalk:playing(excluState and flywalkState) end
if path.flywalkback then path.flywalkback:playing(excluState and flywalkbackState) end
if path.flysprint then path.flysprint:playing(excluState and flysprintState) end
if path.flyup then path.flyup:playing(excluState and flyupState) end
if path.flydown then path.flydown:playing(excluState and flydownState) end
if path.climb then path.climb:playing(excluState and climbState) end
if path.climbstill then path.climbstill:playing(excluState and climbstillState) end
if path.climbdown then path.climbdown:playing(excluState and climbdownState) end
if path.climbcrouch then path.climbcrouch:playing(excluState and climbcrouchState) end
if path.climbcrouchwalk then path.climbcrouchwalk:playing(excluState and climbcrouchwalkState) end
if path.water then path.water:playing(excluState and waterState) end
if path.waterwalk then path.waterwalk:playing(excluState and waterwalkState) end
if path.waterwalkback then path.waterwalkback:playing(excluState and waterwalkbackState) end
if path.waterup then path.waterup:playing(excluState and waterupState) end
if path.waterdown then path.waterdown:playing(excluState and waterdownState) end
if path.watercrouch then path.watercrouch:playing(excluState and watercrouchState) end
if path.watercrouchwalk then path.watercrouchwalk:playing(excluState and watercrouchwalkState) end
if path.watercrouchwalkback then path.watercrouchwalkback:playing(excluState and watercrouchwalkbackState) end
if path.watercrouchdown then path.watercrouchdown:playing(excluState and watercrouchdownState) end
if path.watercrouchup then path.watercrouchup:playing(excluState and watercrouchupState) end
if path.eatR then path.eatR:playing(incluState and eatRState or (drinkRState and not path.drinkR)) end
if path.eatL then path.eatL:playing(incluState and eatLState or (drinkLState and not path.drinkL)) end
if path.drinkR then path.drinkR:playing(incluState and drinkRState) end
if path.drinkL then path.drinkL:playing(incluState and drinkLState) end
if path.blockR then path.blockR:playing(incluState and blockRState) end
if path.blockL then path.blockL:playing(incluState and blockLState) end
if path.bowR then path.bowR:playing(incluState and bowRState) end
if path.bowL then path.bowL:playing(incluState and bowLState) end
if path.loadR then path.loadR:playing(incluState and loadRState) end
if path.loadL then path.loadL:playing(incluState and loadLState) end
if path.crossbowR then path.crossbowR:playing(incluState and crossR) end
if path.crossbowL then path.crossbowL:playing(incluState and crossL) end
if path.spearR then path.spearR:playing(incluState and spearRState) end
if path.spearL then path.spearL:playing(incluState and spearLState) end
if path.spyglassR then path.spyglassR:playing(incluState and spyglassRState) end
if path.spyglassL then path.spyglassL:playing(incluState and spyglassLState) end
if path.hornR then path.hornR:playing(incluState and hornRState) end
if path.hornL then path.hornL:playing(incluState and hornLState) end
if path.brushR then path.brushR:playing(incluState and brushRState) end
if path.brushL then path.brushL:playing(incluState and brushLState) end
if path.holdR then path.holdR:playing(incluState and rightHoldState) end
if path.holdL then path.holdL:playing(incluState and leftHoldState) end
end
if swingTime then
local specialAttack = false
if rightAttack and incluState then
for _, value in pairs(attackRanims) do
if value:getName():find("ID_") then
if rightItem.id:find(value:getName():gsub("_attackR",""):gsub("ID_","")) then
JimmyAnims_Swing(value:getName())
specialAttack = true
end
elseif value:getName():find("Name_") then
if rightItem:getName():find(value:getName():gsub("_attackR",""):gsub("Name_","")) then
JimmyAnims_Swing(value:getName())
specialAttack = true
end
end
end
if not specialAttack then
JimmyAnims_Swing("attackR")
end
elseif leftAttack and incluState then
for _, value in pairs(attackLanims) do
if value:getName():find("ID_") then
if leftItem.id:find(value:getName():gsub("_attackL",""):gsub("ID_","")) then
JimmyAnims_Swing(value:getName())
specialAttack = true
end
elseif value:getName():find("Name_") then
if leftItem:getName():find(value:getName():gsub("_attackL",""):gsub("Name_","")) then
JimmyAnims_Swing(value:getName())
specialAttack = true
end
end
end
if specialAttack == false then
JimmyAnims_Swing("attackL")
end
elseif rightMine and incluState then
for _, value in pairs(mineRanims) do
if value:getName():find("ID_") then
if rightItem.id:find(value:getName():gsub("_mineR",""):gsub("ID_","")) then
JimmyAnims_Swing(value:getName())
specialAttack = true
end
elseif value:getName():find("Name_") then
if rightItem:getName():find(value:getName():gsub("_mineR",""):gsub("Name_","")) then
JimmyAnims_Swing(value:getName())
specialAttack = true
end
end
end
if not specialAttack then
JimmyAnims_Swing("mineR")
end
elseif leftMine and incluState then
for _, value in pairs(mineLanims) do
if value:getName():find("ID_") then
if leftItem.id:find(value:getName():gsub("_mineL",""):gsub("ID_","")) then
JimmyAnims_Swing(value:getName())
specialAttack = true
end
elseif value:getName():find("Name_") then
if leftItem:getName():find(value:getName():gsub("_mineL",""):gsub("Name_","")) then
JimmyAnims_Swing(value:getName())
specialAttack = true
end
end
end
if not specialAttack then
JimmyAnims_Swing("mineL")
end
end
end
for _,value in pairs(holdRanims) do
if value:getName():find("ID_") then
value:setPlaying(rightItem.id:find(value:getName():gsub("_holdR",""):gsub("ID_","")) and incluState and exclude)
elseif value:getName():find("Name_") then
value:setPlaying(rightItem:getName():find(value:getName():gsub("_holdR",""):gsub("Name_","")) and incluState and exclude)
end
if value:isPlaying() then
for _, path in pairs(bbmodels) do
if path.holdR then path.holdR:stop() end
end
end
end
for _,value in pairs(holdLanims) do
if value:getName():find("ID_") then
value:setPlaying(leftItem.id:find(value:getName():gsub("_holdL",""):gsub("ID_","")) and incluState and exclude)
elseif value:getName():find("Name_") then
value:setPlaying(leftItem:getName():find(value:getName():gsub("_holdL",""):gsub("Name_","")) and incluState and exclude)
end
if value:isPlaying() then
for _, path in pairs(bbmodels) do
if path.holdL then path.holdL:stop() end
end
end
end
end
local attackinit = true
local function animInit()
for _, path in pairs(bbmodels) do
for _,anim in pairs(path) do
if (anim:getName():find("attackR") or anim:getName():find("attackL") or anim:getName():find("mineR") or anim:getName():find("mineL")) and attackinit then
attackinit = false
distinit = true
end
if anim:getName():find("^fly") then
flyinit = true
end
if anim:getName():find("_holdR") then
holdRanims[#holdRanims+1] = anim
end
if anim:getName():find("_holdL") then
holdLanims[#holdLanims+1] = anim
end
if anim:getName():find("_attackR") then
attackRanims[#attackRanims+1] = anim
end
if anim:getName():find("_attackL") then
attackLanims[#attackLanims+1] = anim
end
if anim:getName():find("_mineR") then
mineRanims[#mineRanims+1] = anim
end
if anim:getName():find("_mineL") then
mineLanims[#mineLanims+1] = anim
end
end
end
end
local function tick()
anims()
end
local GSAnimBlend
for _, key in ipairs(listFiles(nil,true)) do
if key:find("GSAnimBlend$") then
GSAnimBlend = require(key)
break
end
end
if GSAnimBlend then GSAnimBlend.safe = false end
local function blend(paths, time, itemTime)
if not GSAnimBlend then return end
for _, path in pairs(paths) do
if path.walk then path.walk:blendTime(time) end
if path.idle then path.idle:blendTime(time) end
if path.crouch then path.crouch:blendTime(time) end
if path.walkback then path.walkback:blendTime(time) end
if path.sprint then path.sprint:blendTime(time) end
if path.crouchwalk then path.crouchwalk:blendTime(time) end
if path.crouchwalkback then path.crouchwalkback:blendTime(time) end
if path.elytra then path.elytra:blendTime(time) end
if path.elytradown then path.elytradown:blendTime(time) end
if path.fly then path.fly:blendTime(time) end
if path.flywalk then path.flywalk:blendTime(time) end
if path.flywalkback then path.flywalkback:blendTime(time) end
if path.flysprint then path.flysprint:blendTime(time) end
if path.flyup then path.flyup:blendTime(time) end
if path.flydown then path.flydown:blendTime(time) end
if path.sit then path.sit:blendTime(time) end
if path.sitmove then path.sitmove:blendTime(time) end
if path.sitmoveback then path.sitmoveback:blendTime(time) end
if path.sitjumpup then path.sitjumpup:blendTime(time) end
if path.sitjumpdown then path.sitjumpdown:blendTime(time) end
if path.sitpass then path.sitpass:blendTime(time) end
if path.sleep then path.sleep:blendTime(time) end
if path.climb then path.climb:blendTime(time) end
if path.climbstill then path.climbstill:blendTime(time) end
if path.climbdown then path.climbdown:blendTime(time) end
if path.climbcrouch then path.climbcrouch:blendTime(time) end
if path.climbcrouchwalk then path.climbcrouchwalk:blendTime(time) end
if path.swim then path.swim:blendTime(time) end
if path.crawl then path.crawl:blendTime(time) end
if path.crawlstill then path.crawlstill:blendTime(time) end
if path.fall then path.fall:blendTime(time) end
if path.jumpup then path.jumpup:blendTime(time) end
if path.jumpdown then path.jumpdown:blendTime(time) end
if path.sprintjumpup then path.sprintjumpup:blendTime(time) end
if path.sprintjumpdown then path.sprintjumpdown:blendTime(time) end
if path.crouchjumpup then path.crouchjumpup:blendTime(time) end
if path.crouchjumpdown then path.crouchjumpdown:blendTime(time) end
if path.trident then path.trident:blendTime(time) end
if path.death then path.death:blendTime(time) end
if path.water then path.water:blendTime(time) end
if path.waterwalk then path.waterwalk:blendTime(time) end
if path.waterwalkback then path.waterwalkback:blendTime(time) end
if path.waterup then path.waterup:blendTime(time) end
if path.waterdown then path.waterdown:blendTime(time) end
if path.watercrouch then path.watercrouch:blendTime(time) end
if path.watercrouchwalk then path.watercrouchwalk:blendTime(time) end
if path.watercrouchwakback then path.watercrouchwakback:blendTime(time) end
if path.watercrouchdown then path.watercrouchdown:blendTime(time) end
if path.watercrouchup then path.watercrouchup:blendTime(time) end
if path.eatR then path.eatR:blendTime(itemTime) end
if path.eatL then path.eatL:blendTime(itemTime) end
if path.drinkR then path.drinkR:blendTime(itemTime) end
if path.drinkL then path.drinkL:blendTime(itemTime) end
if path.blockR then path.blockR:blendTime(itemTime) end
if path.blockL then path.blockL:blendTime(itemTime) end
if path.bowR then path.bowR:blendTime(itemTime) end
if path.bowL then path.bowL:blendTime(itemTime) end
if path.crossbowR then path.crossbowR:blendTime(itemTime) end
if path.crossbowL then path.crossbowL:blendTime(itemTime) end
if path.loadR then path.loadR:blendTime(itemTime) end
if path.loadL then path.loadL:blendTime(itemTime) end
if path.spearR then path.spearR:blendTime(itemTime) end
if path.spearL then path.spearL:blendTime(itemTime) end
if path.spyglassR then path.spyglassR:blendTime(itemTime) end
if path.spyglassL then path.spyglassL:blendTime(itemTime) end
if path.hornR then path.hornR:blendTime(itemTime) end
if path.hornL then path.hornL:blendTime(itemTime) end
if path.brushR then path.brushR:blendTime(itemTime) end
if path.brushL then path.brushL:blendTime(itemTime) end
if path.attackR then path.attackR:blendTime(itemTime) end
if path.attackL then path.attackL:blendTime(itemTime) end
if path.mineR then path.mineR:blendTime(itemTime) end
if path.mineL then path.mineL:blendTime(itemTime) end
if path.holdR then path.holdR:blendTime(itemTime) end
if path.holdL then path.holdL:blendTime(itemTime) end
end
for _,value in pairs(holdRanims) do
value:blendTime(itemTime)
end
for _,value in pairs(holdLanims) do
value:blendTime(itemTime)
end
for _,value in pairs(attackRanims) do
value:blendTime(itemTime)
end
for _,value in pairs(attackLanims) do
value:blendTime(itemTime)
end
for _,value in pairs(mineRanims) do
value:blendTime(itemTime)
end
for _,value in pairs(mineLanims) do
value:blendTime(itemTime)
end
end
wait(20,function()
assert(
next(bbmodels),
"§aCustom Script Warning: §6JimmyAnims isn't being required, or a blockbench model isn't being provided to it. \n".."§6 Put this code in a DIFFERENT script to use JimmyAnims: \n".."§flocal anims = require('JimmyAnims') \n"..
"§fanims(animations.BBMODEL_NAME_HERE) \n".."§6 Where you replace BBMODEL_NAME_HERE with the name of your bbmodel. \n".."§6 Or go to the top of the script or to the top of the Discord forum for more complete instructions.".."§c")
end)
local init = false
local animMT = {__call = function(self, ...)
local paths = {...}
local should_blend = true
if self.autoBlend ~= nil then should_blend = self.autoBlend end
if self.fall ~= nil then fallVel = self.fall end
errors(paths,self.dismiss)
for _, v in ipairs(paths) do
bbmodels[#bbmodels+1] = v
end
if #bbmodels >= 64 then
error(
"§aCustom Script Warning: §6You've reached the max limit of 64 bbmodels that can be added to JimmyAnims. To save your FPS the script has been stopped. \n"..
"To prevent this from happening accidentally you should move the function call out of any function it is in.§c"
,2
)
end
-- Init stuff.
if init then return end
animInit()
if should_blend then blend(paths, self.excluBlendTime or 4, self.incluBlendTime or 4) end
events.TICK:register(tick)
init = true
end}
local function addAllAnimsController(...)
if #allAnims >= 1024 then
error(
"§aCustom Script Warning: §6You've reached the max limit of 1024 animations that can be added to the addAllAnimsController. To save your FPS the script has been stopped. \n"..
"To prevent this from happening accidentally you should move the function call out of any function it is in.§c"
,2
)
end
for _, v in ipairs{...} do
assert(
type(v) == "Animation",
"§aCustom Script Warning: §6addAllAnimsController was given something that isn't an animation, check its spelling for errors.§c")
allAnims[#allAnims+1] = v
end
end
local function addExcluAnimsController(...)
if #excluAnims >= 1024 then
error(
"§aCustom Script Warning: §6You've reached the max limit of 1024 animations that can be added to the addExcluAnimsController. To save your FPS the script has been stopped. \n"..
"To prevent this from happening accidentally you should move the function call out of any function it is in.§c"
,2
)
end
for _, v in ipairs{...} do
assert(
type(v) == "Animation",
"§aCustom Script Warning: §6addExcluAnimsController was given something that isn't an animation, check its spelling for errors.§c")
excluAnims[#excluAnims+1] = v
end
end
local function addIncluAnimsController(...)
if #incluAnims >= 1024 then
error(
"§aCustom Script Warning: §6You've reached the max limit of 1024 animations that can be added to the addIncluAnimsController. To save your FPS the script has been stopped. \n"..
"To prevent this from happening accidentally you should move the function call out of any function it is in.§c"
,2
)
end
for _, v in ipairs{...} do
assert(
type(v) == "Animation",
"§aCustom Script Warning: §6addIncluAnimsController was given something that isn't an animation, check its spelling for errors.§c")
incluAnims[#incluAnims+1] = v
end
end
local function setAllOn(x)
setAllOnVar = x
end
local function setExcluOn(x)
setExcluOnVar = x
end
local function setIncluOn(x)
setIncluOnVar = x
end
local function oneJumpFunc(x)
oneJump = x
end
-- If you're choosing to edit this script, don't put anything beneath the return line
return setmetatable(
{
animsList = animsList,
addAllAnimsController = addAllAnimsController,
addExcluAnimsController = addExcluAnimsController,
addIncluAnimsController = addIncluAnimsController,
setAllOn = setAllOn,
setExcluOn = setExcluOn,
setIncluOn = setIncluOn,
oneJump = oneJumpFunc,
},
animMT
)

View file

@ -0,0 +1,8 @@
{
"authors": [
"Perfect System DX",
"akirapink"
],
"name": "Perfect System DX (v2)",
"description":"Squideogames :squid: :octopus:"
}

View file

@ -0,0 +1,853 @@
-- Physbone 2.0 by ChloeSpacedOut <3
-- Some funny additions made by Superpowers04 :3
local physBone = {
-- DO NOT ENABLE THIS UNLESS YOU KNOW WHAT YOU'RE DOING, THIS APPENDS THE INDEX OF THE PHYSBONE TO IT'S NAME IF THERE'S A DUPLICATE AND CAN CAUSE ISSUES
allowDuplicates = false,
-- Diabled debug mode
disableDebugMode = false,
children = {},
collider = {},
index = {},
}
local doDebugMode = host:isHost() and not physBone.disableDebugMode
local physBoneIndex = physBone.index
local boneID = 0
local lastDeltaTime,lasterDeltaTime,lastestDeltaTime,lastDelta = 1,1,1,1
local physBonePresets = {}
local debugMode = false
local whiteTexture = textures:newTexture("white",1,1)
:setPixel(0,0,vec(1,1,1))
local colliderTexture = textures:newTexture("collider",1,1)
:setPixel(0,0,vec(0,0,0,0))
local nodeTexture = textures:newTexture("node",1,1)
:setPixel(0,0,vec(0,0.7,1))
physBone.getVals = function(val1,val2,val3,val4)
local type = type(val1)
if type == "Vector2" or type == "Vector3" then
return val1
elseif val3 then
return vec(val1,val2,val3)
else
return vec(val2,val2)
end
end
physBone.vecToRot = function(vec3)
vec3 = vec3:copy():normalize()
local pitch = math.deg(math.asin(-vec3.y))
local yaw = math.deg(math.atan2(vec3.x,vec3.z))
return pitch,yaw
end
physBone.vecToRotMat = function(vec3)
local w = vec3:copy():normalize()
local u = vec(1,0,0)
if math.abs(u:copy():dot(w)) > 0.7 then
u = vec(0,1,0)
end
local v = w:copy():cross(u)
u = v:copy():cross(w)
return matrices.mat4(vec(u.x,u.y,u.z,0),vec(v.x,v.y,v.z,0),vec(w.x,w.y,w.z,0),vec(0,0,0,1))
end
-- Physbone metatable
local physBoneBase = {
setMass =
function(self,data)
self.mass = data
return self
end,
getMass =
function(self)
return self.mass
end,
setLength =
function(self,data)
self.length = data
if doDebugMode and self.path.PB_Debug_Direction then
self.path.PB_Debug_Direction.child:setScale(1,data,1)
end
return self
end,
getLength =
function(self)
return self.length
end,
setGravity =
function(self,data)
self.gravity = data
return self
end,
getGravity =
function(self)
return self.gravity
end,
setAirResistance =
function(self,data)
self.airResistance = data
return self
end,
getAirResistance =
function(self)
return self.airResistance
end,
setSimSpeed =
function(self,data)
self.simSpeed = data
return self
end,
getSimSpeed =
function(self)
return self.simSpeed
end,
setSpringForce =
function(self,data)
self.springForce = data
if doDebugMode and self.path.PB_Debug_SpringForce then
local springForceGroup = self.path.PB_Debug_SpringForce
springForceGroup:setScale(1,self.springForce/50,1)
end
return self
end,
getSpringForce =
function(self)
return self.springForce
end,
setEquilibrium =
function(self,val1,val2,val3)
local data = physBone.getVals(val1,val2,val3)
self.equilibrium = data
if doDebugMode and self.path.PB_Debug_SpringForce then
local springForceGroup = self.path.PB_Debug_SpringForce
local equilib = vectors.rotateAroundAxis(90,data,vec(0,-1,0))
equilib = vectors.rotateAroundAxis(90,equilib,vec(-1,0,0))
local pitch,yaw = physBone.vecToRot(equilib)
springForceGroup:setRot(pitch,0,yaw)
end
return self
end,
getEquilibrium =
function(self)
return self.equilibrium
end,
setForce =
function(self,val1,val2,val3)
local data = physBone.getVals(val1,val2,val3)
self.force = data
return self
end,
getForce =
function(self)
return self.force
end,
setRotMod =
function(self,val1,val2,val3)
local data = physBone.getVals(val1,val2,val3)
self.rotMod = data
return self
end,
getRotMod =
function(self)
return self.upsideDown
end,
setVecMod =
function(self,val1,val2,val3)
local data = physBone.getVals(val1,val2,val3)
self.vecMod = data
return self
end,
getVecMod =
function(self)
return self.vecMod
end,
setRollMod =
function(self,data)
self.rollMod = data
return self
end,
getRollMod =
function(self)
return self.rollMod
end,
setNodeStart =
function(self,data)
self.nodeStart = data
if doDebugMode and self.path.PB_Debug_NodeRadius then
self.path.PB_Debug_NodeRadius:remove()
physBone.addDebugNodes(self.path,data,self.nodeEnd,self.nodeRadius,self.nodeDensity)
self.path.PB_Debug_NodeRadius:setVisible(debugMode)
end
return self
end,
getNodeStart =
function(self)
return self.nodeStart
end,
setNodeEnd =
function(self,data)
self.nodeEnd = data
if doDebugMode and self.path.PB_Debug_NodeRadius then
self.path.PB_Debug_NodeRadius:remove()
physBone.addDebugNodes(self.path,self.nodeStart,data,self.nodeRadius,self.nodeDensity)
self.path.PB_Debug_NodeRadius:setVisible(debugMode)
end
return self
end,
getNodeEnd =
function(self)
return self.nodeEnd
end,
setNodeDensity =
function(self,data)
self.nodeDensity = data
if doDebugMode and self.path.PB_Debug_NodeRadius then
self.path.PB_Debug_NodeRadius:remove()
physBone.addDebugNodes(self.path,self.nodeStart,self.nodeEnd,self.nodeRadius,data)
self.path.PB_Debug_NodeRadius:setVisible(debugMode)
end
return self
end,
getNodeDensity =
function(self)
return self.nodeDensity
end,
setNodeRadius =
function(self,data)
self.nodeRadius = data
if doDebugMode and self.path.PB_Debug_NodeRadius then
self.path.PB_Debug_NodeRadius:remove()
physBone.addDebugNodes(self.path,self.nodeStart,self.nodeEnd,data,self.nodeDensity)
self.path.PB_Debug_NodeRadius:setVisible(debugMode)
end
return self
end,
getNodeRadius =
function(self)
return self.nodeRadius
end,
setBounce =
function(self,data)
self.bounce = data
return self
end,
getBounce =
function(self)
return self.bounce
end,
updateWithPreset =
function(self,presetID)
assert(presetID,'error making physBone: your preset can not be nil')
local preset = type(presetID) == "table" and presetID or physBonePresets[presetID]
assert(preset,'error making physBone: preset "'..tostring(presetID)..'" does not exist')
for k,v in pairs {"mass","length","gravity","airResistance","simSpeed","equilibrium","springForce","force","rotMod","vecMod","rollMod","nodeStart","nodeEnd","nodeDensity","nodeRadius","bounce"} do
if preset[v] then
local funct = "set"..string.upper(string.sub(v,0,1))..string.sub(v,2,-1)
self[funct](self,preset[v])
end
end
return self
end,
remove =
function(self)
local path = self.path
local ID = self.ID
boneID = 0
local newIndex = {}
for k,v in pairs(physBoneIndex) do
if v ~= ID then
boneID = boneID + 1
newIndex[boneID] = v
end
end
physBoneIndex = newIndex
physBone[ID] = nil
for k,v in pairs(path:getChildren()) do
v:setRot(v:getRot())
end
path:setRot(0,0,0)
end
}
local physBoneMT = {__index=physBoneBase}
-- Internal Function: Returns physbone metatable from set values
physBone.newPhysBoneFromValues = function(self,path,mass,length,gravity,airResistance,simSpeed,equilibrium,springForce,force,rotMod,vecMod,rollMod,nodeStart,nodeEnd,nodeDensity,nodeRadius,bounce,id,name)
if(self ~= physBone) then
-- Literally just offsets everything so self is used as the base
path,mass,length,gravity,airResistance,simSpeed,equilibrium,springForce,force,rotMod,vecMod,rollMod,nodeStart,nodeEnd,nodeDensity,nodeRadius,bounce,id,name = self,path,mass,length,gravity,airResistance,simSpeed,equilibrium,springForce,force,rotMod,vecMod,rollMod,nodeStart,nodeEnd,nodeDensity,nodeRadius,bounce,id,name
end
assert(user:isLoaded(),'error making physBone: attempt to create part before entity init')
assert(path,'error making physBone: part is null!')
local ID = name or path:getName()
local pos = path:partToWorldMatrix():apply()
local velocity = vec(0,0,0)
return setmetatable({
index=nil,
ID = ID,
path = path,
pos = pos,
velocity = velocity,
mass = mass,
length = length,
gravity = gravity,
airResistance = airResistance,
simSpeed = simSpeed,
equilibrium = equilibrium,
springForce = springForce,
force = force,
rotMod = rotMod,
vecMod = vecMod,
rollMod = rollMod,
nodeStart = nodeStart,
nodeEnd = nodeEnd,
nodeDensity = nodeDensity,
nodeRadius = nodeRadius,
bounce = bounce
},physBoneMT)
end
-- Internal Function: Creates a physbone based on the provided metatable
physBone.addPhysBone = function(self,part,index)
if self ~= physBone then
index,part=part,index
end
assert(part,'error making physBone: part is null!')
local ID = part.ID
if(index == nil) then
boneID = boneID + 1
index = boneID
end
assert(not physBoneIndex[index],'error adding physBone: a physBone with index "'..index..'" already exists')
physBoneIndex[index] = ID
part.index = index
physBone[ID] = part
return part
end
-- Creates a new physBone
physBone.newPhysBone = function(self,part,physBonePreset)
if self ~= physBone then
physBonePreset,part=part,self
end
assert(part,'error making physBone: part is null!')
local ID = part:getName()
if(physBone.allowDuplicates and physBone[ID]) then
ID = ID..boneID+1
end
assert(not physBone[ID],'error making physBone: this physBone "'..ID..'" already exists')
assert(physBonePreset,'error making physBone: your preset can not be nil')
local preset = type(physBonePreset) == "table" and physBonePreset or physBonePresets[physBonePreset]
assert(preset,'error making physBone: preset "'..tostring(physBonePreset)..'" does not exist')
part:setRot(0,90,0)
local p = physBone:addPhysBone(
physBone.newPhysBoneFromValues(part,preset.mass,preset.length,preset.gravity,preset.airResistance,preset.simSpeed,preset.equilibrium,preset.springForce,preset.force,preset.rotMod,preset.vecMod,preset.rollMod,preset.nodeStart,preset.nodeEnd,preset.nodeDensity,preset.nodeRadius,preset.bounce,boneID,ID)
)
if doDebugMode then
physBone.addDebugParts(part,preset)
end
return p
end
-- Returns your physBone
physBone.getPhysBone = function(self,part)
if self ~= physBone then
part = self
end
assert(part,'cannot get physBone: part is null!')
local ID = self:getName()
assert(physBone[ID],('cannot get physBone: this part does not have a physBone'))
return physBone[ID]
end
-- Internal function to get part parents
local function getParents(part,parentsTable)
local parent = part:getParent()
if not parent then return parentsTable end
parentsTable[#parentsTable + 1] = parent
getParents(parent,parentsTable)
return parentsTable
end
-- Creates a new collider
physBone.newCollider = function(self,part)
assert(part,'error making collider: part is null!')
local ID = part:getName()
assert(not physBone.collider[ID],'error making collider: this collider "'..ID..'" already exists')
local parents = getParents(part,{part})
local nbtIndex = avatar:getNBT()
for i = #parents, 1, -1 do
for k,v in pairs(nbtIndex) do
if v.name == parents[i]:getName() then
if v.chld then
nbtIndex = v.chld
else
nbtIndex = v
end
end
end
end
assert(nbtIndex.cube_data,"error making collider '"..ID.."'. This part isn't a cube")
if next(nbtIndex.cube_data) == nil then
error("error making collider '"..ID.."'. This cube either has no texture applied to it in Blockbench or has all faces disabled")
end
part:setVisible(true)
part:setPrimaryTexture("CUSTOM", colliderTexture)
local t = nbtIndex.t
local f = nbtIndex.f
local piv = nbtIndex.piv
local rot = nbtIndex.rot
if not t then t = {0,0,0} end
if not f then f = {0,0,0} end
if not piv then piv = {0,0,0} end
if not rot then rot = {0,0,0} end
t = vec(t[1],t[2],t[3])
f = vec(f[1],f[2],f[3])
piv = vec(piv[1],piv[2],piv[3])
local offset = t - piv
local size = t - f
local faces = {}
for k,v in pairs(nbtIndex.cube_data) do
faces[k] = true
end
local pivot = part:getPivot()
part:setMatrix(matrices.mat4():translate(-pivot):rotate(part:getRot()):translate(pivot) * 0.15)
:setLight(15)
-- temp code for steph to replace
physBone.collider[ID] = {
ID = ID,
part = part,
offset = offset,
size = size,
faces = faces
}
end
-- Creates a new or sets the value of an existing preset
physBone.setPreset = function(self,ID,mass,length,gravity,airResistance,simSpeed,equilibrium,springForce,force,rotMod,vecMod,rollMod,nodeStart,nodeEnd,nodeDensity,nodeRadius,bounce)
local presetCache = {}
local references = {mass = mass, length = length, gravity = gravity, airResistance = airResistance, simSpeed = simSpeed, equilibrium = equilibrium, springForce = springForce, force = force, rotMod = rotMod, vecMod = vecMod, rollMod = rollMod, nodeStart = nodeStart, nodeEnd = nodeEnd, nodeDensity = nodeDensity, nodeRadius = nodeRadius, bounce = bounce}
local fallbacks = {mass = 1, length = 16, gravity = -9.81, airResistance = 0.1, simSpeed = 1, equilibrium = vec(0,-1,0), springForce = 0, force = vec(0,0,0), rotMod = vec(0,0,0), vecMod = vec(1,1,1), rollMod = 0, nodeStart = 0, nodeEnd = 16, nodeDensity = 1, nodeRadius = 0, bounce = 0.75}
for valID, fallbackVal in pairs(fallbacks) do
local presetVal = references[valID]
if presetVal then
presetCache[valID] = presetVal
else
presetCache[valID] = fallbackVal
end
end
physBonePresets[ID] = presetCache
end
-- Removes an existing preset
physBone.removePreset = function(self,ID)
if not physBonePresets[ID] then error('error removing preset: preset "'..ID..'" does not exist') end
physBonePresets[ID] = nil
end
-- Default presets
physBone:setPreset("physBone")
physBone:setPreset("PhysBone")
physBone:setPreset("physBoob",2,nil,nil,0.5,nil,vec(0,0,-1),200,nil,vec(-90,0,0),nil,nil,nil,nil,0)
physBone:setPreset("PhysBoob",2,nil,nil,0.5,nil,vec(0,0,-1),200,nil,vec(-90,0,0),nil,nil,nil,nil,0)
-- models API function: method by GS
local old_class_index = figuraMetatables.ModelPart.__index
local class_methods = {
newPhysBone = function(self,physBonePreset)
return physBone:newPhysBone(self,physBonePreset)
end,
getPhysBone = function(self)
return physBone:getPhysBone(self)
end
}
function figuraMetatables.ModelPart:__index(key)
if class_methods[key] then
return class_methods[key]
else
return old_class_index(self, key)
end
end
--
-- Generates sphere mesh
function physBone.newSphere(part,ID)
for i = 0, 9 do
local faces = {}
for j = 1,5 do
faces["face"..j] = part:newSprite(ID..i..j)
:setTexture(nodeTexture,1,1)
:setUVPixels(2,2)
end
local face1,face2,face3,face4,face5 = faces.face1,faces.face2,faces.face3,faces.face4,faces.face5
face1:getVertices()[1]:setPos(0,8,0)
face1:getVertices()[2]:setPos(0,8,0)
face1:getVertices()[3]:setPos(-1.5279,6.4721,-4.7023)
face1:getVertices()[4]:setPos(1.5279,6.4721,-4.7023)
face1:setRot(0,i*36,0):setRenderType("EMISSIVE_SOLID")
face2:getVertices()[1]:setPos(1.5279,6.4721,-4.7023)
face2:getVertices()[2]:setPos(-1.5279,6.4721,-4.7023)
face2:getVertices()[3]:setPos(-2.4721,2.4721,-7.6085)
face2:getVertices()[4]:setPos(2.4721,2.4721,-7.6085)
face2:setRot(0,i*36,0):setRenderType("EMISSIVE_SOLID")
face3:getVertices()[1]:setPos(2.4721,2.4721,-7.6085)
face3:getVertices()[2]:setPos(-2.4721,2.4721,-7.6085)
face3:getVertices()[3]:setPos(-2.4721,-2.4721,-7.6085)
face3:getVertices()[4]:setPos(2.4721,-2.4721,-7.6085)
face3:setRot(0,i*36,0):setRenderType("EMISSIVE_SOLID")
face4:getVertices()[1]:setPos(2.4721,-2.4721,-7.6085)
face4:getVertices()[2]:setPos(-2.4721,-2.4721,-7.6085)
face4:getVertices()[3]:setPos(-1.5279,-6.4721,-4.7023)
face4:getVertices()[4]:setPos(1.5279,-6.4721,-4.7023)
face4:setRot(0,i*36,0):setRenderType("EMISSIVE_SOLID")
face5:getVertices()[1]:setPos(1.5279,-6.4721,-4.7023)
face5:getVertices()[2]:setPos(-1.5279,-6.4721,-4.7023)
face5:getVertices()[3]:setPos(0,-8,0)
face5:getVertices()[4]:setPos(0,-8,0)
face5:setRot(0,i*36,0):setRenderType("EMISSIVE_SOLID")
end
end
-- Generates physbone debug nodes
function physBone.addDebugNodes(part,nodeStart,nodeEnd,nodeRadius,nodeDensity)
local nodeRadiusGroup = part:newPart("PB_Debug_NodeRadius")
if nodeRadius == 0 then
for i = 1, nodeDensity do
local nodeParent = nodeRadiusGroup:newPart("nodeParent"..i)
local nodeLength = nodeEnd * ((nodeEnd - nodeStart) / nodeEnd) * (i / nodeDensity) + nodeStart
nodeParent:setPos(0,-nodeLength,0)
local node = nodeParent:newPart("node"..i,"CAMERA")
node:newSprite("nodeRadius")
:setTexture(nodeTexture,1,1)
:setRenderType("EMISSIVE_SOLID")
:setMatrix(matrices.mat4():translate(0.5,0.5,0.5):scale(0.5,0.5,0.5):rotate(0,0,0) * 0.1)
end
else
for i = 1, nodeDensity do
local nodeParent = nodeRadiusGroup:newPart("nodeParent"..i)
local nodeLength = nodeEnd * ((nodeEnd - nodeStart) / nodeEnd) * (i / nodeDensity) + nodeStart
nodeParent:setPos(0,-nodeLength,0)
local node = nodeParent:newPart("node"..i)
physBone.newSphere(node,"sphere"..i)
local pivot = node:getPivot()
node:setMatrix(matrices.mat4():translate(-pivot):scale(0.125 * nodeRadius):translate(pivot) * 0.1)
end
end
end
-- Generates a physBone's debug model
function physBone.addDebugParts(part,preset)
local pivotGroup = part:newPart("PB_Debug_Pivot","Camera")
pivotGroup:newSprite("pivot")
:setTexture(whiteTexture,1,1)
:setColor(1,0,0)
:setRenderType("EMISSIVE_SOLID")
:setMatrix(matrices.mat4():translate(0.5,0.5,0.5):scale(0.5,0.5,0.5):rotate(0,0,0) * 0.1)
local directionGroup = part:newPart("PB_Debug_Direction"):newPart("child")
for k = 0, 3 do
directionGroup:newSprite("line"..k)
:setTexture(whiteTexture,1,1)
:setRenderType("EMISSIVE_SOLID")
:setMatrix(matrices.mat4():translate(0.5,0,0.5):scale(0.5,1,0.5):rotate(0,k*90,0) * 0.12)
end
directionGroup:setScale(1,preset.length,1)
local springForceGroup = part:newPart("PB_Debug_SpringForce")
for k = 0, 3 do
springForceGroup:newSprite("line"..k)
:setTexture(whiteTexture,1,1)
:setColor(0,0,1)
:setRenderType("EMISSIVE_SOLID")
:setMatrix(matrices.mat4():translate(0.5,0,0.5):scale(0.25,3,0.25):rotate(0,k*90,0) * 0.11)
end
local equilib = vectors.rotateAroundAxis(90,preset.equilibrium,vec(0,-1,0))
equilib = vectors.rotateAroundAxis(90,equilib,vec(-1,0,0))
local pitch,yaw = physBone.vecToRot(equilib)
springForceGroup:setRot(pitch,0,yaw)
:setScale(1,preset.springForce/50,1)
physBone.addDebugNodes(part,preset.nodeStart,preset.nodeEnd,preset.nodeRadius,preset.nodeDensity)
for k,v in pairs({"PB_Debug_Pivot","PB_Debug_Direction","PB_Debug_SpringForce","PB_Debug_NodeRadius"}) do
part[v]:setVisible(false)
end
end
-- Generate physBones and colliders from model parts
events.entity_init:register(function()
local function findCustomParentTypes(path)
for _,part in pairs(path:getChildren()) do
local ID = part:getName()
local ID_sub = ID:sub(0,8)
if ID_sub == "collider" or ID_sub == "Collider" then
physBone:newCollider(part)
end
for presetID,preset in pairs(physBonePresets) do
if ID:sub(0,#presetID) == presetID then
physBone.newPhysBone(part,preset)
for _,child in pairs(part:getChildren()) do
local ID_child = child:getName()
local ID_child_BEsub = ID_child:sub(0,7)
local ID_child_SFsub = ID_child:sub(0,11)
if ID_child_BEsub == "boneEnd" or ID_child_BEsub == "BoneEnd" then
local childPos = child:getPivot() - part:getPivot()
local rotModVec = vectors.rotateAroundAxis(90,childPos:normalized(),vec(-1,0,0))
local pitch,yaw = physBone.vecToRot(rotModVec)
local length = childPos:length()
physBone[ID]:setRotMod(vec(-pitch,0,-yaw))
physBone[ID]:setRollMod(child:getRot().y)
physBone[ID]:setLength(length)
physBone[ID]:setNodeEnd(length)
elseif ID_child_SFsub == "springForce" or ID_child_SFsub == "SpringForce" then
local childPos = child:getPivot() - part:getPivot()
local equalibVec = childPos:normalized()
physBone[ID]:setEquilibrium(equalibVec)
physBone[ID]:setSpringForce(child:getRot().y)
end
end
part:setRot(0,90,0)
break
end
end
findCustomParentTypes(part)
end
end
findCustomParentTypes(models)
end,'PHYSBONE.generateFromModelParts')
-- Debug keybind
local debugKeybind = keybinds:newKeybind("Toggle PhysBone Debug Mode","key.keyboard.grave.accent")
function debugKeybind.press(mod)
if not (mod == 1) or not doDebugMode then return end
debugMode = not debugMode
for _,boneID in pairs(physBoneIndex) do
physBone[boneID].path.PB_Debug_Pivot:setVisible(debugMode)
physBone[boneID].path.PB_Debug_Direction:setVisible(debugMode)
physBone[boneID].path.PB_Debug_SpringForce:setVisible(debugMode)
physBone[boneID].path.PB_Debug_NodeRadius:setVisible(debugMode)
end
if debugMode then
colliderTexture:setPixel(0,0,vec(1,0.5,0)):update()
else
colliderTexture:setPixel(0,0,vec(0,0,0,0)):update()
end
end
-- Simple clock
local physClock = 0
events.tick:register(function()
physClock = physClock + 1
end,'PHYSBONE.physClock')
-- Render function prep
local deg = math.deg
local atan2 = math.atan2
local asin = math.asin
local zeroVec = vec(0,0,0)
local invalidContexts = {
PAPERDOLL = true,
MINECRAFT_GUI = true,
FIGURA_GUI = true
}
-- Render function
events.RENDER:register(function (delta,context)
if(invalidContexts[context] or client:isPaused()) then
return
end
-- Time calculations
local time = (physClock + delta)
local deltaTime = time - lastDelta
-- If world time / render somehow runs twice, don't run
if deltaTime == 0 then return end
-- Collider setup
local colliderGroups = {}
for colID,collider in pairs(physBone.collider) do
colliderGroups[colID] = {}
local colGroup = colliderGroups[colID]
local colMatrix = collider.part:partToWorldMatrix() * (1/0.15)
local partPos = colMatrix:apply()
local size = collider.size
local colTransMat = colMatrix:copy():translate(-partPos)
local offsetMat = matrices.mat4():translate(collider.offset)
local colNormalX = colMatrix:applyDir(vec(1,0,0)):normalize()
local colNormalY = colMatrix:applyDir(vec(0,1,0)):normalize()
local colNormalZ = colMatrix:applyDir(vec(0,0,1)):normalize()
local faces = collider.faces
if faces.s then
local colPos = (colTransMat * offsetMat:copy()):translate(partPos):apply()
colGroup.s = {pos = colPos, normals = {colNormalX,colNormalY,colNormalZ}, size = vec(size.x,size.y,size.z)}
end
if faces.n then
local colPos = (colTransMat * offsetMat:copy():translate(-size)):translate(partPos):apply()
colGroup.n = {pos = colPos, normals = {-colNormalX,-colNormalY,-colNormalZ}, size = vec(size.x,size.y,size.z)}
end
if faces.e then
local colPos = (colTransMat * offsetMat:copy():translate(-size * vec(0,1,0))):translate(partPos):apply()
colGroup.e = {pos = colPos, normals = {colNormalZ,-colNormalY,colNormalX}, size = vec(size.z,size.y,size.x)}
end
if faces.w then
local colPos = (colTransMat * offsetMat:copy():translate(-size * vec(1,0,1))):translate(partPos):apply()
colGroup.w = {pos = colPos, normals = {-colNormalZ,colNormalY,-colNormalX}, size = vec(size.z,size.y,size.x)}
end
if faces.u then
local colPos = (colTransMat * offsetMat:copy():translate(-size * vec(0,0,1))):translate(partPos):apply()
colGroup.u = {pos = colPos, normals = {colNormalX,-colNormalZ,colNormalY}, size = vec(size.x,size.z,size.y)}
end
if faces.d then
local colPos = (colTransMat * offsetMat:copy():translate(-size * vec(1,1,0))):translate(partPos):apply()
colGroup.d = {pos = colPos, normals = {-colNormalX,colNormalZ,-colNormalY}, size = vec(size.x,size.z,size.y)}
end
end
for _,curPhysBoneID in pairs(physBoneIndex) do
local curPhysBone = physBone[curPhysBoneID]
local worldPartMat = curPhysBone.path:partToWorldMatrix()
-- Pendulum logic
local pendulumBase = worldPartMat:apply()
if pendulumBase.x ~= pendulumBase.x then return end -- avoid physics breaking if partToWorldMatrix returns NaN
local velocity = curPhysBone.velocity / lastestDeltaTime / ((curPhysBone.simSpeed * curPhysBone.mass)/100)
-- Air resistance
local airResistanceFactor = curPhysBone.airResistance
if airResistanceFactor ~= 0 then
local airResistance = velocity * (-airResistanceFactor)
velocity = velocity + airResistance * lasterDeltaTime / curPhysBone.mass
end
-- Spring force
if curPhysBone.springForce ~= 0 then
local equilib = physBone.vecToRotMat(-curPhysBone.equilibrium)
local relativeDirMat = worldPartMat:copy() * equilib:rotate(0,-90,0)
local relativeDir = relativeDirMat:applyDir(0,0,-1):normalized()
local springForce = relativeDir * curPhysBone.springForce
velocity = velocity + springForce * lasterDeltaTime / curPhysBone.mass^2
end
-- Custom force
if curPhysBone.force ~= zeroVec then
velocity = velocity + curPhysBone.force * lasterDeltaTime / curPhysBone.mass^2
end
-- Gravity
velocity = velocity + vec(0, curPhysBone.gravity,0) * lasterDeltaTime / curPhysBone.mass
-- Collisions
local direction = ((curPhysBone.pos + velocity * lasterDeltaTime * ((curPhysBone.simSpeed * curPhysBone.mass)/100)) - pendulumBase):normalized()
local nodeDir = direction
local hasCollided = false
local planeNormal
local distance
local colNodePos
for node = 1, curPhysBone.nodeDensity do
local nodeLength = (curPhysBone.nodeEnd * ((curPhysBone.nodeEnd - curPhysBone.nodeStart) / curPhysBone.nodeEnd) * (node / curPhysBone.nodeDensity) + curPhysBone.nodeStart) / math.worldScale
local nodePos = pendulumBase + nodeDir * (nodeLength / 16)
for groupID,group in pairs(colliderGroups) do
for _,face in pairs(group) do
local normalX = face.normals[1]
local normalY = face.normals[2]
local normalZ = face.normals[3]
local diff = nodePos - face.pos
local distanceX = diff:dot(normalX) / normalX:length()
local distanceY = diff:dot(normalY) / normalY:length()
local distanceZ = diff:dot(normalZ) / normalZ:length()
local worldScale = 16*math.worldScale
local pendulumThickness = 0/worldScale
local size = vec(face.size.x,face.size.y,face.size.z) / worldScale
local penetration = (distanceZ + pendulumThickness) / size.z
local radius = curPhysBone.nodeRadius / worldScale
local isXCollided = (distanceZ - radius) <= 0 and -size.z <= distanceZ
local isYCollided = distanceY <= penetration * size.y and (penetration * -size.y) - size.y <= distanceY and penetration >= -0.5
local isZCollided = distanceX <= penetration * size.x and (penetration * -size.x) - size.x <= distanceX and penetration >= -0.5
if isXCollided and isYCollided and isZCollided then
planeNormal = normalZ
distance = distanceZ - radius
hasCollided = true
nodeDir = (nodePos - pendulumBase):normalized()
colNodePos = nodeLength
end
end
end
end
-- Finalise physics
if not hasCollided then
local nextPos = pendulumBase + direction * (curPhysBone.length / 16 / math.worldScale)
curPhysBone.velocity = nextPos - curPhysBone.pos
curPhysBone.pos = nextPos
else
local bounce = curPhysBone.bounce * 2.61
local colNextPos = direction * (colNodePos / 16 / math.worldScale) - distance * planeNormal
local nextPos = pendulumBase + colNextPos:normalized() * (curPhysBone.length / 16 / math.worldScale)
curPhysBone.velocity = (velocity - bounce * velocity:dot(planeNormal) * planeNormal) * lasterDeltaTime * ((curPhysBone.simSpeed * curPhysBone.mass)/100)
curPhysBone.pos = nextPos
end
-- Rotation calcualtion
local relativeVec = (worldPartMat:copy()):invert():apply(pendulumBase + (curPhysBone.pos - pendulumBase)):normalize()
relativeVec = (relativeVec * curPhysBone.vecMod.zyx):normalized()
relativeVec = vectors.rotateAroundAxis(90,relativeVec,vec(-1,0,0))
local pitch,yaw = physBone.vecToRot(relativeVec)
-- Transform matrix
if curPhysBone.path:getVisible() then
local parentPivot = curPhysBone.path:getPivot()
for _,part in pairs(curPhysBone.path:getChildren()) do
if part:getVisible() then
local partID = part:getName()
if partID ~= "PB_Debug_Pivot" and partID ~= "PB_Debug_SpringForce" then
local pivot = part:getPivot()
local mat = matrices.mat4()
local rot = part:getRot()
mat:translate(-pivot)
:rotate(rot.x,rot.y,rot.z)
:translate(pivot)
:translate(-parentPivot)
if partID ~= "PB_Debug_Direction" and partID ~= "PB_Debug_NodeRadius" then
mat:rotate(vec(0,0,curPhysBone.rotMod.z))
:rotate(vec(0,curPhysBone.rotMod.y,0))
:rotate(vec(curPhysBone.rotMod.x,0,0))
:rotate(vec(0,curPhysBone.rollMod,0))
end
mat:rotate(0,-90,0)
:rotate(pitch,0,yaw)
:translate(parentPivot)
part:setMatrix(mat)
end
end
end
end
end
-- Store deltaTime values
lastestDeltaTime,lasterDeltaTime,lastDeltaTime,lastDelta = lasterDeltaTime,lastDeltaTime,deltaTime,time
end,'PHYSBONE.RENDER')
setmetatable(physBone,{__index=physBone.children,__newindex=function(this,key,value)
rawget(this,'children')[key]= value
end})
return physBone

File diff suppressed because it is too large Load diff

View file

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -0,0 +1,40 @@
require("GSAnimBlend")
local anims = require('JimmyAnims')
local physBone = require('physBoneAPI')
anims(animations.player_bipedal,animations.player_swim)
vanilla_model.PLAYER:setVisible(false)
vanilla_model.ARMOR:setVisible(false)
vanilla_model.HELD_ITEMS:setVisible(true)
vanilla_model.ELYTRA:setVisible(true)
vanilla_model.CAPE:setVisible(false)
models.player_bipedal:setVisible(true)
models.player_swim:setVisible(false)
BlendTime = 2
-- physics
-- function events.entity_init()
-- physBone.physBoneLeftTentacle1:setNodeEnd(1)
-- physBone.physBoneLeftTentacle2:setNodeEnd(4)
-- physBone.physBoneLeftTentacle3:setNodeEnd(4)
-- physBone.physBoneRightTentacle1:setNodeEnd(1)
-- physBone.physBoneRightTentacle2:setNodeEnd(4)
-- physBone.physBoneRightTentacle3:setNodeEnd(4)
--end
local wasThing =false
function events.tick()
local isThing =(player:getPose() == "SWIMMING" and not player:isInWater())
if wasThing ~= isThing then
animations.player_bipedal.getdown_bipedal:setPlaying(isThing)
animations.player_swim.getdown_swim:setPlaying(isThing)
animations.player_bipedal.getup_bipedal:setPlaying(not isThing)
animations.player_swim.getup_swim:setPlaying(not isThing)
end
wasThing = isThing
end

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

View file

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 259 KiB

After

Width:  |  Height:  |  Size: 337 KiB

View file

@ -26,6 +26,7 @@ git commit -m "The sun will be rising soon."
git commit -m "Laptop charger dead maybe"
git commit -m "Neurons going dim"
git commit -m "i cant believe you would becray me"
git commit -m "Not like this, not like this!"
how to make a new repo
get ready on gitea

View file

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

View file

@ -0,0 +1,2 @@
A startup screen for an operating system - Sanctuary OS 16. Modelled after the MacOS 9 boot "splash", it depicts a box with the system logo and a progress bar, on a user-defined background, on this one a pleasant gradient background with the trans pride colors and static noise.
This one even works on an actual computer!

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View file

@ -0,0 +1,3 @@
A piece of pixel art made to resemble one of the battles in the videogame Earthbound, only, without showing which characters are fighting the opponents, and with black on white text instead of the alternative.
In the center is, in the background, a wheel shape with the trans pride colors background, and a character with a pink skirt, white shirt, pink ribbon, and white head resembling an iMac G3.
The battle narration says, "In the name of the stars, Missy punishes you!"

Binary file not shown.

After

Width:  |  Height:  |  Size: 506 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 502 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 B

View file

@ -0,0 +1,3 @@
{
"figura.librariesFolderPath": "/home/akirapink/.local/share/.minecraft/figura/avatars/libraries/"
}

View file

@ -0,0 +1,2 @@
message = "lua rocks"
print(message)

View file

@ -3,15 +3,20 @@
## Characters and Groups
[[Mandarin Labs]] canadian queer worker co-op, competitor to Big Onion
[[Mandarin Labs]] canadian queer worker co-op, leading
[[Federal Bureau of Xenorelations]] usian branch of government
[[Obesk Embassy]]
# The Message(s)
“People who do not want to change, cannot change”
# Quotes
- “People who do not want to change, cannot change”
- “Change can be facilitated by friends, but it must come from within”
- “Inaction is the enemy of progress, but it should not take priority over well-being”
- “Through the torment, through the rain, in your hands the future remains”
- “To wait for the best possible moment means to lose your opportunity entirely, but sometimes thats a good thing”
# Possibility C
“The year is 2025”
---
%%
@ -34,7 +39,7 @@
- Human governments corrupt and actively facilitating corporate evil[?]
- New wave of protests and resistance sends icons and leaders into hiding
- _[citation needed::what purpose does adding this to the story serve?]_
- [citation needed::how do i portray this without being insensitive or boring?]
- _[citation needed::how do i portray this without being insensitive or boring?]_
- Aliens meet recovering Earthlings
- The Storm does not indirectly lead to the downfall of obesk-human communications, computer-corrucyst integration thrives instead
- Mindspike does not use corru, but is modeled after it _???_