Jump to content

Mod code repeating itself 2-4 times


Recommended Posts

The code is here: https://github.com/DrSmugleaf/Mod-Character-Rebalancing-2/tree/development

This was a problem long ago but never paid much attention to it, however now its affecting things like Abigail's Galaxy Sword sanity penalty on equip/unequip, removing 20 sanity instead of 5: https://github.com/DrSmugleaf/Mod-Character-Rebalancing-2/blob/development/data/characters/abigail.lua#L54-L74

Along with general log spam, printing this out to the log 4 times at once: https://github.com/DrSmugleaf/Mod-Character-Rebalancing-2/blob/development/data/scripts/loghelper.lua#L29

And this 4 times in pairs of 2 for each character: https://github.com/DrSmugleaf/Mod-Character-Rebalancing-2/blob/development/data/characters/abigail.lua#L169

 

Here's the log:

Spoiler

[00:50:37]: Mod: Mod-Character-Rebalancing-2 (Mod Character Rebalancing 2)    Loading modworldgenmain.lua    
[00:50:37]: Mod: Mod-Character-Rebalancing-2 (Mod Character Rebalancing 2)      Mod had no modworldgenmain.lua. Skipping.    
[00:50:37]: Mod: Mod-Character-Rebalancing-2 (Mod Character Rebalancing 2)    Loading modmain.lua    
[00:50:37]: modimport: ../mods/Mod-Character-Rebalancing-2/engine.lua    
[00:50:37]: [Mod Character Rebalancing 2] [INFO] Running Mod Character Rebalancing 2 Version: 1.0.0    
[00:50:37]: [Mod Character Rebalancing 2] [INFO] Running Mod Character Rebalancing 2 Version: 1.0.0    
[00:50:37]: [Mod Character Rebalancing 2] [INFO] Running Mod Character Rebalancing 2 Version: 1.0.0    
[00:50:37]: [Mod Character Rebalancing 2] [INFO] Running Mod Character Rebalancing 2 Version: 1.0.0    
[00:50:37]: [Mod Character Rebalancing 2] [INFO] Balancing Abigail(Stardew) by Silhh and Arcade Version: 1.2.1    
[00:50:37]: [Mod Character Rebalancing 2] [INFO] Balancing Abigail(Stardew) by Silhh and Arcade Version: 1.2.1    
[00:50:37]: [Mod Character Rebalancing 2] [INFO] Balancing Ace(P) by Silh Version: 1.1.16    
[00:50:37]: [Mod Character Rebalancing 2] [INFO] Balancing Ace(P) by Silh Version: 1.1.16    
[00:50:37]: [Mod Character Rebalancing 2] [INFO] Balancing Luffy(OS 4.0) by Silhh and Arcade Version: 1.2.1    
[00:50:37]: [Mod Character Rebalancing 2] [INFO] Balancing Luffy(OS 4.0) by Silhh and Arcade Version: 1.2.1    
[00:50:37]: [Mod Character Rebalancing 2] [INFO] Balancing Tohsaka Rin(P) by Silh and Arcade Version: 1.3.5    
[00:50:37]: [Mod Character Rebalancing 2] [INFO] Balancing Tohsaka Rin(P) by Silh and Arcade Version: 1.3.5    
[00:50:37]: [Mod Character Rebalancing 2] [INFO] Balancing Saber(P) by Silh Version: 1.2.4    
[00:50:37]: [Mod Character Rebalancing 2] [INFO] Balancing Saber(P) by Silh Version: 1.2.4    
[00:50:37]: [Mod Character Rebalancing 2] [INFO] Balancing (Dark)Sakura Matou(P) by Silh and Arcade Version: 1.3.9    
[00:50:37]: [Mod Character Rebalancing 2] [INFO] Balancing (Dark)Sakura Matou(P) by Silh and Arcade Version: 1.3.9    
[00:50:37]: [Mod Character Rebalancing 2] [INFO] Balancing Tamamo(OS 4.0) by Silhh and Arcade Version: 1.3.5    
[00:50:37]: [Mod Character Rebalancing 2] [INFO] Balancing Tamamo(OS 4.0) by Silhh and Arcade Version: 1.3.5    
[00:50:37]: [Mod Character Rebalancing 2] [INFO] Balancing Abigail(Stardew) by Silhh and Arcade Version: 1.2.1    
[00:50:37]: [Mod Character Rebalancing 2] [INFO] Balancing Abigail(Stardew) by Silhh and Arcade Version: 1.2.1    
[00:50:37]: [Mod Character Rebalancing 2] [INFO] Balancing Ace(P) by Silh Version: 1.1.16    
[00:50:37]: [Mod Character Rebalancing 2] [INFO] Balancing Ace(P) by Silh Version: 1.1.16    
[00:50:37]: [Mod Character Rebalancing 2] [INFO] Balancing Luffy(OS 4.0) by Silhh and Arcade Version: 1.2.1    
[00:50:37]: [Mod Character Rebalancing 2] [INFO] Balancing Luffy(OS 4.0) by Silhh and Arcade Version: 1.2.1    
[00:50:37]: [Mod Character Rebalancing 2] [INFO] Balancing Tohsaka Rin(P) by Silh and Arcade Version: 1.3.5    
[00:50:37]: [Mod Character Rebalancing 2] [INFO] Balancing Tohsaka Rin(P) by Silh and Arcade Version: 1.3.5    
[00:50:37]: [Mod Character Rebalancing 2] [INFO] Balancing Saber(P) by Silh Version: 1.2.4    
[00:50:37]: [Mod Character Rebalancing 2] [INFO] Balancing Saber(P) by Silh Version: 1.2.4    
[00:50:37]: [Mod Character Rebalancing 2] [INFO] Balancing (Dark)Sakura Matou(P) by Silh and Arcade Version: 1.3.9    
[00:50:37]: [Mod Character Rebalancing 2] [INFO] Balancing (Dark)Sakura Matou(P) by Silh and Arcade Version: 1.3.9    
[00:50:37]: [Mod Character Rebalancing 2] [INFO] Balancing Tamamo(OS 4.0) by Silhh and Arcade Version: 1.3.5    
[00:50:37]: [Mod Character Rebalancing 2] [INFO] Balancing Tamamo(OS 4.0) by Silhh and Arcade Version: 1.3.5    

 

 

Loading only data/scripts/init and data/characters/init, same thing, 20 sanity drain instead of 5.

Loading only data/scripts/init and instead only loading data/characters/abigail in modmain.lua, it only repeats the first pair and drains 10 sanity instead of 5:

Spoiler

[00:54:27]: Mod: Mod-Character-Rebalancing-2 (Mod Character Rebalancing 2)	Loading modworldgenmain.lua	
[00:54:27]: Mod: Mod-Character-Rebalancing-2 (Mod Character Rebalancing 2)	  Mod had no modworldgenmain.lua. Skipping.	
[00:54:27]: Mod: Mod-Character-Rebalancing-2 (Mod Character Rebalancing 2)	Loading modmain.lua	
[00:54:27]: modimport: ../mods/Mod-Character-Rebalancing-2/engine.lua	
[00:54:27]: [Mod Character Rebalancing 2] [INFO] Running Mod Character Rebalancing 2 Version: 1.0.0	
[00:54:27]: [Mod Character Rebalancing 2] [INFO] Running Mod Character Rebalancing 2 Version: 1.0.0	
[00:54:27]: [Mod Character Rebalancing 2] [INFO] Running Mod Character Rebalancing 2 Version: 1.0.0	
[00:54:27]: [Mod Character Rebalancing 2] [INFO] Running Mod Character Rebalancing 2 Version: 1.0.0	
[00:54:27]: [Mod Character Rebalancing 2] [INFO] Balancing Abigail(Stardew) by Silhh and Arcade Version: 1.2.1	
[00:54:27]: [Mod Character Rebalancing 2] [INFO] Balancing Abigail(Stardew) by Silhh and Arcade Version: 1.2.1	

 

Same thing if I move abigail.lua to core and do "Load "abigail"".

Edit: Also it repeats things like AddComponent's, making the console print out that the component already exists.

 

I'm using Kzisor's(Ysovuka) engine.lua: 

 

 

 

Which pretty much no one other than Kzisor himself, Simplex, and anyone who actually spends time with lua on a regular basis know how the actual hell it works outside of doing the fancy Load thing.

 

Tried looking in 90 mods for engine.lua, only 7 of which have it: workshop-472803272, workshop-613786237, workshop-568752394, workshop-493673961, workshop-399799824, workshop-380079744 and mine, Mod Character Rebalancing 2.

Then tried looking for mods that have the same file structure I use, with data and all, only found 1 that does it (spoiler: mine) outside of the old env.lua that Kzisor used to use.

 

After that, tried to put print("test") inside of one of the core files from Kzisor's engine.lua, and it also repeats the print twice.

 

So in the end, if I leave it like how it is on GitHub, everything everywhere repeats 4 times, including sanity penalties for Abigail's Galaxy Sword, removing 20 sanity when it repeats 4 times. Doing it the other ways removes 10 sanity when it repeats twice, instead of the intended 5.

So outside of being just spammy which is why I ignored it until now, its affecting more than the log. Then again I may just be dumb and assumed that this replaces the old env.lua when it doesn't or forgot some function argument somewhere, but looking at engine.lua for me is like looking into a pit of what even is this file.

I have some sort of special ability to **** up every time I use Kzisor's code.

Edited by DrSmugleaf
Link to comment
Share on other sites

while im not sure what causes it, you could add a boolean variable that checks if the code has been run already, that should make it not repeat stuff.

However when you mentioned compenents being readded and it printing things in the console, I remember everytime a player joined a server with my mod, it would print replica component already exists, so it might be that modmain is ran everytime a player joins, and all I had was      'AddReplicableComponent("component")' in modmain about it.

Link to comment
Share on other sites

3 minutes ago, Aquaterion said:

while im not sure what causes it, you could add a boolean variable that checks if the code has been run already, that should make it not repeat stuff.

However when you mentioned compenents being readded and it printing things in the console, I remember everytime a player joined a server with my mod, it would print replica component already exists, so it might be that modmain is ran everytime a player joins, and all I had was      'AddReplicableComponent("component")' in modmain about it.

Putting modinfo's all_clients_require_mods to false still keeps the log the same, and this is what I meant about the component spam:

Spoiler

[00:17:30]: component finiteuses already exists!	../mods/Mod-Character-Rebalancing-2/data/characters/abigail.lua:93 in () ? (Lua) <49-108>	
[00:17:30]: component finiteuses already exists!	../mods/Mod-Character-Rebalancing-2/data/characters/abigail.lua:93 in () ? (Lua) <49-108>	
[00:17:30]: component finiteuses already exists!	../mods/Mod-Character-Rebalancing-2/data/characters/abigail.lua:93 in () ? (Lua) <49-108>	
[00:17:30]: Spawning player at: [Load] (102.65, 0.00, -22.81)	

 

 

As for checking if the code has been run already, I would either need to put that in every single file or figure out how engine.lua works, and while the first option is less time consuming it's also a pain. Though if no one manages to magic the solution out of nowhere I will probably do that.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...