API Changes

AgentX

Administrator
Staff member
Mar 6, 2024
125
1
141
640
United States
sm64coopdx.com
Pronouns
He/him
ATTENTION MODDERS!!!
There is a new field called --pausable which I previously told you to mark as true at the top of your mods. I am changing it in the patch update to be true by default in order to save modders a lot of effort. If you don't know what this field does, it dictates whether or not the game can pause in singleplayer without causing any problems. You should now be putting -- pausable: false when necessary which may include in gamemodes.

Palette: The original set of colors that your character has, like from the settings.
Override palette: A set of colors that just just mirrors the original palette normally. If the override palette is touched in Lua, it becomes custom and will no longer mirror the original palette. The game uses this palette when rendering your character.

network_player_get_palette_color(): Gets the original palette color of a network player for a certain part
network_player_get_override_palette_color(): Gets the override palette color of a network player for a certain part
network_player_set_override_palette_color(): Sets the override palette color of a network player for a certain part
network_player_reset_override_palette(): Resets the override palette back to the original palette, you no longer have to save the original palette in gPlayerSyncTable or do any other hacky methods of saving the palette prior to being overrode.
network_player_is_override_palette_same(): Returns true if the override palette matches the original palette

Here is an example of the new palette system being used in Arena:
LUA:
    -- update palette
    if s.team == 1 then
        network_player_set_override_palette_color(np, PANTS, { r = 225, g = 5, b = 49 })
        network_player_set_override_palette_color(np, SHIRT, { r = 40, g = 10, b = 10 })
        network_player_set_override_palette_color(np, GLOVES, network_player_get_palette_color(np, GLOVES))
        network_player_set_override_palette_color(np, SHOES, network_player_get_palette_color(np, SHOES))
        network_player_set_override_palette_color(np, HAIR, network_player_get_palette_color(np, HAIR))
        network_player_set_override_palette_color(np, SKIN, network_player_get_palette_color(np, SKIN))
        network_player_set_override_palette_color(np, CAP, { r = 40, g = 10, b = 10 })
        network_player_set_override_palette_color(np, EMBLEM, network_player_get_palette_color(np, EMBLEM))
    elseif s.team == 2 then
        network_player_set_override_palette_color(np, PANTS, { r = 63, g = 63, b = 255 })
        network_player_set_override_palette_color(np, SHIRT, { r = 10, g = 10, b = 40 })
        network_player_set_override_palette_color(np, GLOVES, network_player_get_palette_color(np, GLOVES))
        network_player_set_override_palette_color(np, SHOES, network_player_get_palette_color(np, SHOES))
        network_player_set_override_palette_color(np, HAIR, network_player_get_palette_color(np, HAIR))
        network_player_set_override_palette_color(np, SKIN, network_player_get_palette_color(np, SKIN))
        network_player_set_override_palette_color(np, CAP, { r = 10, g = 10, b = 40 })
        network_player_set_override_palette_color(np, EMBLEM, network_player_get_palette_color(np, EMBLEM))
    else
        network_player_reset_override_palette(np)
    end

This is an example from Arena's player code. In this code, it is checking if the player's team is red, blue or unassigned. For the red and blue teams, it sets PANTS, SHIRT, and CAP to custom colors representing the red or blue team, but keeps GLOVES, SHOES, HAIR, SKIN, and EMBLEM the same. For the unassigned team, it resets any palette changes made by resetting the override palette.

Deprecated functions:
network_discord_id_from_local_index()
djui_hud_set_render_behind_hud()

audio_stream_load_url()
audio_stream_get_tempo()
audio_stream_set_tempo()
audio_stream_set_speed()

get_environment_region()
set_environment_region()

network_player_color_to_palette()
network_player_palette_to_color()

Important notes:
audio_sample_destroy() is lacking in the same safeguards that BASS had before, at least for now. It is generally better to write your code around reusing samples rather than constantly loading and destroying samples anyway. Mods that do this should work fine still.

Will likely update this with more information as time goes on.
 
Last edited:

Users who are viewing this thread