//variables that must stay the same (ironic, i know) because they reference otherwise unobtainable unchanging values
local function GetAnimFrames() return  8 end //how many frames in the FZBM animation
local function GetDeathFreezeTics() return 70 end //how many tics in destroyed-kart.cpp that the player freeze lasts for upon death
local function GetSkinName() return "bonkerfuzwig" end //the name of the affected racer in the S_SKIN lump

//variables (and getters) you can change
local function GetPersistentTableSuffix() return "_persistent" end //the name of the player table where persistent wiggler data (bodycol, bodycol anim speed, etc.) will be stored during gameplay
local function GetPersistentCacheTableSuffix() return GetPersistentTableSuffix().."_cache" end //the name of the player table where persistent wiggler data will be cached until it is applied in the next race to get around replay bullshit with the lua-added commands
local function GetDefaultBodyCount() return 4 end//how many body parts there are (excluding the head) upon selecting fuzzy wiggler as a racer
local function GetAltColourCount() return 6 end //how many bbfw_bodycol variables will there be starting from 2 (so if this value is '6' then the bodycols would range from 2 to 7)
local function GetMaxDrivingSpeed() return '60' end // how fast one has to be driving in fracunits to reach the max of normalizing the driving speed
local function GetMinBodyCount() return 1 end //how many body segments MUST exist even against player commands and the bodycap
local function GetPartRadius() return '16' end //the fracunit-multiplied radius of every body part used to keep them from clumping up
local function GetAngleEaseRate() return '0.03' end // how loosely the body parts turn to face one another
local function GetRadiusAngleEaseMaximum() return '2.5' end //how many multiples of the part radius away can one part be before the angleeaserate turns into a whole fracunit
local function GetHeightEaseRate() return '0.5' end // how loosely the height of each body part follows the one in front
local function GetHeightFallRate() return '0.2' end // how gently the body parts will fall to the ground when the player lands from an aescention
local function GetMaxPlaybackSpeed() return '3' end //the maximum playback rate for the body segments when running scaled by driving speed
local function GetStandingSpeed() return '0.4' end //the fracunit-multiplied threshold that must be passed by driving speed to start animating the body
local function GetCaterpillarDelay() return 1 end //the number of tics between each body part's animation frame to simulate how caterpillars move
local function GetHurtRecolourDuration() return TICRATE*3 end //the number of tics that wiggler should turn purple after being hit (not including during the hurt)
local function GetDeathAnimDuration() return 20 end //how many tics it will take for the death anim where the wiggler pops out of existence to complete (i think anything past 15 according to destroyed-kart.cpp and the player will begin to respawn *but* i cant access that info so oh well)

local function GetAltColourName(i)

	if(BonkerBox_G.IsNumber(i)~=true)
		BonkerBox_G.InternalError(nil,"alt colour name: index i was not a number.")
		return nil
	end
	
	return "bodycol"..(max(tonumber(i),1)+1)
	
end

local mappingModeEnum = {}
mappingModeEnum["modulate"] = 1
mappingModeEnum["multiple"] = 2

local function GetMappingModeEnumByIndex(i,silent)
	local errorfunc = BonkerBox_G.InternalError
	
	if(BonkerBox_G.IsBool(silent)==true and silent==true)
		errorfunc = function() end
	end


	if(BonkerBox_G.IsNumber(i)~=true)
		errorfunc(nil,"mapping mode: index i was not a number.")
		return nil
	end
	
	if(BonkerBox_G.IsTable(mappingModeEnum)~=true)
		errorfunc(nil,"mapping mode: couldn't access the enum table")
		return nil
	end
	
	for k,v in pairs(mappingModeEnum)
		if(v == i)
			return string.lower(k)
		end
	end
	
	errorfunc(nil,"mapping node: index '"..i.."' didn't exist as an enum value.")
	return nil
end

local function GetMappingModeEnumByName(name,silent)
	local errorfunc = BonkerBox_G.InternalError
	
	if(BonkerBox_G.IsBool(silent)==true and silent==true)
		errorfunc = function() end
	end
	
	if(BonkerBox_G.StringEmptyOrNil(name)==true)
		errorfunc(nil,"mapping mode: string name was not a string.")
		return nil
	end
	
	if(BonkerBox_G.IsTable(mappingModeEnum)~=true)
		errorfunc(nil,"mapping mode: couldn't access the enum table")
		return nil
	end
	
	return mappingModeEnum[string.lower(name)]//guaranteed to not be empty nor nil via earlier name check for that very thing
end

local bbfwe = {}
bbfwe.GetPersistentTableSuffix = GetPersistentTableSuffix
bbfwe.GetPersistentCacheTableSuffix = GetPersistentCacheTableSuffix
bbfwe.GetAnimFrames = GetAnimFrames
bbfwe.GetDeathFreezeTics = GetDeathFreezeTics
bbfwe.GetDefaultBodyCount = GetDefaultBodyCount
bbfwe.GetMaxDrivingSpeed = GetMaxDrivingSpeed
bbfwe.GetMinBodyCount = GetMinBodyCount
bbfwe.GetPartRadius = GetPartRadius
bbfwe.GetAngleEaseRate = GetAngleEaseRate
bbfwe.GetRadiusAngleEaseMaximum = GetRadiusAngleEaseMaximum
bbfwe.GetHeightEaseRate = GetHeightEaseRate
bbfwe.GetHeightFallRate = GetHeightFallRate
bbfwe.GetMaxPlaybackSpeed = GetMaxPlaybackSpeed
bbfwe.GetStandingSpeed = GetStandingSpeed
bbfwe.GetCaterpillarDelay = GetCaterpillarDelay
bbfwe.GetHurtRecolourDuration = GetHurtRecolourDuration
bbfwe.GetDeathAnimDuration = GetDeathAnimDuration
bbfwe.GetSkinName = GetSkinName
bbfwe.GetAltColourCount = GetAltColourCount
bbfwe.GetAltColourName = GetAltColourName
bbfwe.GetMappingModeEnumByIndex = GetMappingModeEnumByIndex
bbfwe.GetMappingModeEnumByName = GetMappingModeEnumByName
rawset(_G,"BonkerBox_FWEnvi",bbfwe)