Jump to content

Expanded Traps


Valmar

Recommended Posts

This is a simple mod I worked up a while back. It adds some new traps to the game:

 

Steel Fire Spikes, Fire Traps, Nail Mines, Adhesive Traps and Miner's TNT.

 

When the firetraps run out of fuel you can "refill" them with gasoline. Nail Mines are basically mines that only cause entity damage - no damage to blocks. Adhesive Traps slow down enemies. Miner's TNT is an creative-menu tnt which is more powerful than a standard tnt.

 

Will probably need to work out a few balance issues later down the road but for the moment the code is done and it works for anyone interested.

 

Blocks.xml

http://pastebin.com/neL9gwgm

 

Recipes.xml

http://pastebin.com/HE8SGd2i

 

Modify the gascan to allow refilling of the firetrap:

 

<item id="161" name="gasCan">
<property name="Meshfile" value="Items/Misc/sackPrefab" />
<property name="DropMeshfile" value="Items/Misc/sack_droppedPrefab" />
<property name="HoldType" value="45" />
<property name="Material" value="metal" />
<property name="Stacknumber" value="1000" /> <!-- STK resource -->
<property name="FuelValue" value="2" />
<property name="CraftingSkillGroup" value="Science"/>
<property name="Group" value="Resources,Chemicals" />
<property name="Degradation" value="5000" param1="false" />
	<property class="Action1">
		<property name="Class" value="Repair" />
		<property name="Delay" value="0.4" />
		<property name="Repair_amount" value="125" />
		<property name="Upgrade_hit_offset" value="-1" />
		<property name="Sound_start" value="UseActions/repair_block" />
		<property name="Allowed_upgrade_items" value="gasCan" />
	</property>
</item>

 

Custom Icons:

https://www.mediafire.com/folder/l7mv8oa4mk77o/Icons

 

Optional:

Add this to your Localization file in the config folder:

 

trapFire,blocks,Traps,,Fire Trap,,
trapFireDesc,blocks,Traps,,This trap sets whatever walks over it on fire. When it goes out you can refill it using gasoine.,,
trapAdhesive,blocks,Traps,,Adhesive Trap,,
trapAdhesiveDesc,blocks,Traps,,This trap doesn't deal damage but will slow any enemy that walks over it.,,
trapAdhesiveSpike,blocks,Traps,,Adhesive Spike,,
trapAdhesiveSpikeDesc,blocks,Traps,,This logspike has been coated with adhesive to make enemies move slower when the try to cross it.,,
minersTNT,blocks,Traps,,Miner's TNT,,
minersTNTDesc,blocks,Traps,,This TNT was specially crafted by a miner to ensure optimum block damage.,,
trapSteelSpike,blocks,Traps,,Steel Spike,,
trapSteelFireSpike,blocks,Traps,,Steel Fire Spike,,
trapNailMine,blocks,Traps,,Nail Mine,,
trapNailMineDesc,blocks,Traps,,This trap deals damage to anyone who triggers it but doesn't deal any damage to surrounding blocks.,,

Link to comment
Share on other sites

This is a simple mod I worked up a while back. It adds some new traps to the game:

 

Steel Spikes, Steel Fire Spikes, Fire Traps, and Nail Mines.

 

When the firetraps run out of fuel you can "refill" them with gasoline. Nail Mines are basically mines that only cause entity damage - no damage to blocks.

 

Will probably need to work out a few balance issues later down the road but for the moment the code is done and it works for anyone interested.

 

Blocks.xml

http://pastebin.com/neL9gwgm

 

Recipes.xml

http://pastebin.com/HE8SGd2i

 

Custom Icons:

https://www.mediafire.com/#l7mv8oa4mk77o

 

Hey Valmar

 

Awesome stuff. But when I click on the link for the CustomIcons it takes me to a page where i have to sign up instead of the dl of customicons part

Link to comment
Share on other sites

Hey man, just got to point out that the following code has a few quirks.

 

<property name="Damage_received" value="8" />

 

 

a value of 8 will will only do 0.8 damage to the block, so you'd want to up it to 80 for 8 points of damage. I've tested this myself when I created my own custom traps as well as modifying default pine tip spikes.

Link to comment
Share on other sites

@Nodabba

 

Is that something changed with A13?

 

The code for "Damage_received" hasn't changed based on my A12.5 vanilla copy of the blocks.xml file. However, the addition of block health does change how that mechanic works. I find it silly that a fully upgraded pine tip spike has a life of 750 and only takes a damage of 0.2 every time it is encountered by an entity. Heck, even a normal pine tip spike has a health of 200 and only takes 0.5 damage. The likelihood of having to repair ANY of your traps based on the pine tip spike mechanic (which it looks like most if not all your custom traps use) is very low - especially when fully upgraded.

 

Considering that pine tip spikes inflict half the damage of normal wood spikes and only costs three times more to make, I think it's completely unbalanced to have stage one pine tip spikes be able to inflict up to a total 2000 damage throughout its life versus the 60 of the normal wood spike (10 for each stage). This is why I changed the damage received value to 50, so that the actual damage received by the pine tip spike is 5, reducing total damage to 200 - I believe this is a reasonably justified balance change. I've also changed all upgraded versions of the pine tip spikes to have the same damage received value (50) as their material changes once upgraded - ultimately increasing their total block health.

 

You don't have to change your numbers, but I'll give you an example of how OP traps are without considering block health.

 

Take for instance your steel spike: The steel material has a total 2000 block health pool. A damage received value of 0.5 will cause the steel spike to receive 0.05 damage every time it comes in contact with an entity - this means that it will inflict 140 damage (based on your code) for every 1 health it looses due to entity contact. Scale that up and the trap can inflict up to 280000 damage before breaking down to its lower version, pretty crazy right?

 

Hope that helps!

Link to comment
Share on other sites

Thank you for the information. I find it strange they never adjusted the values in this case. I will look into properly balancing my traps after I'm done with some more important projects I have going on. I will definitely keep this information handy though and be looking back on it later - thanks again!

Link to comment
Share on other sites

I added the code to the xmls and see the items in the creative console.

 

Testing the steel fire spike & trap, I didn't see a description for how to turn them on or "refill" them. When I placed them there was no fire/burning and they don't seem to be interactive.

 

Am I missing something?

Link to comment
Share on other sites

They are "on" when they are placed. They have a "walk on" buff that causes the entity to catch fire if they walk over it. Try walking over one yourself and see. :)

 

You can tell when the fire trap is out of fuel when/if the "grill" on the top vanishes. Thats the visual cue.

 

You "refill" them by upgrading them with a gascan when they're empty.

Link to comment
Share on other sites

  • 7 months later...

Thanks for sharing this mod.

 

I have some questions about tweaking.

1. The fire trap almost kill me when I have around 120 HP and this is way more than the normal fire debuff I get for stepping into a campfire.

I have tried adjusting some settings but I cant find anything to reduce the damage. So I wonder if it is possible to reduce the damage?

 

2. Adhesive trap have the same effect as barbwire. Is it possible to reduce the effect on this trap?

 

Thanks in advanced :)

Link to comment
Share on other sites

1. <property name="BuffsWhenWalkedOn" value="burning" /> change that to burningSmall

This is assuming you're talking about the fire trap and not the steel fire spike trap.

 

2. You can but you'd have to make a new material for it.

 

<material id="adhesive">

<property name="damage_category" value="metal" />

<property name="surface_category" value="metal" />

<property name="forge_category" value="iron" />

<property name="Hardness" type="float" value="1" />

<property name="stepsound" value="metal" />

<property name="stability_glue" value="10" />

<property name="movement_factor" value="0.5" />

<property name="Mass" type="int" value="1" />

<property name="MaxDamage" value="50" />

</material>

 

Then set the block to be made out of that material.

Link to comment
Share on other sites

1. <property name="BuffsWhenWalkedOn" value="burning" /> change that to burningSmall

This is assuming you're talking about the fire trap and not the steel fire spike trap.

 

2. You can but you'd have to make a new material for it.

 

<material id="adhesive">

<property name="damage_category" value="metal" />

<property name="surface_category" value="metal" />

<property name="forge_category" value="iron" />

<property name="Hardness" type="float" value="1" />

<property name="stepsound" value="metal" />

<property name="stability_glue" value="10" />

<property name="movement_factor" value="0.5" />

<property name="Mass" type="int" value="1" />

<property name="MaxDamage" value="50" />

</material>

 

Then set the block to be made out of that material.

 

wow....your helpfulness and knowledge is impressive...thanks again...

Link to comment
Share on other sites

A few other things:

 

1. For some reason Im unable to refill the empty firetrap.

I have modified the gascan and the rest according to install instruction. I have tried to right and left click with gasan on the empty firetrap, and tried with hammer and wrench (there is nothing in your files to suggest this but I had to try).

When clicking with gascan I get this message: The item needs repairs or is missing parts

Anyway, what am I doing wrong?

 

2. To make the miners tnt available in game is it just to make a recipe?

Link to comment
Share on other sites

Add this to the gas can:

 

<property name="Degradation" value="5000" param1="false" />

 

Should look like this:

 

<item id="161" name="gasCan">
<property name="Meshfile" value="Items/Misc/sackPrefab" />
<property name="DropMeshfile" value="Items/Misc/sack_droppedPrefab" />
<property name="HoldType" value="45" />
<property name="Material" value="metal" />
<property name="Stacknumber" value="1000" /> <!-- STK resource -->
       [color="#FFFF00"]<property name="Degradation" value="5000" param1="false" />[/color]
<property name="FuelValue" value="2" />
<property name="CraftingSkillGroup" value="Science"/>
<property name="Group" value="Resources,Chemicals" />
	<property class="Action1">
		<property name="Class" value="Repair" />
		<property name="Delay" value="0.4" />
		<property name="Repair_amount" value="125" />
		<property name="Upgrade_hit_offset" value="-1" />
		<property name="Sound_start" value="UseActions/repair_block" />
		<property name="Allowed_upgrade_items" value="gasCan" />
	</property>
</item>

Link to comment
Share on other sites

Add this to the gas can:

 

<property name="Degradation" value="5000" param1="false" />

 

Should look like this:

 

<item id="161" name="gasCan">
<property name="Meshfile" value="Items/Misc/sackPrefab" />
<property name="DropMeshfile" value="Items/Misc/sack_droppedPrefab" />
<property name="HoldType" value="45" />
<property name="Material" value="metal" />
<property name="Stacknumber" value="1000" /> <!-- STK resource -->
       [color="#FFFF00"]<property name="Degradation" value="5000" param1="false" />[/color]
<property name="FuelValue" value="2" />
<property name="CraftingSkillGroup" value="Science"/>
<property name="Group" value="Resources,Chemicals" />
	<property class="Action1">
		<property name="Class" value="Repair" />
		<property name="Delay" value="0.4" />
		<property name="Repair_amount" value="125" />
		<property name="Upgrade_hit_offset" value="-1" />
		<property name="Sound_start" value="UseActions/repair_block" />
		<property name="Allowed_upgrade_items" value="gasCan" />
	</property>
</item>

 

that worked perfectly :D

Link to comment
Share on other sites

I like what I see, Valmar. I've added these to the next version of LathMod, but I noticed a few misteaks ;) :

 

 

  • trapFire does not have CustomIcon set
  • trapAdhesive is in group "Building", rather than the expected group "Tools/Traps"
  • trapAdhesiveSpike does not have CustomIcon set
  • minersTNT does not have CustomIcon set
  • minersTNT does not have a recipe
  • trapSteelSpike does not have CustomIcon set
  • trapSteelFireSpike does not have CustomIcon set
  • trapNailMine does not have CustomIcon set

 

I fixed them for LathMod, with the exception of the recipe for minersTNT. Here are the changes:

 

 

<block id="2004" name="trapFire">
   <property name="DescriptionKey" value="trapFireDesc"/>
   <property name="CustomIcon" value="trapFire"/>
   <property name="Class" value="Damage" />
   <property name="Damage" value="1" />
   <property name="Damage_received" value="13" />
   <property name="BuffsWhenWalkedOn" value="burning" />
   <property name="Material" value="Msteel" />
   <property name="Texture" value="355,352,352,352,352,352" />
   <property name="DowngradeBlock" value="trapFireEmpty" />
   <drop event="Destroy" count="0" prob="1" />
   <drop event="Fall" name="scrapMetalPile" count="1" prob="1.0"  stick_chance="1" />
   <property name="Group" value="Tools/Traps" />
</block>

<block id="2005" name="trapFireEmpty">
   <property name="DescriptionKey" value="trapFireDesc"/>
   <property name="CustomIcon" value="trapFire" />
   <property name="Material" value="Msteel" />
   <property name="Texture" value="356,352,352,352,352,352" />
   <property class="UpgradeBlock">
       <property name="ToBlock" value="trapFire" />
       <property name="Item" value="gasCan" />
       <property name="ItemCount" value="10" />
       <property name="UpgradeHitCount" value="1" />
   </property>
   <drop event="Destroy" count="0" prob="1" />
   <drop event="Fall" name="scrapMetalPile" count="1" prob="1.0"  stick_chance="1" />
   <property class="RepairItems">
       <property name="forgedIron" value="5" />
   </property>
   <property name="Group" value="Tools/Traps" />
</block>

<block id="2006" name="trapAdhesive">
   <property name="DescriptionKey" value="trapAdhesiveDesc"/>
   <property name="CustomIcon" value="drywallWhitePlate" />
   <property name="Material" value="MbarbedFence" />
   <property name="Shape" value="Plate" />
   <property name="Texture" value="217" />
   <drop event="Destroy" count="0" />
   <property name="Group" value="Tools/Traps" />
   <drop event="Fall" count="0"/>
</block>

<block id="2007" name="trapAdhesiveSpike">
   <property name="DescriptionKey" value="trapAdhesiveSpikeDesc"/>
   <property name="CustomIcon" value="trapAdhesiveSpike"/>
   <property name="Extends" value="woodLogSpike1" />
   <property name="Material" value="MbarbedFence" />
   <property name="Texture" value="245" />
   <property name="MaxDamage" value="200" />
   <property name="Group" value="Tools/Traps" />
</block>

<block id="2008" name="minersTNT">
   <property name="DescriptionKey" value="minersTNTDesc"/>
   <property name="Class" value="TNT" />
   <property name="Material" value="clothStable" />
   <property name="Shape" value="Ext3dModel" />
   <property name="Mesh" value="models" />
   <property name="Model" value="Traps/dynamite_bundle" param1="main_mesh" />
   <property class="Explosion">
       <property name="ParticleIndex" value="4" />
       <!-- which prefab/particle is used -->
       <property name="RadiusBlocks" value="12" />
       <!-- damage radius for blocks -->
       <property name="BlockDamage" value="3000" />
       <!-- damage for blocks in the center of the explosion -->
       <property name="RadiusEntities" value="5" />
       <!-- damage radius for entities -->
       <property name="EntityDamage" value="100" />
       <!-- damage for entities in the center of the explosion -->
   </property>
   <property name="LPHardnessScale" value="0" />
   <!-- disable LP for TNT blocks -->
   <property name="Group" value="Tools/Traps" />
</block>

<block id="2009" name="trapSteelSpike">
   <property name="DescriptionKey" value="trapSteelSpikeDesc"/>
   <property name="CustomIcon" value="trapSteelSpike"/>
   <property name="Class" value="Damage" />
   <property name="Damage" value="10" />
   <property name="Damage_received" value="38" />
   <property name="Material" value="Msteel" />
   <property name="Shape" value="Cone" />
   <property name="Texture" value="355,356,356,356,356,356" />
   <drop event="Destroy" count="0" />
   <property class="UpgradeBlock">
       <property name="ToBlock" value="trapSteelFireSpike" />
       <property name="Item" value="gasCan" />
       <property name="ItemCount" value="5" />
       <property name="UpgradeHitCount" value="1" />
   </property>
   <property class="RepairItems">
       <property name="forgedSteel" value="5" />
   </property>
   <property name="DowngradeBlock" value="rScrapIronLogSpike5" />
   <drop event="Fall" name="scrapIron" count="1" prob="1.0"  stick_chance=".75" />
   <property name="Group" value="Tools/Traps" />
</block>

<block id="2010" name="trapSteelFireSpike">
   <property name="DescriptionKey" value="trapSteelFireSpikeDesc"/>
   <property name="CustomIcon" value="trapSteelFireSpike"/>
   <property name="BuffsWhenWalkedOn" value="burningSmall" />
   <property name="Class" value="Damage" />
   <property name="Damage" value="10" />
   <property name="Damage_received" value="45" />
   <property name="Material" value="Msteel" />
   <property name="Shape" value="Cone" />
   <property name="Texture" value="355,356,356,356,356,356" />
   <property name="DowngradeBlock" value="trapSteelSpike" />
   <drop event="Destroy" count="0" />
   <property class="RepairItems">
       <property name="forgedSteel" value="5" />
   </property>
   <drop event="Fall" name="scrapIron" count="1" prob="1.0"  stick_chance=".75" />
   <property name="Group" value="Tools/Traps" />
</block>

<block id="2011" name="trapNailMine">
   <property name="DescriptionKey" value="trapNailMineDesc"/>
   <property name="CustomIcon" value="trapNailMine"/>
   <property name="Class" value="Mine" />
   <property name="Material" value="metal" />
   <property name="Shape" value="Ext3dModel" />
   <property name="Mesh" value="models" />
   <property name="Model" value="Traps/trap_mine_tin" param1="main_mesh" />
   <property name="IsTerrainDecoration" value="true" />
   <property name="Explosion.ParticleIndex" value="1" />
   <!-- which prefab/particle is used -->
   <property name="Explosion.RadiusEntities" value="4" />
   <!-- damage radius for entities -->
   <property name="DropScale" value="3" />
   <drop event="Destroy" count="0" />
   <property name="Group" value="Tools/Traps" />
</block>

 

 

Link to comment
Share on other sites

I might not have been clear enough. The icons are there, but the CustomIcon property is not set for the mentioned items. For example, the trapSteelSpike looks like this in the code you posted:

 

   <block id="2003" name="trapSteelSpike">
       <property name="Class" value="Damage" />
       <property name="Damage" value="10" />
       <property name="Damage_received" value="38" />
       <property name="Material" value="Msteel" />
       <property name="Shape" value="Cone" />
       <property name="Texture" value="355,356,356,356,356,356" />
       <drop event="Destroy" count="0" />
       <property class="UpgradeBlock">
           <property name="ToBlock" value="trapSteelFireSpike" />
           <property name="Item" value="gasCan" />
           <property name="ItemCount" value="5" />
           <property name="UpgradeHitCount" value="1" />
       </property>
       <property class="RepairItems">
           <property name="forgedSteel" value="5" />
       </property>
       <property name="DowngradeBlock" value="rScrapIronLogSpike5" />
       <drop event="Fall" name="scrapIron" count="1" prob="1.0"  stick_chance=".75" />
       <property name="Group" value="Tools/Traps" />
   </block>

 

In order to actually display the custom icon, the code should look like this:

 

<block id="2009" name="trapSteelSpike">
   <property name="DescriptionKey" value="trapSteelSpikeDesc"/>
   [color=#0000ff]<property name="CustomIcon" value="trapSteelSpike"/>[/color]
   <property name="Class" value="Damage" />
   <property name="Damage" value="10" />
   <property name="Damage_received" value="38" />
   <property name="Material" value="Msteel" />
   <property name="Shape" value="Cone" />
   <property name="Texture" value="355,356,356,356,356,356" />
   <drop event="Destroy" count="0" />
   <property class="UpgradeBlock">
       <property name="ToBlock" value="trapSteelFireSpike" />
       <property name="Item" value="gasCan" />
       <property name="ItemCount" value="5" />
       <property name="UpgradeHitCount" value="1" />
   </property>
   <property class="RepairItems">
       <property name="forgedSteel" value="5" />
   </property>
   <property name="DowngradeBlock" value="rScrapIronLogSpike5" />
   <drop event="Fall" name="scrapIron" count="1" prob="1.0"  stick_chance=".75" />
   <property name="Group" value="Tools/Traps" />
</block>

 

So for the items I listed above, each is missing the CustomIcon property. Does that make it clearer?

Link to comment
Share on other sites

You have an incorrect assumption. The CustomIcon property is not required if the icon shares the same name as the block/item. The items/blocks will automatically assign themselves to use any icon in the Mods folder that shares the same name. In this case it makes CustomIcon properties completely irrelevant.

Link to comment
Share on other sites

Not from my perspective. It has behaved this way for as long as I've been using the Mods folder for custom icons. Though I might not had been as early to the game as some people, so its hard to say for certain if it was ever another way.

Link to comment
Share on other sites

Item numbers

 

I'm going to attempt to add a few of your items to my game but some of the numbers are already in use by other mods. If, for example, I change the fire trap block id from "1997" another number do I need to change anything else to correspond with that?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...