From 20daeebead5bc13a96a2dd323b5b66775d97920b Mon Sep 17 00:00:00 2001 From: MinetestSam <42088654+MinetestSam@users.noreply.github.com> Date: Wed, 12 Dec 2018 23:27:34 +0530 Subject: [PATCH] Add traps --- mods/ctf/ctf_crafting/depends.txt | 1 + mods/ctf/ctf_crafting/init.lua | 40 ++++++++++ mods/ctf/ctf_map/maps | 2 +- mods/ctf/ctf_traps/depends.txt | 2 + mods/ctf/ctf_traps/description.txt | 1 + mods/ctf/ctf_traps/init.lua | 71 ++++++++++++++++++ .../ctf_traps/textures/ctf_traps_cobble.png | Bin 0 -> 697 bytes .../textures/ctf_traps_damage_cobble.png | Bin 0 -> 687 bytes .../ctf/ctf_traps/textures/ctf_traps_dirt.png | Bin 0 -> 823 bytes .../ctf_traps/textures/ctf_traps_spike.png | Bin 0 -> 353 bytes .../ctf_traps/textures/ctf_traps_stone.png | Bin 0 -> 507 bytes 11 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 mods/ctf/ctf_traps/depends.txt create mode 100644 mods/ctf/ctf_traps/description.txt create mode 100644 mods/ctf/ctf_traps/init.lua create mode 100644 mods/ctf/ctf_traps/textures/ctf_traps_cobble.png create mode 100644 mods/ctf/ctf_traps/textures/ctf_traps_damage_cobble.png create mode 100644 mods/ctf/ctf_traps/textures/ctf_traps_dirt.png create mode 100644 mods/ctf/ctf_traps/textures/ctf_traps_spike.png create mode 100644 mods/ctf/ctf_traps/textures/ctf_traps_stone.png diff --git a/mods/ctf/ctf_crafting/depends.txt b/mods/ctf/ctf_crafting/depends.txt index a4d3e42..4c94457 100644 --- a/mods/ctf/ctf_crafting/depends.txt +++ b/mods/ctf/ctf_crafting/depends.txt @@ -1 +1,2 @@ crafting +ctf_traps? diff --git a/mods/ctf/ctf_crafting/init.lua b/mods/ctf/ctf_crafting/init.lua index 380d684..e819d57 100644 --- a/mods/ctf/ctf_crafting/init.lua +++ b/mods/ctf/ctf_crafting/init.lua @@ -193,3 +193,43 @@ crafting.register_recipe({ always_known = true, level = 1, }) + +crafting.register_recipe({ + type = "inv", + output = "ctf_traps:spike 1", + items = { "default:steel_ingot 5" }, + always_known = true, + level = 1, +}) + +crafting.register_recipe({ + type = "inv", + output = "ctf_traps:dirt 1", + items = { "default:dirt 5", "default:coal_lump" }, + always_known = true, + level = 1, +}) + +crafting.register_recipe({ + type = "inv", + output = "ctf_traps:cobble 1", + items = { "default:cobble 5", "default:coal_lump" }, + always_known = true, + level = 1, +}) + +crafting.register_recipe({ + type = "inv", + output = "ctf_traps:stone 1", + items = { "default:stone 5", "default:coal_lump" }, + always_known = true, + level = 1, +}) + +crafting.register_recipe({ + type = "inv", + output = "ctf_traps:damage_cobble 1", + items = { "default:cobble", "default:coal_lump 4", "default:steel_ingot 4" }, + always_known = true, + level = 1, +}) diff --git a/mods/ctf/ctf_map/maps b/mods/ctf/ctf_map/maps index 99bac96..9e25819 160000 --- a/mods/ctf/ctf_map/maps +++ b/mods/ctf/ctf_map/maps @@ -1 +1 @@ -Subproject commit 99bac967d656014ee44201936e4c1884a21f3ada +Subproject commit 9e2581925aed31e5572507a0aba8120c18f41fa0 diff --git a/mods/ctf/ctf_traps/depends.txt b/mods/ctf/ctf_traps/depends.txt new file mode 100644 index 0000000..45c82f2 --- /dev/null +++ b/mods/ctf/ctf_traps/depends.txt @@ -0,0 +1,2 @@ +default +ctf diff --git a/mods/ctf/ctf_traps/description.txt b/mods/ctf/ctf_traps/description.txt new file mode 100644 index 0000000..3fccf0e --- /dev/null +++ b/mods/ctf/ctf_traps/description.txt @@ -0,0 +1 @@ +Adds various traps for CTF. Ghost nodes like stone, dirt and cobblestone. The mod also adds spikes and fake cobble diff --git a/mods/ctf/ctf_traps/init.lua b/mods/ctf/ctf_traps/init.lua new file mode 100644 index 0000000..b5c7e65 --- /dev/null +++ b/mods/ctf/ctf_traps/init.lua @@ -0,0 +1,71 @@ +minetest.register_node("ctf_traps:dirt", { + description = "Unwalkable Dirt", + tiles = {"ctf_traps_dirt.png"}, + is_ground_content = false, + walkable = false, + groups = {crumbly=3, soil=1} +}) + +minetest.register_node("ctf_traps:stone", { + description = "Unwalkable Stone", + tiles = {"ctf_traps_stone.png"}, + is_ground_content = false, + walkable = false, + groups = {cracky=3, stone=1} +}) + +minetest.register_node("ctf_traps:cobble", { + description = "Unwalkable Cobblestone", + tiles = {"ctf_traps_cobble.png"}, + is_ground_content = false, + walkable = false, + groups = {cracky=3, stone=2} +}) + +minetest.register_node("ctf_traps:spike", { + description = "Spike", + drawtype = "plantlike", + tiles = {"ctf_traps_spike.png"}, + inventory_image = "ctf_traps_spike.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + damage_per_second = 5, + groups = {cracky=1, level=2}, + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + }, +}) + +minetest.register_node("ctf_traps:damage_cobble", { + description = "Cobblestone that damages digger of enemy team", + tiles = {"ctf_traps_damage_cobble.png"}, + is_ground_content = false, + walkable = true, + groups = {cracky=3, stone=2}, + on_dig = function(pos, node, digger) + local name = digger:get_player_name() + if not digger then + return + end + + local digger_team = ctf.player(name).team + local meta = minetest.get_meta(pos) + local placer_team = meta:get_string("placer") or "missing" + if digger_team ~= placer_team then + local hp = digger:get_hp() + digger:set_hp(hp - 7) + minetest.remove_node(pos) + return + end + + meta:set_string("placer", "") + return minetest.node_dig(pos, node, digger) + end, + after_place_node = function(pos, placer, itemstack, pointed_thing) + local meta = minetest.get_meta(pos) + local name = placer:get_player_name() + meta:set_string("placer", ctf.player(name).team) + end +}) diff --git a/mods/ctf/ctf_traps/textures/ctf_traps_cobble.png b/mods/ctf/ctf_traps/textures/ctf_traps_cobble.png new file mode 100644 index 0000000000000000000000000000000000000000..7b1b1dd9c7de250c2aad4135c202878c669b276f GIT binary patch literal 697 zcmV;q0!ICbP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02p*dSaefwW^{L9 za%BK;VQFr3E^cLXAT%y9E;VFFSW*B00xC&FK~y+TO_S?R+dvS7_cEG_8*Y7B`X_Q+xQarR-{{Tt2ioneYE`=0j6q<@Aj3g+FhQ(g9kQ&6DZNx!p(DV1Q!f{lQ zKACe0#!S|Kttlps^;{z@p?$Zc*DV>PnE-S4Pci4toUPHAwTiud{d|nyKh7i?*DDBH z#cTo++JpwgCYAY(tth@sqC-pvyO@qju&or$AWE*WvCN_7SgbH-utMNULv+F9~ccNqQD4=?&^zFyVP^nMTV%`+L!;R fp#e8`Za453%j)cmZLpg200000NkvXXu0mjfsUb8~ literal 0 HcmV?d00001 diff --git a/mods/ctf/ctf_traps/textures/ctf_traps_damage_cobble.png b/mods/ctf/ctf_traps/textures/ctf_traps_damage_cobble.png new file mode 100644 index 0000000000000000000000000000000000000000..2823c5a0d7114369c8a1fa1c57126a4a3fd1f020 GIT binary patch literal 687 zcmV;g0#N;lP)2N76o!9~w`_Han{)xBHlR?oK(7EHBrXvTfVkj}3qU+#E7Y6v1}#!mAWd5eqE716 zS-m6<`cH61vS&P=vwi0u?enJ((}&}vW&%YS=Q0UI+m+dc&!%7j)U;<2;=+r zu;jW3f&l8Y0ex#5D(G~ebOjC?-vj|B(-ir94(Asa&~+WQZ9^FfaTLiO&!^)QwADVo zd@-dlH+Ts3I@044_|*z3l_hZ;#|eza>FmGk%+7OZSlbV=wzewUKX>=g^E+6WrtMviw6ES8YmPBFj}4`3`mr4sD;AiZ`l9o(*Zl7Oar6QNCb9Mt%|^?4TClNRHIUm zep66en<$qSFbqT5qjq~u=45vd?KDNsw#6B8DBr?^=LCSm_$6=q*Y@W^KUiLhg zCKW?#HR}T5WIZQ?Ohi$!C=SMx2`pWSAumwI?0kP8iZ?Jh`i3wJB~tD6E0mu;kpPqN zSjwYT*oAm~L%P5ln(0M*_x8;+P73;Xv!G@8SsnulHau5LV!1@!C?RZ002ovPDHLkV1m2JIBEa@ literal 0 HcmV?d00001 diff --git a/mods/ctf/ctf_traps/textures/ctf_traps_dirt.png b/mods/ctf/ctf_traps/textures/ctf_traps_dirt.png new file mode 100644 index 0000000000000000000000000000000000000000..0b2e7f9e1cbfdc88bfcca4d59cf6193abe467ebd GIT binary patch literal 823 zcmV-71IYY|P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02p*dSaefwW^{L9 za%BK;VQFr3E^cLXAT%y9E;VFFSW*B00;owuK~y+THB;GA8c`G+9}1*7T!x)wpakl9~GvUFn z(-r)vuArCof(PThARa4AFj`3$YHK$1(tZJ&!~K3x z4|Osg+4Esg^x^qv8SS)*LDq*>(vEJ%fxFL(7;Jf9G!stLV@?bT0X=+~v7?o;q7k1) z?V}C%2TS;K9z`?mkbfrXpI)P}IVA*6J!`a5Ga}E4)3qsdb1rlXv*?%JDp(^Stnz%Q zEMl}1Ky}rS;%QM~LoN0SC+h}`Ufx7)!-96ojoWfSHYcQSpD>5e&n+kbrS=Pc-0aMO z=SgsxcPfxU)=p*?qivB|k7B$#kLTkEzV1tp`FXUH4qR_bYgxB=;}sxNjV1f@aTo@X z$vh~CS+c>tc<@S!+G6BmC87WXYNltDwU>9R3L0*-Q!ZS@t#~?$yhu|3A5K;$P>;X7 zvw#Y^xmh*vB5pyiD2fEwp!;lrbER2iyV+R~Kv9!5aglO}u_hYH8C7r=n^d3pt^f?r zXeX%BzWr-~j?+Z8#dfM|;=TZol?D^wJZ8~<1_RVg(8PKDK?TF2U(E8VY!=Wodi5lM z;%cXDnods0Xl$Aq;itoQTFlf@5ka~+j}~(=LN2_CH{}1AKp|EK3p-9FdGo+$J(TVBxqN!DY&i#)ehpa@6ek;UKK+ z9ARzajd+j^XpHGRiz)Hvm-h-#{a}&rFm88)IzqCK%S)m%tW!H(pM=3HOC#_0LR#G6 z-B`Cv3u2-u7#2h5q}}TJ_4b_J$VS|$k#40;`~{wP!@z}1rAq(+002ovPDHLkV1m`u BZoB{h literal 0 HcmV?d00001 diff --git a/mods/ctf/ctf_traps/textures/ctf_traps_spike.png b/mods/ctf/ctf_traps/textures/ctf_traps_spike.png new file mode 100644 index 0000000000000000000000000000000000000000..c07e0165f84474f6d968f745770d9a98a7cfb1b8 GIT binary patch literal 353 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmSN`?>!lvI6;>1s;*b z3=G_YAk0{w5<>&kwgO_oJPbmr#Enm{3m64!{5;QX|b^2DN4hJwV*yb`^< z)Di^~JwrXy6!!>_WoJBH978Pp=T7wII^@997Cm2D)WyYop7$M&dntO#_Z+W3GQA@G zBSN&~jJ#0pWh+_TKQ*3eCsQsRvApj2Lb+`3_XMrF%LN*9IM@|>_610PWV|SC)^ckD z>!BH(U(=#9EQLO~7%V$YZD=Gc!i6srTwl=B0r{H>=Zq-Ve+AaiJKp&%5L|5mbqQ)$1azzf$fKk tUpiGyFuK%RV!CT`!8etk{daz_zM7WwU0!+8bD+N%JYD@<);T3K0RS*Hg&_a{ literal 0 HcmV?d00001 diff --git a/mods/ctf/ctf_traps/textures/ctf_traps_stone.png b/mods/ctf/ctf_traps/textures/ctf_traps_stone.png new file mode 100644 index 0000000000000000000000000000000000000000..213ff69ffff77681071d2280aa169c48cfd6f9c5 GIT binary patch literal 507 zcmVPx#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02p*dSaefwW^{L9 za%BK;VQFr3E^cLXAT%y9E;VFFSW*B00c=S`K~y+TbyC|-!axw+zcD5nAR-_!4T&0W zNC2TlXiH1W#i(E+i4T7K$eDVYrNM`jHnVdsGrMLMH03p}$s)XzWPGKFN6sGHZcQSu zwO5PAErr=EZ)E%CsK7`1Aj|Mt-jjCTh<_WXp^q?b=R_vMBN-3R#p^W{Bo{^K%055^ zW`0EzumL2*CJqsS=clq5I76VAfN@Fw4+hR$B8!a9IltF^1^#)?kyPMN0=l!-d#osm zqwU=S3ILsLcP6kGiYw1XNE(v*^<25%F3F&CtY0h&2`FyIhoDJuQl6|&pl7T zxY&gX{4Mo!l{GQ}i8gSiw}5xRYn-@e*}DiFZK4xk-v*!paOMbeza?pSA@gZnM=3f| x5JbWZyQld>!qW6cb|Ud4OF)thlD%G2egWx2`g_jewkH4p002ovPDHLkV1g~U&Itej literal 0 HcmV?d00001