• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

Getting started - CanPickup to block

John Black

Refugee
Hi

Years ago I used to generate wrappers to mod 7d2d xmls. It allowed me to create recipes and blocks and re-apply changes after game updates. I'm now trying to accomplish the same as below by using modlets but am already running into issues.

public static void CreateRecipeAndAllowPickup()
{
/* donotuse */
var doNotUseSign = new RecipeWrapper(Item.doNotUse, false);
doNotUseSign.ClearComponents();
doNotUseSign.AddDistributed(Item.plantChrysanthemum, 1, Item.leather, 3, Item.leather, 3, Item.leather, 3);
doNotUseSign.Count = 9;
doNotUseSign.CraftTime = 9;
doNotUseSign.Clone("doNotUse"); // clone + remove to get in same place in xml
doNotUseSign.Remove();

var doNotUseSignBlock = new BlockWrapper(Block.doNotUse);
doNotUseSignBlock.CanPickup = true;
}



I started out with the stop sign, trying to allow player to pick it up but ... yeah, can't even get that to work. 😃

The modlet seems to load just fine so I guess the culprit is my blocks.xml. Is there any way, in-game, to look at the current attributes of items?

...\7 Days To Die\Mods\TJL\Config\blocks.xml

Code:
<configs>
	<setattribute xpath="/blocks/block[@name='signRoadStop']" name="CanPickup">true</setattribute>
</configs>
 
Looking at that block, it doesn't have that property, so it would need to be an append, not setattribute. Something like:

<append xpath="/blocks/block[@name='signRoadStop']">
<property name="CanPickup" value="true"/>
</append>




And also, this should probably go into the Discussion and Requests forum. This one is mostly used for released mods.

 
Last edited by a moderator:
Thank you, was messing with this between other work and never picked up it was node rather than an attribute.

Anyway, all sorted so a mod can move/delete if they want. 👍👍

 
Back
Top