From 2d38b12399a2d88f748ff6f203189d70742b4255 Mon Sep 17 00:00:00 2001
From: jc_gargma <jc_gargma@iserlohn-fortress.net>
Date: Tue, 13 Aug 2024 14:02:17 -0700
Subject: Add patch fixing triffid queens digging into the center of the Earth.

---
 PKGBUILD                            | 16 +++++++++++++---
 src-19_triffids-do-not-burrow.patch | 17 +++++++++++++++++
 src-20_fix-default-mods.patch       | 26 --------------------------
 src-99_fix-default-mods.patch       | 26 ++++++++++++++++++++++++++
 4 files changed, 56 insertions(+), 29 deletions(-)
 create mode 100644 src-19_triffids-do-not-burrow.patch
 delete mode 100644 src-20_fix-default-mods.patch
 create mode 100644 src-99_fix-default-mods.patch

diff --git a/PKGBUILD b/PKGBUILD
index 3841a8e..43a8b7d 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -18,7 +18,7 @@ _pkgname=Cataclysm-BN
 pkgver=0.6.0
 #pkgver=202310040030
 #_pkgver=2023-10-04-0030
-pkgrel=8
+pkgrel=9
 pkgdesc="A post-apocalyptic roguelike."
 #url="http://cataclysmrl.blogspot.com/"
 #url="http://www.cataclysm.glyphgryph.com/"
@@ -164,7 +164,9 @@ source=("$pkgname-$pkgver.tar.gz::https://github.com/cataclysmbnteam/Cataclysm-B
         "src-15_slow-down-fungal-blossoms.patch"
         "src-16_npcs-not-wielding-from-worn-holsters.patch"
         "src-17_monsters-can-go-down-ramps.patch"
-        "src-20_fix-default-mods.patch"
+        #"src-18-v7_monsters-can-go-up-stairs.patch"
+        "src-19_triffids-do-not-burrow.patch"
+        "src-99_fix-default-mods.patch"
         
         "vampirism.patch"
         )
@@ -278,6 +280,7 @@ b2sums=('1a311f72d159194d8737b75a484d015caf75a1920b1e9eaa0bdbcd9c0bb8aceda1f59a5
         'c22a81615cd95c01c8722f4be7866f58f488890e518cd74e80f14d65fa3e9889b20666c729cfb317bb55e498d70e13c86b7ba3a61299f667820d4277b2c69c4e'
         'b71e033258390937f0c82820ef960c0d3006fdc46182c9d0576c1d9314ff2f672168e259a33eee61b5d0be33eb8ebaf95f59ed76b971a80bc5cb68143b6b7368'
         '5724d2bf6a163c7d4f4d1f3496550ce522c1cf980e0504fed67cd09d821a00115da94659ded9a3acdb0f0263c799733004c44d778cba8fdeafc6792c8a64ba97'
+        '7fa5c97ffcc890baf991099e9b7a8b40821a50cb40a50502e7264a35892468536a222b34506b40a8151322af18ba19702cb6cb20c571b87ad7a6577aefe4ab6a'
         '5c605faf9fd815e39427722bf6f953cebbe77945e82b7415b7fecfba51978788298fac179ab0b26d28fc948679356f34dc2c475361c82d0149f9a9be04192ff1'
         '978657c7b665b57acc5bffcafff55d289775c47bb7c45b924e89c09571bafbe85c5a122c40d9a76add3719c09ad237525493ae08d5501c174fc96720339e59d3')
 
@@ -339,7 +342,7 @@ prepare() {
 
 
   # # Adjust default mods
-  patch -Np1 --no-backup-if-mismatch -i "$srcdir"/src-20_fix-default-mods.patch
+  patch -Np1 --no-backup-if-mismatch -i "$srcdir"/src-99_fix-default-mods.patch
 
 
   # # # Reverts
@@ -782,6 +785,13 @@ prepare() {
   # monster::can_reach_to lacked a clause for TFLAG_GOES_DOWN.
   patch -Np1 --no-backup-if-mismatch -i "$srcdir"/src-17_monsters-can-go-down-ramps.patch
 
+  # Fix monsters not travelling up stairs: (Still in testing)
+  #patch -Np1 --no-backup-if-mismatch -i "$srcdir"/src-18-v7_monsters-can-go-up-stairs.patch
+
+  # Fix triffid queens from destroying terrain and burrowing to the center of the Earth:
+  # The growplants function was destroying the terrain, not the furniture.
+  patch -Np1 --no-backup-if-mismatch -i "$srcdir"/src-19_triffids-do-not-burrow.patch
+
   # # # Additional changes
   echo "Applying vampirism patch"
   # Add vampire mutation lines and modify a number of functions to facilitate these traits.
diff --git a/src-19_triffids-do-not-burrow.patch b/src-19_triffids-do-not-burrow.patch
new file mode 100644
index 0000000..b7d422b
--- /dev/null
+++ b/src-19_triffids-do-not-burrow.patch
@@ -0,0 +1,17 @@
+--- a/src/monattack.cpp
++++ b/src/monattack.cpp
+@@ -1450,9 +1450,12 @@
+             continue;
+         }
+ 
++        // 1 in 3 chance to terraform diggable terrain
+         if( g->m.is_bashable( p ) && one_in( 3 ) ) {
+-            // Destroy everything
+-            g->m.destroy( p );
++            if( g->m.has_furn( p ) ) {
++                // Destroy any furniture
++                g->m.destroy_furn( p );
++            }
+             // And then make the ground fertile
+             g->m.ter_set( p, t_dirtmound );
+             continue;
diff --git a/src-20_fix-default-mods.patch b/src-20_fix-default-mods.patch
deleted file mode 100644
index 035e125..0000000
--- a/src-20_fix-default-mods.patch
+++ /dev/null
@@ -1,26 +0,0 @@
---- a/data/mods/default.json
-+++ b/data/mods/default.json
-@@ -1,8 +1,18 @@
- [
--  "bn",
--  "no_npc_food",
--  "novitamins",
-+  "bn",
-   "No_Rail_Stations",
--  "no_reviving_zombies",
--  "limit_fungal_growth"
-+  "bn_restore_crows_turrets",
-+  "martial_arts_update",
-+  "bn_restore_removed_traits",
-+  "bn_revert_handgun_damage_buff",
-+  "armor_rebalance",
-+  "recipe_fixes",
-+  "faction_camp_recipe_expansion",
-+  "packed_at4",
-+  "caseless_crafting",
-+  "grenade_crafting",
-+  "survivorheadgear_crafting",
-+  "hk_loadout",
-+  "m26_mass",
-+  "restore_reactor_core_expansion"
- ]
diff --git a/src-99_fix-default-mods.patch b/src-99_fix-default-mods.patch
new file mode 100644
index 0000000..035e125
--- /dev/null
+++ b/src-99_fix-default-mods.patch
@@ -0,0 +1,26 @@
+--- a/data/mods/default.json
++++ b/data/mods/default.json
+@@ -1,8 +1,18 @@
+ [
+-  "bn",
+-  "no_npc_food",
+-  "novitamins",
++  "bn",
+   "No_Rail_Stations",
+-  "no_reviving_zombies",
+-  "limit_fungal_growth"
++  "bn_restore_crows_turrets",
++  "martial_arts_update",
++  "bn_restore_removed_traits",
++  "bn_revert_handgun_damage_buff",
++  "armor_rebalance",
++  "recipe_fixes",
++  "faction_camp_recipe_expansion",
++  "packed_at4",
++  "caseless_crafting",
++  "grenade_crafting",
++  "survivorheadgear_crafting",
++  "hk_loadout",
++  "m26_mass",
++  "restore_reactor_core_expansion"
+ ]
-- 
cgit v1.2.1