Jump to content

Recommended Posts

I'm creating a mod that will add multiple structures to the game. Some of them are very similar and will largely be using the same code, so it made sense to me to place all the code in one file and create multiple prefabs from that file. In the same manner that the game code stores both "tent" and "siestahut" in the tent.lua file, or "slow_farmplot" and "fast_farmplot" in farmplot.lua file.

So in the same way as those above I was going to have a prefab "miningHUB" and other variations stored in HUB.lua.
My modmain.lua includes "HUB" in the PrefabFiles.

SO to get to the actual issue, when the game loads and I go to craft the object, it creates the following error:

[00:00:43]: Can't find prefab mininghub_placer	
[00:00:43]: [string "scripts/components/playercontroller.lua"]:893: attempt to index field 'placer' (a nil value)
LUA ERROR stack traceback:
scripts/components/playercontroller.lua:893 in (method) StartBuildPlacementMode (Lua) <879-898>

If I change the code (for testing purposes) to use the a different placer (ie. haunted_chest_placer), then I can 'place' the structure (obviously with the wrong placer object), but nothing spawns and the log show "[00:00:57]: Can't find prefab mininghub". Hardly surprising I know.

The log file before that shows it registering the prefabs.

[00:00:25]: Mod: AutomatedMachines (DST Automated Machines)	Registering prefabs	
[00:00:25]: Mod: AutomatedMachines (DST Automated Machines)	  Registering prefab file: prefabs/haunted_chest	
[00:00:25]: Mod: AutomatedMachines (DST Automated Machines)	    haunted_chest	
[00:00:25]: Mod: AutomatedMachines (DST Automated Machines)	    haunted_chest_placer	
[00:00:25]: Mod: AutomatedMachines (DST Automated Machines)	  Registering prefab file: prefabs/haunted_chest_ghost	
[00:00:25]: Mod: AutomatedMachines (DST Automated Machines)	    haunted_chest_ghost	
[00:00:25]: Mod: AutomatedMachines (DST Automated Machines)	  Registering prefab file: prefabs/HUB	
[00:00:25]: Mod: AutomatedMachines (DST Automated Machines)	    miningHUB	
[00:00:25]: Mod: AutomatedMachines (DST Automated Machines)	    miningHUB_placer	
[00:00:25]: Mod: AutomatedMachines (DST Automated Machines)	  Registering prefab file: prefabs/TIM	
[00:00:25]: Mod: AutomatedMachines (DST Automated Machines)	    miningTIM	
[00:00:25]: Mod: AutomatedMachines (DST Automated Machines)	  Registering default mod prefab	
[00:00:25]: 	LOAD BE	
[00:00:27]: 	LOAD BE: done	

I guess it is clear that the game cannot find the prefabs. I've looked at the examples I listed at the start (tent and farmplot) but I cant see see what is so different about those prefabs. Does anyone have any ideas or do I have to resort to copy pasting the same code into files with the file name set to the same as the prefab name? (like I have with my haunted_chest).

Thank you for your time and any assistance you can provide, it is greatly appreciated.

Looks like I was my own undoing here, my prefab names had capital letters, changed these to lower case and it worked.

Answer was in this forum post.. http://forums.kleientertainment.com/topic/62233-mod-error-appears-in-the-select-screen/#comment-708302

Thanks for stopping by.

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
×
  • Create New...