Project Zomboid

Project Zomboid

Superb Survivors!
PepperCat 2022년 8월 31일 오후 6시 20분
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
< >
전체 댓글 5개 중 1~5개 표시 중
Foka 2022년 9월 7일 오전 11시 10분 
Thank you very much! I play a couple of hours and works fine to me.
PepperCat 2022년 9월 7일 오후 12시 46분 
Glad to see it works for others too :) hope this gets updated in the mod
nolanritchie  [개발자] 2022년 9월 8일 오전 2시 43분 
PepperCat 님이 먼저 게시:
Glad to see it works for others too :) hope this gets updated in the mod
i'll change this
PepperCat 2022년 9월 8일 오전 11시 05분 
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  [개발자] 2022년 9월 8일 오후 1시 05분 
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
< >
전체 댓글 5개 중 1~5개 표시 중
페이지당 표시 개수: 1530 50