MrSledgeGaming Posted May 14, 2022 Share Posted May 14, 2022 Hello, thanks to all that reply My mod requires me to edit a core function in the ISReadABook.lua file. Currently, I am doing this by overwriting the function. However, I am also trying to make the mod as compatible as possible with other mods, so if a mod also needs to update or change the files, both may cause unexpected behavior. Here is my code block require "TimedActions/ISBaseTimedAction" require "TimedActions/ISReadABook.lua" local validOverride = function(self) local vehicle = self.character:getVehicle() if vehicle and vehicle:isDriver(self.character) then --return not vehicle:isEngineRunning() <-- My edit end return self.character:getInventory():contains(self.item) and ((self.item:getNumberOfPages() > 0 and self.item:getAlreadyReadPages() <= self.item:getNumberOfPages()) or self.item:getNumberOfPages() < 0); end local finishReading = function(self) local vehicle = self.character:getVehicle() if vehicle and vehicle:isDriver(self.character) then --return not vehicle:isEngineRunning() <-- My edit getPlayer():getStats():setDrunkenness(0); <-- My edit end if self.item:getNumberOfPages() > 0 and self.item:getAlreadyReadPages() >= self.item:getNumberOfPages() then self.item:setAlreadyReadPages(self.item:getNumberOfPages()); end self.character:setReading(false); self.item:setJobDelta(0.0); if SkillBook[self.item:getSkillTrained()] then self.character:playSound("CloseBook") else self.character:playSound("CloseMagazine") end ISBaseTimedAction.stop(self); end //OVERRIDES Events.OnGameStart.Add( function() ISReadABook.isValid = validOverride ISReadABook.stop = finishReading end ) Is this the proper etiquette in ensuring that mods are compatible as possible? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.