Skip to content

BlockTakeAndReplace

SphereII edited this page Sep 18, 2024 · 1 revision

BlockTakeAndReplace

TakeAndReplace allows you to pick up a block and have it automatically changed into another block, such as pulling boards off a window, leaving just the window.

 

It allows you to filter not only what kind of block or shape you can pick up, but also which tool you need to use to do the picking up.

 

 

Main blocks.xml entry:

 

<property class="AdvancedPickUpAndPlace">

    <property name="Logging" value="false"/>

    <property name="Legacy" value="true" />

    <property name="TakeWithTool" value="meleeToolRepairT1ClawHammer" />

</property>

 

Legacy value allows you to pick up any block when you are holding the specified TakeWithTool. TakeWithTool is a comma delimited list. 

 

Notes:


<property name="TakeWithTool" value="meeleeToolRepairT1ClawHammer" />

- If this property is specified, the Take Prompt will only show when you are holding that item.

    - This happens after we've checked ValidMaterial, and passed the material check for pick up.

    - If this property is not specified, then the Take Prompt will show up for those blocks.

        - Note: HoldingItem property is still valid. The item(s) specified in this property will half the time it takes for the block. 

 

- If the item that you are holding has the tag "silenttake", then no sound will be played when a block is taken.

    - This happens regardless if the tool is specified in TakeWithTool or HoldingItem.

- If you can take a block, and have that tag on your hand item, no sound will be played.

    - Updated the "Take Sound" to be more appropriate for the material you are taking.

        - Wooden sound for wood materials. Steel sound for steel materials.

 

    - Added a property option CheckToolForMaterial, with the default being false.

        <property name="CheckToolForMaterial" value="true"/

 

    - If this property is defined and set to true, then the block will check for a tag on the holding item

    - The tag on the holding item must be the material ID that is allowed to be picked up.

    

<item name="meleeToolRepairT0StoneAxe">

        <!-- Allow the stone axe to pick up any block that is Mwood_weak or Mwood_regular.

<property name="Tags" value="<ommitted for clarity>,Mwood_weak, Mwood_regular"/>

 

<!-- full example : -->

<append xpath="/shapes/shape[@name='windowBoarded']">

    <property name="Class" value="TakeAndReplace, SCore"/>

    <property name="CanPickup" value="true"/>

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

    <property name="PickUpBlock" value="woodShapes:VariantHelper"/>

 

    <!-- Only allow picking up window board blocks that are weak or regular wood -->

    <property name="ValidMaterials" value="Mwood_weak,Mwood_regular"/>

 

    <!-- Only allow picking up blocks with this tool being held. -->

    <property name="TakeWithTool" value="meleeToolRepairT0StoneAxe,meleeToolRepairTazaStoneAxe"/>

                

    <!-- Check the currently held tool's tag for the material of the block / shape being picked up -->

    <!-- note: That means that the stone axes must have a Mwood_weak tags in order to pick up those blocks -->

    <property name="CheckToolForMaterial" value="true" />

</append>    

 

 

- Created some helper shortcuts in order to reduce hard coding many references in the blocks.xml/shapes.xml

- If the TakeWithTool property exists on the block / shape, then a lookup against the AdvancedPickUpAndPlace class is triggered.

    -> ValidMaterials operates the same style of lookup.

 

- This lookup uses the value of the TakeWithTool from the block/shape as a key to an entry in AdvancedPickUpAndPlace.

 

For Example:

 

    <!-- Config Block -->

    <property class="AdvancedPickUpAndPlace">

    <property name="Logging" value="false" />

        <property name="TakeWithTool" value="meleeToolRepairT1ClawHammer" />

             <property name="WoodenFenceTools"                
            value="meleeToolRepairT0StoneAxe,meleeToolRepairT0TazasStoneAxe,meleeToolRepairT1ClawHammer,meleeToolAxeT1IronFireaxe,meleeToolAxeT2SteelAxe,meleeToolAxeT3Chainsaw">

        <property name="woodMaterial" value="Mwood_weak,Mwood_regular"/>

    </property>

 

And now, instead of defining a full tool list, or a full material list on the individual block, you can do something like this.

 

        <property name="TakeWithTool" value="WoodenFenceTools" />

        <property name="ValidMaterials" value="woodMaterial"/>

 

 

- You may append to the class with your own unique keys

    <append xpath="/blocks/block[@name='ConfigFeatureBlock']/property[@class='AdvancedPickUpAndPlace']">

        <property name="WoodenFenceTools" value="meleeToolRepairT0StoneAxe,meleeToolRepairT0TazasStoneAxe,meleeToolRepairT1ClawHammer,meleeToolAxeT1IronFireaxe,meleeToolAxeT2SteelAxe,meleeToolAxeT3Chainsaw" />

    </append>


Created with the Personal Edition of HelpNDoc: Transform Your Documentation Process with HelpNDoc's Project Analyzer

0-SCore

Table of contents

Clone this wiki locally