手持ちの弾薬を再利用

Last-modified: 2022-08-23 (火) 09:35:37

弾薬スクラップ/変換

目的
余ってしまった9mm弾.44マグナム弾7.62mm弾をスクラップするとき、バニラではただの真ちゅうだけになってしまいます。
これではもったいない。取り出したい素材を作業台でクラフト可能にしましょう。
XMLを直接書き換える場合

□ items.xml

 <item name="ammo9mmBulletBall">
     <property name="Tags" value="ammo"/>
     <property name="DisplayType" value="ammoBullet"/>
     <property name="HoldType" value="45"/>
     <property name="Meshfile" value="#Other/Items?Misc/sackPrefab.prefab"/>
     <property name="DropMeshfile" value="#Other/Items?Misc/sack_droppedPrefab.prefab"/>
-    <property name="Material" value="Mbrass"/>
+    <property name="Material" value="C_MAmmoBrassParts"/> <property name="Weight" value="1" />
     <property name="MeltTimePerUnit" value=".4"/>
     <property name="Stacknumber" value="300"/> <!-- STK ammo high -->
     <property name="EconomicValue" value="9"/>
     <property name="Group" value="Ammo/Weapons,Ammo,Ranged Weapons"/>
     <effect_group name="ammo9mmBulletBall" tiered="false">
         <passive_effect name="EntityDamage" operation="base_set" value="32" tags="perkGunslinger,9mmGun"/>
         <passive_effect name="BlockDamage" operation="base_set" value="6" tags="perkGunslinger"/>
         <passive_effect name="DamageModifier" operation="perc_add" value="-.8" tags="earth"/>
         <passive_effect name="DamageModifier" operation="perc_add" value="2" tags="wood"/>
     </effect_group>
 </item>

 <item name="ammo762mmBulletBall">
     <property name="Extends" value="ammo9mmBulletBall"/>
     <property name="Stacknumber" value="150"/> <!-- STK ammo low -->
+    <property name="Weight" value="2" />
     <property name="EconomicValue" value="11"/>
     <effect_group name="ammo762mmBulletBall" tiered="false">
         <passive_effect name="EntityDamage" operation="base_set" value="47" tags="perkDeadEye,perkMachineGunner"/>
         <passive_effect name="BlockDamage" operation="base_set" value="8" tags="perkDeadEye,perkMachineGunner"/>
         <passive_effect name="DamageModifier" operation="perc_add" value="-.8" tags="earth"/>
         <passive_effect name="DamageModifier" operation="perc_add" value="2" tags="wood"/>
     </effect_group>
 </item>

 <item name="ammoShotgunShell">
     <property name="Tags" value="ammo,shotgun"/>
     <property name="DisplayType" value="ammoShotgun"/>
     <property name="HoldType" value="45"/>
     <property name="Meshfile" value="#Other/Items?Misc/sackPrefab.prefab"/>
     <property name="DropMeshfile" value="#Other/Items?Misc/sack_droppedPrefab.prefab"/>
-    <property name="Material" value="Mlead_scrap"/>
+    <property name="Material" value="C_MAmmoLeadParts"/> <property name="Weight" value="1" />
     <property name="Stacknumber" value="150"/> <!-- STK ammo low -->
     <property name="EconomicValue" value="11"/>
     <property name="Group" value="Ammo/Weapons,Ammo,Ranged Weapons"/>
     <effect_group name="ammoShotgunShell" tiered="false">
         <passive_effect name="EntityDamage" operation="base_set" value="10.1" tags="perkBoomstick"/>
         <passive_effect name="BlockDamage" operation="base_set" value="5.4" tags="perkBoomstick"/>
         <passive_effect name="BlockDamage" operation="base_add" value="20" tags="wood"/>
         <passive_effect name="RoundRayCount" operation="base_set" value="10" tags="perkBoomstick"/>
         <passive_effect name="MaxRange" operation="base_set" value="10" tags="perkBoomstick"/>
         <passive_effect name="DamageFalloffRange" operation="base_set" value="4" tags="perkBoomstick"/>
         <passive_effect name="EntityPenetrationCount" operation="base_set" value="2" tags="perkBoomstick"/>
         <passive_effect name="BlockPenetrationFactor" operation="base_set" value="51" tags="perkBoomstick"/>
         <passive_effect name="SpreadDegreesVertical" operation="base_set" value="4.5" tags="perkBoomstick"/>
         <passive_effect name="SpreadDegreesHorizontal" operation="base_set" value="4.5" tags="perkBoomstick"/>
         <passive_effect name="SpreadMultiplierAiming" operation="perc_add" value="-.13" tags="perkBoomstick"/>
         <passive_effect name="SpreadMultiplierCrouching" operation="perc_add" value="-.05" tags="perkBoomstick"/>
         <passive_effect name="SpreadMultiplierWalking" operation="perc_add" value=".15" tags="perkBoomstick"/>
         <passive_effect name="SpreadMultiplierRunning" operation="perc_add" value=".3" tags="perkBoomstick"/>
         <passive_effect name="DamageModifier" operation="perc_add" value="-.8" tags="earth"/>
     </effect_group>
 </item>

+<item name="C_resourceAmmoScrapBrass">
+    <property name="Extends" value="partsMaster"/>
+    <property name="CustomIcon" value="resourceBulletCasing"/>
+    <property name="Material" value="C_MAmmoBrassParts"/>
+    <property name="Weight" value="1"/>
+    <property name="EconomicValue" value="0"/>
+    <property name="Stacknumber" value="1000"/>
+</item>
+<item name="C_resourceAmmoScrapLead">
+    <property name="Extends" value="partsMaster"/>
+    <property name="CustomIcon" value="resourceBuckshot"/>
+    <property name="Material" value="C_MAmmoLeadParts"/>
+    <property name="Weight" value="1"/>
+    <property name="EconomicValue" value="0"/>
+    <property name="Stacknumber" value="1000"/>
+</item>

□ recipes.xml

+<recipe name="resourceBulletTip" count="1" craft_area="workbench" tags="workbenchCrafting">
+    <ingredient name="C_resourceAmmoScrapBrass" count="1" />
+</recipe>
+<recipe name="resourceGunPowder" count="1" craft_area="workbench" tags="workbenchCrafting">
+    <ingredient name="C_resourceAmmoScrapBrass" count="1" />
+</recipe>
+<recipe name="resourceBulletCasing" count="1" craft_area="workbench" tags="workbenchCrafting">
+    <ingredient name="C_resourceAmmoScrapBrass" count="1" />
+</recipe>

+<recipe name="resourceBuckshot" count="1" craft_area="workbench" tags="workbenchCrafting">
+    <ingredient name="C_resourceAmmoScrapLead" count="1" />
+</recipe>
+<recipe name="resourceGunPowder" count="4" craft_area="workbench" tags="workbenchCrafting">
+    <ingredient name="C_resourceAmmoScrapLead" count="1" />
+</recipe>
+<recipe name="resourcePaper" count="1" craft_area="workbench" tags="workbenchCrafting">
+    <ingredient name="C_resourceAmmoScrapLead" count="1" />
+</recipe>

+<recipe name="C_resourceAmmoScrapBrass" count="1" tooltip="ttScrapMetalBrass" always_unlocked="true" tags="salvageScrap"> <wildcard_forge_category /> </recipe>
+<recipe name="C_resourceAmmoScrapLead" count="1" tooltip="ttScrapMetalBrass" always_unlocked="true" tags="salvageScrap"> <wildcard_forge_category /> </recipe>

□ materials.xml

+<material id="C_MAmmoBrassParts">
+    <property name="damage_category" value="metal" />
+    <property name="surface_category" value="metal" />
+    <property name="forge_category" value="C_resourceAmmoScrapBrass" />
+    <property name="Experience" value="2" />
+</material>

+<material id="C_MAmmoLeadParts">
+    <property name="damage_category" value="metal" />
+    <property name="surface_category" value="metal" />
+    <property name="forge_category" value="C_resourceAmmoScrapLead" />
+    <property name="Experience" value="2" />
+</material>

□ Localization.txt

+C_resourceAmmoScrapBrass,items,Item,,,"Scrapped Ammo",,,,,,スクラップ弾薬,,,,,,,,
+C_resourceAmmoScrapBrassDesc,items,Item,,,"Scrapped ammo in which brass is used. Can be crafted into gunpowder, bullet tips, or casings using workbench.",,,,,,真ちゅうが使われている弾薬をスクラップしたもの。火薬、弾頭、薬莢のいずれかにクラフトできる。作業台が必要。,,,,,,,,
+C_resourceAmmoScrapLead,items,Item,,,"Scrapped Shotgun Shell",,,,,,スクラップショットガンシェル,,,,,,,,
+C_resourceAmmoScrapLeadDesc,items,Item,,,"Scrapped shotgun shell. Can be crafted into gunpowder, buckshots, or papers using workbench.",,,,,,ショットガンシェルをスクラップしたもの。火薬、鹿玉、紙のいずれかにクラフトできる。作業台が必要。,,,,,,,,
Modsフォルダに入れて使う場合

□ フォルダ構成

(root)
├ Config/
│ ├ items.xml
│ ├ recipes.xml
│ ├ materials.xml
│ └ Localization.txt
├ UIAtlases/
│ └ ItemIconAtlas/
│   ├ C_resourceAmmoScrapBrass.png
│   └ C_resourceAmmoScrapLead.png
└ ModInfo.xml

ModInfo.xml

□ Config/items.xml

<modconfig>
    <set xpath="/items/item[@name='ammo9mmBulletBall']/property[@name='Material']/@value">C_MAmmoBrassParts</set>
    <append xpath="/items/item[@name='ammo9mmBulletBall']">
        <property name="Weight" value="1" />
    </append>

    <append xpath="/items/item[@name='ammo762mmBulletBall']">
        <property name="Weight" value="2" />
    </append>

    <set xpath="/items/item[@name='ammoShotgunShell']/property[@name='Material']/@value">C_MAmmoLeadParts</set>
    <append xpath="/items/item[@name='ammoShotgunShell']">
        <property name="Weight" value="1" />
    </append>

    <append xpath="/items">
        <item name="C_resourceAmmoScrapBrass">
            <property name="Extends" value="partsMaster"/>
            <property name="Material" value="C_MAmmoBrassParts"/>
            <property name="Weight" value="1"/>
            <property name="EconomicValue" value="0"/>
            <property name="Stacknumber" value="1000"/>
        </item>
        <item name="C_resourceAmmoScrapLead">
            <property name="Extends" value="partsMaster"/>
            <property name="Material" value="C_MAmmoLeadParts"/>
            <property name="Weight" value="1"/>
            <property name="EconomicValue" value="0"/>
            <property name="Stacknumber" value="1000"/>
        </item>
    </append>
</modconfig>

□ Config/recipes.xml

<modconfig>
    <append xpath="/recipes">
        <recipe name="resourceBulletTip" count="1" craft_area="workbench" tags="workbenchCrafting">
            <ingredient name="C_resourceAmmoScrapBrass" count="1" />
        </recipe>
        <recipe name="resourceGunPowder" count="1" craft_area="workbench" tags="workbenchCrafting">
            <ingredient name="C_resourceAmmoScrapBrass" count="1" />
        </recipe>
        <recipe name="resourceBulletCasing" count="1" craft_area="workbench" tags="workbenchCrafting">
            <ingredient name="C_resourceAmmoScrapBrass" count="1" />
        </recipe>

        <recipe name="resourceBuckshot" count="1" craft_area="workbench" tags="workbenchCrafting">
            <ingredient name="C_resourceAmmoScrapLead" count="1" />
        </recipe>
        <recipe name="resourceGunPowder" count="4" craft_area="workbench" tags="workbenchCrafting">
            <ingredient name="C_resourceAmmoScrapLead" count="1" />
        </recipe>
        <recipe name="resourcePaper" count="1" craft_area="workbench" tags="workbenchCrafting">
            <ingredient name="C_resourceAmmoScrapLead" count="1" />
        </recipe>

        <recipe name="C_resourceAmmoScrapBrass" count="1" tooltip="ttScrapMetalBrass" always_unlocked="true" tags="salvageScrap"> <wildcard_forge_category /> </recipe>
        <recipe name="C_resourceAmmoScrapLead" count="1" tooltip="ttScrapMetalBrass" always_unlocked="true" tags="salvageScrap"> <wildcard_forge_category /> </recipe>
    </append>
</modconfig>

□ Config/materials.xml

<modconfig>
    <append xpath="/materials">
        <material id="C_MAmmoBrassParts">
            <property name="damage_category" value="metal" />
            <property name="surface_category" value="metal" />
            <property name="forge_category" value="C_resourceAmmoScrapBrass" />
            <property name="Experience" value="2" />
        </material>

        <material id="C_MAmmoLeadParts">
            <property name="damage_category" value="metal" />
            <property name="surface_category" value="metal" />
            <property name="forge_category" value="C_resourceAmmoScrapLead" />
            <property name="Experience" value="2" />
        </material>
    </append>
</modconfig>

□ Config/Localization.txt

Key,File,Type,UsedInMainMenu,english,japanese
C_resourceAmmoScrapBrass,items,Item,,"Scrapped Ammo",スクラップ弾薬
C_resourceAmmoScrapBrassDesc,items,Item,,"Scrapped ammo in which brass is used. Can be crafted into gunpowder, bullet tips, or casings using workbench.",真ちゅうが使われている弾薬をスクラップしたもの。火薬、弾頭、薬莢のいずれかにクラフトできる。作業台が必要。
C_resourceAmmoScrapLead,items,Item,,"Scrapped Shotgun Shell",スクラップショットガンシェル
C_resourceAmmoScrapLeadDesc,items,Item,,"Scrapped shotgun shell. Can be crafted into gunpowder, buckshots, or papers using workbench.",ショットガンシェルをスクラップしたもの。火薬、鹿玉、紙のいずれかにクラフトできる。作業台が必要。

□ UIAtlases/ItemIconAtlas

アイテムアイコンの例:
□ C_resourceAmmoScrapBrass.png
C_resourceAmmoScrapBrass.png

□ C_resourceAmmoScrapLead.png
C_resourceAmmoScrapLead.png