Project Zomboid

Project Zomboid

Superb Survivors!
PepperCat Aug 31, 2022 @ 6:20pm
Snake's modpack fix to the error that prevents the player and NPC to loot
Hi!

Inside Superb-Survivors\media\lua\client\TimedActions
I renamed the file "ISInventoryTransferAction" to "SSISInventoryTransferAction" (so is not called the same as vanilla one).

Inside the file deleted all the code there (as it was overriding all the vanilla functions for that TimedAction when only the perform function was being used with custom code) and it now only requires the code below. Also instead of overriding the vanilla function, it will run on top of the vanilla perform function that will improve the compatibilty with other mods that touches the same function

require "TimedActions/ISInventoryTransferAction"

local SSIsInventoryTransferAction = {}
SSIsInventoryTransferAction.ISInventoryTransferAction = {}

SSIsInventoryTransferAction.ISInventoryTransferAction.perform = ISInventoryTransferAction.perform
function ISInventoryTransferAction:perform()
SSIsInventoryTransferAction.ISInventoryTransferAction.perform(self)
print("SSIsInventoryTransferAction perform");
if(self.item ~= nil) then -- edits
local ssquare = getSourceSquareOfItem(self.item,self.character)
--print(tostring(ssquare))
if(ssquare ~= nil) and (self.destContainer:getType() ~= "floor") then
local OwnerGroupId = SSGM:GetGroupIdFromSquare(ssquare)
local TakerGroupId = self.character:getModData().Group
if(OwnerGroupId ~= -1) and (TakerGroupId ~= OwnerGroupId) and (self.character:getModData().ID ~= self.item:getModData().LastOwner) then
print("ga stealing detected!")
SSGM:Get(OwnerGroupId):stealingDetected(self.character)
end
end
end
end
< >
Showing 1-5 of 5 comments
Foka Sep 7, 2022 @ 11:10am 
Thank you very much! I play a couple of hours and works fine to me.
PepperCat Sep 7, 2022 @ 12:46pm 
Glad to see it works for others too :) hope this gets updated in the mod
nolanritchie  [developer] Sep 8, 2022 @ 2:43am 
Originally posted by PepperCat:
Glad to see it works for others too :) hope this gets updated in the mod
i'll change this
PepperCat Sep 8, 2022 @ 11:05am 
That's Awesome!
Also if it is useful for you I also tested some updates/deletes for the TimedActions and checked if it still worked and everything seems fine, for the TimedActions files I deleted all of them except for: "ISGetHitFromBehindAction", "ISGetHitFromFrontAction", "ISNPCScavengeAction", "ISSurenderAction" as those 4 are custom TimedActions and does not override anything in vanilla
For "ISInventoryTransferAction" is what I mentioned above to fix Snake's modpack error and for "ISGrabItemAction" I updated it too following the same logic, make it not override vanilla so it improves the compatibility with other mods. Hope this helps!


Same logic as above:
file renamed to "SSISGrabItemAction"


And the code:


require "TimedActions/ISGrabItemAction"

local SSISGrabItemAction = {}
SSISGrabItemAction.ISGrabItemAction = {}

SSISGrabItemAction.ISGrabItemAction.perform = SSISGrabItemAction.perform
function ISGrabItemAction:perform()
SSISGrabItemAction.ISGrabItemAction.perform(self)
print("SSISGrabItemAction perform");
if(self.item ~= nil) then
local ssquare = getSourceSquareOfItem(self.item,self.character)
if(ssquare ~= nil) then
local OwnerGroupId = SSGM:GetGroupIdFromSquare(ssquare)
local TakerGroupId = self.character:getModData().Group
if(OwnerGroupId ~= -1) and (TakerGroupId ~= OwnerGroupId) then
print("ga stealing detected!")
SSGM:Get(OwnerGroupId):stealingDetected(self.character)
end
end
end
end


Thank you so much for the awesome work :)
nolanritchie  [developer] Sep 8, 2022 @ 1:05pm 
yeah that makes sense, only change the part you need to, then less likely to conflict or break down the road with updates etc. yes I'll change that one too.. thanks
< >
Showing 1-5 of 5 comments
Per page: 1530 50