Project Zomboid

Project Zomboid

Computer Games & Command Line Interface
McCog 28 Jul, 2023 @ 3:07am
Wont use grid power again. Requiring generator.
Adding the line "if v:getSquare():haveElectricity() then" over-rides and dismisses the last line. I fixed it like this
"
if getPlayer():getPerkLevel(Perks.Electricity) > 0 then
if v:getSquare():haveElectricity() or (SandboxVars.ElecShutModifier > -1 and
GameTime:getInstance():getNightsSurvived() < SandboxVars.ElecShutModifier) then
"
< >
Showing 1-4 of 4 comments
McCog 28 Jul, 2023 @ 3:15am 
That should re-implement the electronics perk prerequisite with the last fix.
McCog 21 Dec, 2023 @ 7:48pm 
open /media/lua/client/clientCLIEvents.lua you have "SandboxVars.ElecShutModifier) then" on the wrong line. move it up so it is right after "getNightsSurvived() < ".
McCog 21 Dec, 2023 @ 8:15pm 
This is exactly what I have in clientCLIEvents.lua and it works for me. beware of wordwrap breaking lines to fit text in the window.

local function handleFillWorldObjectContextMenu(player, context, worldobjects, test)
for k, v in pairs(worldobjects) do
local objects = v:getSquare():getObjects()
for i = 0, objects:size() - 1, 1 do
local objectName = objects:get(i):getSprite():getName()
--print(objectName)
if objectName == "appliances_com_01_72" or objectName == "appliances_com_01_73" or objectName == "appliances_com_01_74" or objectName == "appliances_com_01_75"then
if getPlayer():getPerkLevel(Perks.Electricity) > 0 then
if v:getSquare():haveElectricity() or (SandboxVars.ElecShutModifier > -1 and GameTime:getInstance():getNightsSurvived() < SandboxVars.ElecShutModifier) then
context:addOption(getText("IGUI_CLI_TerminalOpenTerminalOption"), {}, TerminalMenu.OnOpenPanel)
return
else
context:addOption(getText("IGUI_CLI_TerminalNeedsPowerOption"), {}, function() end)
return
end
else
context:addOption(getText("IGUI_CLI_TerminalRequirementsOption"), {}, function() end)
return
end
end
end
end

end

Events.OnFillWorldObjectContextMenu.Add(handleFillWorldObjectContextMenu);
McCog 21 Dec, 2023 @ 8:17pm 
Wow. that copy/paste looks messed up. Maybe I should just send you my file?
< >
Showing 1-4 of 4 comments
Per page: 1530 50