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_SALMON CFFC_Characters["fang"] = SKINCOLOR_FLAME CFFC_Characters["metalsonic"] = SKINCOLOR_GARNET local function LoadPVar(player, path, command) if player != consoleplayer then return end local file = io.openlocal(path) if file then local val = file:read("*a") if string.find(val, " ") then val = "\""..$.."\"" end COM_BufInsertText(player, command.." "..val) file:close() else COM_BufInsertText(player, command) end end local function SavePVar(player, path, content) if player != consoleplayer then return end local file = io.openlocal(path, "w+") file:write(tostring(content)) file:close() end COM_AddCommand("fireflowercolor", function(player, arg) if not (player.mo and player.mo.valid) then CONS_Printf(player, "You must be in a level to use this.") return end local path = "client/fireflowercolor.dat" if arg == nil then if not player.cffcload then CONS_Printf(player, "fireflowercolor : Sets the color that you turn when you get a Fire Flower.") if player.fireflowercolor == "skin" then CONS_Printf(player, "Currently set to be determined by your character's definition.") elseif player.fireflowercolor == "player" then CONS_Printf(player, "Currently set to be always the same as your main color.") else CONS_Printf(player, "Currently set to "..R_GetNameByColor(player.fireflowercolor)) end else player.fireflowercolor = "skin" end return end if string.lower(arg) == "skin" or string.lower(arg) == "player" then player.fireflowercolor = string.lower(arg) if not player.cffcload then SavePVar(player, path, player.fireflowercolor) if player.fireflowercolor == "skin" then CONS_Printf(player, "Your Fire Flower form color is now determined by your character's definition.") elseif player.fireflowercolor == "player" then CONS_Printf(player, "Your Fire Flower form color is now always the same as your main color.") end end elseif R_GetColorByName(arg) != SKINCOLOR_NONE then player.fireflowercolor = R_GetColorByName(arg) if not player.cffcload then SavePVar(player, path, R_GetNameByColor(player.fireflowercolor)) CONS_Printf(player, "Your Fire Flower form color is now "..R_GetNameByColor(player.fireflowercolor)) end else if not player.cffcload then CONS_Printf(player, "The specified argument is invalid.") else CONS_Printf(player, "\x82[Custom Fire Flower Color]\x85 WARNING:\x80 Config file for fireflowercolor points to a non-existent skincolor ("..arg.."). Check that you loaded the addon containing this custom skincolor. Resetting to default value.") SavePVar(player, path, "") end end end) addHook("PlayerThink", function(player) if not (player.mo and player.mo.valid) then return end if player.cffcload == nil then player.cffcload = 1 end if player.cffcload == 1 then if leveltime % 3 == 0 then if player.fireflowercolor == nil then LoadPVar(player, "client/fireflowercolor.dat", "fireflowercolor") return else player.cffcload = 2 end end elseif player.cffcload >= 2 then player.cffcload = $+1 if player.cffcload > 20 then player.cffcload = 0 end end end) addHook("PlayerThink", function(player) if not (player.mo and player.mo.valid) or player.fireflowercolor == nil or not (player.powers[pw_shield] & SH_FIREFLOWER) then return end if player.fireflowercolor == "skin" then if not CFFC_Characters[player.mo.skin] then player.mo.color = SKINCOLOR_WHITE else player.mo.color = CFFC_Characters[player.mo.skin] end elseif player.fireflowercolor == "player" then player.mo.color = player.skincolor else player.mo.color = player.fireflowercolor end end)