if not CFFC_Characters rawset(_G, "CFFC_Characters", {}) end CFFC_Characters["sonic"] = SKINCOLOR_RED CFFC_Characters["tails"] = SKINCOLOR_GARNET CFFC_Characters["knuckles"] = SKINCOLOR_KETCHUP CFFC_Characters["amy"] = SKINCOLOR_RUBY CFFC_Characters["fang"] = SKINCOLOR_FLAME CFFC_Characters["metalsonic"] = SKINCOLOR_RED local configplayer local function LoadPVar(player, path, command, default) local file = io.openlocal(path) if file then local val = file:read("*a") COM_BufInsertText(player, command.." "..val) file:close() else COM_BufInsertText(p, tostring(var).." "..tostring(default)) end end local function SavePVar(player, path, toinsert) if io and player == consoleplayer then local file = io.openlocal(path, "w+") file:write(tostring(toinsert)) file:close() end end COM_AddCommand("fireflowercolor", function(player, arg) if arg then arg = arg:lower() if R_GetColorByName(arg) != SKINCOLOR_NONE then player.fireflowercolor = R_GetColorByName(arg) SavePVar(player, "client/fireflowercolor.dat", player.fireflowercolor) CONS_Printf(player, "Fire Flower form color is now "..R_GetNameByColor(player.fireflowercolor)) elseif arg == "skin" then player.fireflowercolor = nil SavePVar(player, "client/fireflowercolor.dat", "skin") CONS_Printf(player, "Fire Flower form color is now determined by the current skin's definition.") else CONS_Printf(player, "The specified argument is invalid.") end else CONS_Printf(player, "fireflowercolor <\"skin\" / any valid skincolor>: Sets the color that you switch to when you get the Fire Flower.") if player.fireflowercolor == nil then CONS_Printf(player, "The Fire Flower form color is currently determined by your character.") else CONS_Printf(player, "The current Fire Flower form color is "..R_GetNameByColor(player.fireflowercolor)) end end end) addHook("ThinkFrame", do if (consoleplayer and consoleplayer.valid) and not (configplayer and configplayer.valid) then configplayer = consoleplayer LoadPVar(consoleplayer, "client/fireflowercolor.dat", "fireflowercolor", "skin") end end) addHook("PlayerThink", function(player) if not (player.mo and player.mo.valid) or not (player.powers[pw_shield] & SH_FIREFLOWER) then return end if player.powers[pw_shield] & SH_FIREFLOWER and player.mo.color != player.fireflowercolor then if player.fireflowercolor == nil then if not CFFC_Characters[player.mo.skin] then player.mo.color = SKINCOLOR_WHITE else player.mo.color = CFFC_Characters[player.mo.skin] end else player.mo.color = player.fireflowercolor end end end)