-- name: Slippery Brother -- description: Slippery Brother v1.0\nBy \\#417B16\\Blither\\#7B1619\\Dev\n\n\\#dcdcdc\\Edits the player's physics to be ice-like! "Isn't it a bit cold in here or is it just me?" local playerPhysics = {} if gGlobalSyncTable.slipperyAmount == nil then gGlobalSyncTable.slipperyAmount = 3 end hook_event(HOOK_MARIO_UPDATE, function(m) if m == nil or m.marioObj == nil then return end local i = m.playerIndex if playerPhysics[i] == nil then playerPhysics[i] = { x = m.vel.x, z = m.vel.z } end local state = playerPhysics[i] if (m.action & 0x00000200) == 0 then local targetX = sins(m.intendedYaw) * (m.intendedMag * 2.5) local targetZ = coss(m.intendedYaw) * (m.intendedMag * 2.5) local amt = gGlobalSyncTable.slipperyAmount or 3 if amt <= 0 then amt = 0.001 end local targetWeight = 0.012 / amt if targetWeight > 1 then targetWeight = 1 end local historyWeight = 1 - targetWeight state.x = (state.x * historyWeight) + (targetX * targetWeight) state.z = (state.z * historyWeight) + (targetZ * targetWeight) local maxSpeed = 80.0 local speed = math.sqrt(state.x * state.x + state.z * state.z) if speed > maxSpeed then state.x = (state.x / speed) * maxSpeed state.z = (state.z / speed) * maxSpeed end m.vel.x = state.x m.vel.z = state.z m.forwardVel = (m.vel.x * sins(m.faceAngle.y)) + (m.vel.z * coss(m.faceAngle.y)) else state.x = m.vel.x state.z = m.vel.z end end) hook_chat_command("slippery", "[NUMBER]", function(msg) if not network_is_server() then djui_chat_message_create("Wait,You're not the host! You can ask the host to set it for you though.") if gMarioStates[0] ~= nil and gMarioStates[0].marioObj ~= nil then play_sound(SOUND_MENU_CAMERA_BUZZ, gMarioStates[0].marioObj.header.gfx.cameraToObject) end return true end local num = tonumber(msg) if num ~= nil then gGlobalSyncTable.slipperyAmount = num djui_chat_message_create("Slipperiness amount has been updated to: " .. tostring(num)) else djui_chat_message_create("Please enter a valid number.") end return true end) hook_chat_command("slipperyamount", "Shows the current slippery setting", function(msg) local amt = gGlobalSyncTable.slipperyAmount or 3 djui_chat_message_create("Current slipperiness amount: " .. tostring(amt)) return true end)