CensedPie Posted December 10, 2016 Share Posted December 10, 2016 I made a mod that allows me to create a battery. It can be crafted by anyone and only wx-78 can eat it. The mod works as intended but I am getting a few bugs. One of the bugs is that wx-78 now won't upgrade when he eats gears. Here is my modmain.lua where I believe the bug occurs. local STRINGS = GLOBAL.STRINGS STRINGS.NAMES.BATTERY = "Battery" STRINGS.RECIPE_DESC.BATTERY = "Battery for healing wx-78." STRINGS.CHARACTERS.GENERIC.DESCRIBE.BATTERY = "Battery for wx-78." GLOBAL.FOODTYPE.BATTERY = "BATTERY" GLOBAL.FOODGROUP.OMNIEXTENDED = {name = "OMNIEXTENDED", types = {GLOBAL.FOODTYPE.GENERIC, GLOBAL.FOODTYPE.MEAT, GLOBAL.FOODTYPE.GEARS, GLOBAL.FOODTYPE.VEGGIE, GLOBAL.FOODTYPE.SEEDS, GLOBAL.FOODTYPE.BATTERY,},} local function addBat(inst) inst:AddComponent("eater") inst.components.eater:SetDiet({GLOBAL.FOODGROUP.OMNIEXTENDED}, {GLOBAL.FOODTYPE.GENERIC, GLOBAL.FOODTYPE.MEAT, GLOBAL.FOODTYPE.GEARS, GLOBAL.FOODTYPE.VEGGIE, GLOBAL.FOODTYPE.SEEDS, GLOBAL.FOODTYPE.BATTERY}) end AddPrefabPostInit("wx78", addBat) PrefabFiles = { "battery", } local RECIPETABS = GLOBAL.RECIPETABS local TECH = GLOBAL.TECH AddRecipe("battery", {Ingredient("log", 1), Ingredient("berries", 2)}, RECIPETABS.SURVIAL, TECH.NONE) Link to comment Share on other sites More sharing options...
Aquaterion Posted December 10, 2016 Share Posted December 10, 2016 Try this (I added comments where I did changes) local STRINGS = GLOBAL.STRINGS STRINGS.NAMES.BATTERY = "Battery" STRINGS.RECIPE_DESC.BATTERY = "Battery for healing wx-78." STRINGS.CHARACTERS.GENERIC.DESCRIBE.BATTERY = "Battery for wx-78." GLOBAL.FOODTYPE.BATTERY = "BATTERY" --Removed the new foodgroup omnitype AddComponentPostInit("eater", function(self)--modify the eater component function self:SetCanEatBatteries()--add a function to insert the battery foodtype into our "caneat" and "preferseating" tables table.insert(self.preferseating, FOODTYPE.BATTERY) table.insert(self.caneat, FOODTYPE.BATTERY) self.inst:AddTag(FOODTYPE.BATTERY.."_eater") end end) AddPrefabPostInit("wx78", function(inst) if not GLOBAL.TheWorld.ismastersim then--added since only the server needs to do component stuff return inst end inst.components.eater:SetCanEatBatteries()--calls the new function we added in the eater component end) PrefabFiles = { "battery", } local RECIPETABS = GLOBAL.RECIPETABS local TECH = GLOBAL.TECH AddRecipe("battery", {Ingredient("log", 1), Ingredient("berries", 2)}, RECIPETABS.SURVIAL, TECH.NONE) Link to comment Share on other sites More sharing options...
CensedPie Posted December 11, 2016 Author Share Posted December 11, 2016 It's now crashing upon loading the world. The game freezes for a few seconds and I can see the world, everything appears unaffected except for the fact that my character is invisible if I load a save and if I start a new game the spawning freezes with the light beams. After the freeze the game says Disconnected from server and then either auto crashes after a few seconds or crashes if I press ok. Any ideas about why this is happening? It's a new symptom. Link to comment Share on other sites More sharing options...
Aquaterion Posted December 11, 2016 Share Posted December 11, 2016 26 minutes ago, CensedPie said: It's now crashing upon loading the world. The game freezes for a few seconds and I can see the world, everything appears unaffected except for the fact that my character is invisible if I load a save and if I start a new game the spawning freezes with the light beams. After the freeze the game says Disconnected from server and then either auto crashes after a few seconds or crashes if I press ok. Any ideas about why this is happening? It's a new symptom. could you provide the crashlog? (Documents/Klei/DontStarveTogether/client_log.txt or Documents/Klei/DontStarveTogetherANewReignBeta/client_log.txt depending if you're using beta or not) Link to comment Share on other sites More sharing options...
CensedPie Posted December 11, 2016 Author Share Posted December 11, 2016 Here is the crash log. client_log.txt Link to comment Share on other sites More sharing options...
Aquaterion Posted December 11, 2016 Share Posted December 11, 2016 (edited) Actually try this: --change this: GLOBAL.FOODTYPE.BATTERY = "BATTERY" --to this: local FOODTYPE = GLOBAL.FOODTYPE FOODTYPE.BATTERY = "BATTERY" Edit: from the log, I couldn't find anything specific that made you lose connection.. Edited December 11, 2016 by Aquaterion Link to comment Share on other sites More sharing options...
CensedPie Posted December 11, 2016 Author Share Posted December 11, 2016 Thank you very much! This solved the issue Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now