From 19f5864d67c5af8382b79d185a257c0e6863d296 Mon Sep 17 00:00:00 2001 From: upsilon Date: Tue, 17 Jan 2017 19:05:57 +0100 Subject: [PATCH] Add a drop arrow --- registration.lua | 21 +++++++++++++++++++++ textures/throwing_arrow_drop.png | Bin 0 -> 210 bytes textures/throwing_arrow_drop_2.png | Bin 0 -> 207 bytes textures/throwing_arrow_drop_back.png | Bin 0 -> 216 bytes textures/throwing_arrow_drop_front.png | Bin 0 -> 178 bytes 5 files changed, 21 insertions(+) create mode 100644 textures/throwing_arrow_drop.png create mode 100644 textures/throwing_arrow_drop_2.png create mode 100644 textures/throwing_arrow_drop_back.png create mode 100644 textures/throwing_arrow_drop_front.png diff --git a/registration.lua b/registration.lua index 346a9f7..c96cefe 100644 --- a/registration.lua +++ b/registration.lua @@ -156,3 +156,24 @@ if get_setting("build_arrow") then end }) end + +if get_setting("drop_arrow") then + throwing.register_arrow("arrow_drop", { + itemcraft = "default:copper_ingot", + craft_quantity = 16, + description = "Drop Arrow", + tiles = {"throwing_arrow_drop.png", "throwing_arrow_drop.png", "throwing_arrow_drop_back.png", "throwing_arrow_drop_front.png", "throwing_arrow_drop_2.png", "throwing_arrow_drop.png"}, + on_hit_sound = "throwing_build_arrow", + on_throw = function(_, thrower, next_index, data) + data.itemstack = thrower:get_inventory():get_stack("main", next_index) + data.index = next_index + thrower:get_inventory():set_stack("main", next_index, nil) + end, + on_hit = function(_, last_pos, _, _, hitter, data) + minetest.item_drop(ItemStack(data.itemstack), hitter, last_pos) + end, + on_hit_fails = function(_, thrower, data) + thrower:get_inventory():set_stack("main", data.index, data.itemstack) + end + }) +end diff --git a/textures/throwing_arrow_drop.png b/textures/throwing_arrow_drop.png new file mode 100644 index 0000000000000000000000000000000000000000..b20c03ba6cefe629b535b801f2101afa7315543b GIT binary patch literal 210 zcmeAS@N?(olHy`uVBq!ia0vp^f*{Pn1|+R>-G2cowj^(N7l!{JxM1({$v_d#0*}aI z1_o|n5N2eUHAey{$X?><>&pI+QBY7?s&{8Y7EmbO)5S5w;&gI?1Z%T!&b>W9?b{w~ zfBNyir)dN0>}LY0X-#Z5pM5pd(cwq{gM(?C4cL_(!((QL@`N8hBD!bP0l+XkK+dD%` literal 0 HcmV?d00001 diff --git a/textures/throwing_arrow_drop_2.png b/textures/throwing_arrow_drop_2.png new file mode 100644 index 0000000000000000000000000000000000000000..3ebe136f7acf5d8ffc75d04c2cca7b06ce2c9426 GIT binary patch literal 207 zcmeAS@N?(olHy`uVBq!ia0vp^f*{Pn1|+R>-G2cowj^(N7l!{JxM1({$v_d#0*}aI z1_o|n5N2eUHAey{$X?><>&pI+QBY7u?&#D@TYy3_o-U3d7N?UFBv`jF&Nk2g=U?8u zPq+Vg!08hQ4jd3zbmq@}v-SNCKP*vdYSYQ;Y}~w4N!;iVujlnN#apU>O)p9$>F@wS ue*K?xg=?xO7@i5OYT^8vlr9n=&%m&fS=q64zwI@kJq(_%elF{r5}E+QNke=9 literal 0 HcmV?d00001 diff --git a/textures/throwing_arrow_drop_back.png b/textures/throwing_arrow_drop_back.png new file mode 100644 index 0000000000000000000000000000000000000000..3657dc589bfd356b3eab0aaeeab2aa318fda1d23 GIT binary patch literal 216 zcmeAS@N?(olHy`uVBq!ia0vp^f*{Pn1|+R>-G2cowj^(N7l!{JxM1({$v_d#0*}aI z1_o|n5N2eUHAey{$X?><>&pI+QBY7$?)%~mWiV<4q5Yp4^?gm`6Rn=+Mt+Jnn_N=4b`_@H+o{ z{H1R~muZ)HOUN2Y35j literal 0 HcmV?d00001 diff --git a/textures/throwing_arrow_drop_front.png b/textures/throwing_arrow_drop_front.png new file mode 100644 index 0000000000000000000000000000000000000000..0cba11df9b6c31644fb34b9ca182da3ae05b3aa9 GIT binary patch literal 178 zcmeAS@N?(olHy`uVBq!ia0vp^f*{Pn1|+R>-G2cowj^(N7l!{JxM1({$v_d#0*}aI z1_o|n5N2eUHAey{$X?><>&pI+QBY7`>EQLhAAmyko-U3d7N?UF7RVSF8TK$OI5UTtY>^lr;M#v@&8OV?>9Vh1|3EU%8Yi`G+f0Q7>;Zf{8yLy R^*zui22WQ%mvv4FO#t7YH6#E4 literal 0 HcmV?d00001