Apply for Modder Status

Status
Not open for further replies.

SashaAnt

Member
Modder
Mar 21, 2025
1
0
180
Pronouns
he/him
Hello! My name is Sasha Antipov. I make sm64coopdx mods. I made many mods to play with my friends and am thinking about publishing them worldwide.
I would like to apply for the modder status.
These are examples of which mods I made:

This mod makes death permanent and switches to a free camera view after you die.

based off the freecam mod
LUA:
-- name: DIE
-- description: There are so many dumb ways to die in this game...

local function math_sign(x)
    return x > 0 and 1 or x < 0 and -1 or 0
end

local function limit_angle(a)
    return (a + 0x8000) % 0x10000 - 0x8000
end

local FreeCamera = {}
FreeCamera.__index = FreeCamera

local baseDelta = 1/30
local lastmariostate = false
local currentmariostate = false
local moveMultiplier = 1
local turnMultiplier = 1
local died = false
gGlobalSyncTable.dead = false
function FreeCamera.new()
    local self = setmetatable({},FreeCamera)
    self.enabled = true
    self.pitch = calculate_pitch(gLakituState.pos, gLakituState.focus)
    self.yaw = limit_angle(32772 + calculate_yaw(gLakituState.pos, gLakituState.focus))
    self.fov = 50
    self.moveSpeed = 1/baseDelta
    self.turnSpeed = 0x100/baseDelta
    self.MouseLook = false
    return self
end

local LocalPlayer = gMarioStates[0]

local FOV_GAIN = 64
local rad = math.rad
local sqrt = math.sqrt
local tan = math.tan
local delta = 0.03

function FreeCamera:Update(clockTime)
    if not self.enabled then return end
    camera_freeze()
    set_override_fov(self.fov)
 
    LocalPlayer.freeze = 5
 
    local controller = LocalPlayer.controller
 
    local moveX = controller.stickX
    local moveZ = controller.stickY
 
    local moveY = 0
 
    local enable = false

    if (controller.buttonDown & A_BUTTON) ~= 0 then
        moveY = 64
    elseif (controller.buttonDown & Z_TRIG) ~= 0 then
        moveY = -64
    end
 
    if moveX ~= 0 or moveZ ~= 0 or moveY ~= 0 then
        local lookX = -sins(self.yaw) * coss(self.pitch)
        local lookY = sins(self.pitch)
        local lookZ = -coss(self.yaw) * coss(self.pitch)
 
        local rightYaw = self.yaw + 0x4000
        local rightX = sins(rightYaw)
        local rightZ = coss(rightYaw)
 
        local upX = sins(self.yaw) * sins(self.pitch)
        local upY = coss(self.pitch)
        local upZ = sins(self.pitch) * coss(self.yaw)
 
        local moveDelta = self.moveSpeed*moveMultiplier*delta
        moveX = moveX*moveDelta
        moveY = moveY*moveDelta
        moveZ = moveZ*moveDelta
 
        gLakituState.pos.x = gLakituState.pos.x + lookX*moveZ + rightX*moveX + upX*moveY
        gLakituState.pos.y = gLakituState.pos.y + lookY*moveZ + upY*moveY
        gLakituState.pos.z = gLakituState.pos.z + lookZ*moveZ + rightZ*moveX + upZ*moveY
        gLakituState.focus.x = gLakituState.focus.x + lookX*moveZ + rightX*moveX + upX*moveY
        gLakituState.focus.y = gLakituState.focus.y + lookY*moveZ + upY*moveY
        gLakituState.focus.z = gLakituState.focus.z + lookZ*moveZ + rightZ*moveX + upZ*moveY
    end
 
    local turnX = 0
    local turnY = 0
 
    local turnSpeed = self.turnSpeed*turnMultiplier
 
    if (controller.buttonPressed & B_BUTTON) ~= 0 then
        self.MouseLook = not self.MouseLook
        play_sound(SOUND_MENU_MESSAGE_NEXT_PAGE, LocalPlayer.marioObj.header.gfx.cameraToObject)
    end
 
    if self.MouseLook then
        djui_hud_set_mouse_locked(true)
        turnX = -math.floor(djui_hud_get_raw_mouse_y()*turnSpeed*delta)
        turnY = -math.floor(djui_hud_get_raw_mouse_x()*turnSpeed*delta)
    else
        djui_hud_set_mouse_locked(false)
    end
 
    local fovAdd = 0
 
    if (controller.buttonDown & L_TRIG) ~= 0 then
        fovAdd = 1
    elseif (controller.buttonDown & R_TRIG) ~= 0 then
        fovAdd = -1
    end
 
    local zoomFactor = sqrt(tan(rad(70/2))/tan(rad(self.fov/2)))
    self.fov = clampf(self.fov + fovAdd*FOV_GAIN*(delta/zoomFactor), 1, 120)
 
    if (controller.buttonDown & D_CBUTTONS) ~= 0 then
        turnX = -math.floor(turnSpeed*4*delta*0.5)
    elseif (controller.buttonDown & U_CBUTTONS) ~= 0 then
        turnX = math.floor(turnSpeed*4*delta*0.5)
    end
 
    if (controller.buttonDown & L_CBUTTONS) ~= 0 then
        turnY = turnSpeed*4*delta
    elseif (controller.buttonDown & R_CBUTTONS) ~= 0 then
        turnY = -turnSpeed*4*delta
    end
 
    if turnX ~= 0 or turnY ~= 0 then
        self.pitch = clamp(self.pitch + turnX,-0x3F4A,0x3F4A)
        local newYaw = self.yaw + turnY
        self.yaw = math_sign(newYaw) * (math.abs(newYaw) % 0x16000)
        local focusDist = gLakituState.focusDistance
        local cossPitch = (math.abs(coss(self.pitch)) < 1e-16 and 0 or coss(self.pitch))
        gLakituState.focus.x = gLakituState.pos.x - focusDist * sins(self.yaw) * cossPitch
        gLakituState.focus.y = gLakituState.pos.y + focusDist * sins(self.pitch)
        gLakituState.focus.z = gLakituState.pos.z - focusDist * coss(self.yaw) * cossPitch
    end
 
    gLakituState.yaw = self.yaw
    LocalPlayer.area.camera.yaw = self.yaw
    vec3f_copy(gLakituState.curPos, gLakituState.pos)
    vec3f_copy(gLakituState.curFocus, gLakituState.focus)
end

function FreeCamera:Destroy()
    self.enabled = false
    set_override_fov(0)
    djui_hud_set_mouse_locked(false)
end

local freeCamObj = nil

local function freeCamUpdate(m)
    if m.playerIndex ~= 0 then return end
    if freeCamObj then freeCamObj:Update() end
end

hook_event(HOOK_BEFORE_MARIO_UPDATE, freeCamUpdate)


--- @param m MarioState
function mario_update(m)
    if (gPlayerSyncTable[m.playerIndex].dead) then
        mario_drop_held_object(m)
        m.squishTimer = 0
 
        set_mario_animation(m, MARIO_ANIM_DYING_ON_BACK)
        m.marioBodyState.eyeState = MARIO_EYES_DEAD
        m.faceAngle.x = 0
        m.faceAngle.z = 0
    end

    currentmariostate = m.health > 0xff
    if(m.playerIndex == 0) then
        if(m.health == 0xff) then
            gPlayerSyncTable[0].dead = true
            camera_freeze()
            hud_hide()
            freeCamObj = FreeCamera.new()
        end
end
    lastmariostate = currentmariostate

end
hook_event(HOOK_MARIO_UPDATE, mario_update)

This is my new mod I am working on and it warps you to the start if you touch a forbidden terrain type (for example grass) WIP

LUA:
-- name: Don't Step There!
-- description: A mod which warps players to the start when touching a specific terrain type

local forbiddenterrain = -1
local appliedforbiddenterrain = -1

if not mod_storage_exists("number") then
    mod_storage_save_number("number", -1)
end

forbiddenterrain = mod_storage_load_number("number")
appliedforbiddenterrain = forbiddenterrain

local function is_touching_ground(m)
    if m.playerIndex ~= 0 or not m.floor then return false end
    return math.abs(m.pos.y - m.floorHeight) <= 0.1
end

local function mario_update(m)
    if network_is_server() then
        gPlayerSyncTable[0].number = appliedforbiddenterrain
    else
        appliedforbiddenterrain = gPlayerSyncTable[0].number
    end

    network_player_set_description(gNetworkPlayers[0], tostring(gMarioStates[0].floor.type), 255, 64, 64, 255)

    if gMarioStates[0].floor.type == appliedforbiddenterrain and is_touching_ground(m) then
        warp_restart_level()
    end
end

local function level_init()
    if gNetworkPlayers[0].currLevelNum == 9 then
        set_mario_action(gMarioStates[0], ACT_DIVE, 0)
    end
end

local function setforbiddenterrain(_, value)
    forbiddenterrain = tonumber(value)
end

local function applyforbiddenterrain()
    appliedforbiddenterrain = forbiddenterrain
    djui_chat_message_create("Applied")
    mod_storage_save_number("number", forbiddenterrain)
end

hook_event(HOOK_MARIO_UPDATE, mario_update)
hook_event(HOOK_ON_LEVEL_INIT, level_init)

if network_is_server() then
    hook_mod_menu_inputbox("Forbidden Terrain", tostring(forbiddenterrain), 9999, setforbiddenterrain)
    hook_mod_menu_button("Apply", applyforbiddenterrain)
end

this is a mod I made which allows you to edit dialogues

LUA:
-- name: Edit Dialog
-- description: Enjoy!

local DialogNum = -1
local DialogStr = ""
--- @param m MarioState
local function mario_update(m)
    if m.playerIndex ~= 0 then return end

    network_player_set_description(gNetworkPlayers[0], tostring(get_dialog_id()), 255, 64, 64, 255)
end
function force_wrap(text)
    local result = ""
    for i = 1, #text, 22 do
        result = result .. text:sub(i, i+21) .. "\n"
    end
    return result:sub(1, -2)
end
local function setdialognumber(index, value)
    DialogNum = tonumber(value) or -1

end
local function setdialogtext(index, value)
    DialogStr = value
end
local function applydialog(index, value)
    play_sound(SOUND_MENU_CHANGE_SELECT, gGlobalSoundSource)
    smlua_text_utils_dialog_replace(DialogNum, 1, 2, 95, 200, force_wrap(DialogStr))
    table = {}
    table["command"] = "dialog_send"
    table["number"] = DialogNum
    table["text"] = force_wrap(DialogStr)
    network_send(true, table)
end
function packet_recieve(table)
    if table["command"] == "dialog_send" then
        smlua_text_utils_dialog_replace(table["number"], 1, 2, 95, 200, table["text"])
    end
end
hook_event(HOOK_MARIO_UPDATE, mario_update)
hook_mod_menu_inputbox("Set Dialog Number", tostring(DialogNum), 4, setdialognumber)
hook_mod_menu_inputbox("Set Dialog Text", DialogStr, 9999, setdialogtext)
hook_mod_menu_button("Apply", applydialog)
hook_event(HOOK_ON_PACKET_RECEIVE, packet_recieve)

These mods are more like proof of concept and made for friends, if I released them (mods of course), I would make them cleaner and more stable)

thank you in advance!
 
Last edited:
Status
Not open for further replies.

Users who are viewing this thread