-- Cook Off layout controls, ported from The Cooker's verified mission IDs.
if not MissionScriptElement or MissionScriptElement._ht_cook_layout_hooked then return end
MissionScriptElement._ht_cook_layout_hooked = true
local original_init = MissionScriptElement.init
local flare_ids = {
    [102245]=true,[102249]=true,[102115]=true,[102152]=true,
    [102250]=true,[102251]=true,[102116]=true,[102153]=true,
    [102252]=true,[102253]=true,[102117]=true,[102154]=true
}
local supply_positions = {
    [2]=Vector3(1867.92,1348.91,1340.93), [3]=Vector3(1623.996,762.787,1740.94),
    [4]=Vector3(2416.56,454.75,1732.52), [5]=Vector3(1797.26,482.39,940.93),
    [6]=Vector3(1918.531,950.589,2204.413)
}
function MissionScriptElement:init(...)
    original_init(self, ...)
    if not HT or not Global.game_settings or Global.game_settings.level_id ~= "rat" then return end
    local supply = tonumber(HT:getSetting("cook_supply_location")) or 1
    if flare_ids[self._id] and supply_positions[supply] then self._values.position = supply_positions[supply] end
    local floor = tonumber(HT:getSetting("cook_lab_floor")) or 1
    if floor == 2 and self._id == 100483 then self._values.enabled = false end -- force first floor
    if floor == 3 and self._id == 100485 then self._values.enabled = false end -- force second floor
    if HT:getSetting("cook_keep_twitch") and self._id == 102316 then self._values.enabled = false end
end
