Added a really shitty check to prevent oven spamming
This commit is contained in:
@@ -21,6 +21,22 @@ local function otherPlayerLocal(_, partName, action, patient)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function CheckIfCanBeOperated(modData)
|
||||||
|
if modData.TOC.RightHand.IsCut and not modData.RightHand.IsOperated
|
||||||
|
or modData.TOC.RightForeArm.IsCut and not modData.RightForearm.IsOperated
|
||||||
|
or modData.TOC.RightArm.IsCut and not modData.RightArm.IsOperated
|
||||||
|
or modData.TOC.LeftHand.IsCut and not modData.LeftHand.IsOperated
|
||||||
|
or modData.TOC.LeftForearm.IsCut and not modData.LeftForearm.IsOperated
|
||||||
|
or modData.TOC.LeftArm.IsCut and not modData.LeftArm.IsOperated then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local function TOC_onFillWorldObjectContextMenu(playerId, context, worldobjects, _)
|
local function TOC_onFillWorldObjectContextMenu(playerId, context, worldobjects, _)
|
||||||
local player = getSpecificPlayer(playerId);
|
local player = getSpecificPlayer(playerId);
|
||||||
local clickedPlayer
|
local clickedPlayer
|
||||||
@@ -32,6 +48,11 @@ local function TOC_onFillWorldObjectContextMenu(playerId, context, worldobjects,
|
|||||||
for i=1,square:getObjects():size() do
|
for i=1,square:getObjects():size() do
|
||||||
local object2 = square:getObjects():get(i-1);
|
local object2 = square:getObjects():get(i-1);
|
||||||
--For the oven operate part
|
--For the oven operate part
|
||||||
|
|
||||||
|
|
||||||
|
if CheckIfCanBeOperated(modData) then
|
||||||
|
|
||||||
|
|
||||||
if instanceof(object2, "IsoStove") and (player:HasTrait("Brave") or player:getPerkLevel(Perks.Strength) >= 6) then
|
if instanceof(object2, "IsoStove") and (player:HasTrait("Brave") or player:getPerkLevel(Perks.Strength) >= 6) then
|
||||||
if not object2:isMicrowave() and object2:getCurrentTemperature() > 250 then
|
if not object2:isMicrowave() and object2:getCurrentTemperature() > 250 then
|
||||||
local rootMenu = context:addOption(getText('UI_ContextMenu_OperateOven'), worldobjects, nil);
|
local rootMenu = context:addOption(getText('UI_ContextMenu_OperateOven'), worldobjects, nil);
|
||||||
@@ -55,6 +76,9 @@ local function TOC_onFillWorldObjectContextMenu(playerId, context, worldobjects,
|
|||||||
if modData.TOC.LeftArm.IsCut and not modData.TOC.LeftArm.IsOperated then
|
if modData.TOC.LeftArm.IsCut and not modData.TOC.LeftArm.IsOperated then
|
||||||
subMenu:addOption(getText('UI_ContextMenu_LeftArm'), worldobjects, operateLocal, "LeftArm");
|
subMenu:addOption(getText('UI_ContextMenu_LeftArm'), worldobjects, operateLocal, "LeftArm");
|
||||||
end
|
end
|
||||||
|
|
||||||
|
break -- stop cycling like an idiot
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user