weapons.lua 106 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047
  1. ---------------------bows--------------------
  2. minetest.register_tool("minerdream:bow_copper", {
  3. description = "".. core.colorize("#BFFFFF", "Copper bow\n")..core.colorize("#A0A0A0", "tier: 2 (uncommon)\n")..core.colorize("#A0A0A0", "projectile speed: 15\n")..core.colorize("#A0A0A0", "projectile gravity: 10\n")..core.colorize("#A0A0A0", "ranged damage: 2\n")..core.colorize("#A0A0A0", "ammo: arrows"),
  4. inventory_image = "minerdream_bow_copper.png",
  5. wield_scale = {x=0.9,y=0.9,z=0.9},
  6. on_use = function(itemstack, user, pointed_thing)
  7. local inv = user:get_inventory()
  8. if not inv:contains_item("main", "minerdream:arrow 1") then
  9. minetest.sound_play("", {object=user})
  10. return itemstack
  11. end
  12. if not minetest.setting_getbool("creative_mode") then
  13. inv:remove_item("main", "minerdream:arrow")
  14. end
  15. local pos = user:getpos()
  16. local dir = user:get_look_dir()
  17. local yaw = user:get_look_yaw()
  18. if pos and dir and yaw then
  19. pos.y = pos.y + 1.6
  20. local obj = minetest.add_entity(pos, "minerdream:copperarrow")
  21. if obj then
  22. minetest.sound_play("", {object=obj})
  23. obj:setvelocity({x=dir.x * 15, y=dir.y * 15, z=dir.z * 15})
  24. obj:setacceleration({x=dir.x * -10, y=-10, z=dir.z * -10})
  25. obj:setyaw(yaw + math.pi)
  26. local ent = obj:get_luaentity()
  27. if ent then
  28. ent.player = ent.player or user
  29. end
  30. end
  31. end
  32. return itemstack
  33. end,
  34. })
  35. local minerdream_copperarrow = {
  36. physical = false,
  37. timer = 0,
  38. visual = "wielditem",
  39. visual_size = {x=0.5, y=0.5,},
  40. textures = {'minerdream:shotarrow'},
  41. lastpos= {},
  42. collisionbox = {0, 0, 0, 0, 0, 0},
  43. }
  44. minerdream_copperarrow.on_step = function(self, dtime)
  45. self.timer = self.timer + dtime
  46. local pos = self.object:getpos()
  47. local node = minetest.get_node(pos)
  48. if self.timer > 0.2 then
  49. local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
  50. for k, obj in pairs(objs) do
  51. if obj:get_luaentity() ~= nil then
  52. if obj:get_luaentity().name ~= "minerdream:copperarrow" and obj:get_luaentity().name ~= "__builtin:item" then
  53. local damage = 2
  54. obj:punch(self.object, 1.0, {
  55. full_punch_interval = 1.0,
  56. damage_groups= {fleshy = damage},
  57. }, nil)
  58. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  59. self.object:remove()
  60. end
  61. else
  62. local damage = 2
  63. obj:punch(self.object, 1.0, {
  64. full_punch_interval = 1.0,
  65. damage_groups= {fleshy = damage},
  66. }, nil)
  67. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  68. self.object:remove()
  69. end
  70. end
  71. end
  72. if self.lastpos.x ~= nil then
  73. if minetest.registered_nodes[node.name].walkable then
  74. if not minetest.setting_getbool("creative_mode") then
  75. minetest.add_item(self.lastpos, "minerdream:arrow")
  76. end
  77. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  78. self.object:remove()
  79. end
  80. end
  81. self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
  82. end
  83. minetest.register_entity("minerdream:copperarrow", minerdream_copperarrow )
  84. minetest.register_tool("minerdream:bow_tin", {
  85. description = "".. core.colorize("#BFFFFF", "Tin bow\n")..core.colorize("#A0A0A0", "tier: 2 (uncommon)\n")..core.colorize("#A0A0A0", "projectile speed: 15\n")..core.colorize("#A0A0A0", "projectile gravity: 10\n")..core.colorize("#A0A0A0", "ranged damage: 2\n")..core.colorize("#A0A0A0", "ammo: arrows"),
  86. inventory_image = "minerdream_bow_tin.png",
  87. wield_scale = {x=0.9,y=0.9,z=0.9},
  88. on_use = function(itemstack, user, pointed_thing)
  89. local inv = user:get_inventory()
  90. if not inv:contains_item("main", "minerdream:arrow 1") then
  91. minetest.sound_play("", {object=user})
  92. return itemstack
  93. end
  94. if not minetest.setting_getbool("creative_mode") then
  95. inv:remove_item("main", "minerdream:arrow")
  96. end
  97. local pos = user:getpos()
  98. local dir = user:get_look_dir()
  99. local yaw = user:get_look_yaw()
  100. if pos and dir and yaw then
  101. pos.y = pos.y + 1.6
  102. local obj = minetest.add_entity(pos, "minerdream:tinarrow")
  103. if obj then
  104. minetest.sound_play("", {object=obj})
  105. obj:setvelocity({x=dir.x * 15, y=dir.y * 15, z=dir.z * 15})
  106. obj:setacceleration({x=dir.x * -10, y=-10, z=dir.z * -10})
  107. obj:setyaw(yaw + math.pi)
  108. local ent = obj:get_luaentity()
  109. if ent then
  110. ent.player = ent.player or user
  111. end
  112. end
  113. end
  114. return itemstack
  115. end,
  116. })
  117. local minerdream_tinarrow = {
  118. physical = false,
  119. timer = 0,
  120. visual = "wielditem",
  121. visual_size = {x=0.5, y=0.5,},
  122. textures = {'minerdream:shotarrow'},
  123. lastpos= {},
  124. collisionbox = {0, 0, 0, 0, 0, 0},
  125. }
  126. minerdream_tinarrow.on_step = function(self, dtime)
  127. self.timer = self.timer + dtime
  128. local pos = self.object:getpos()
  129. local node = minetest.get_node(pos)
  130. if self.timer > 0.2 then
  131. local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
  132. for k, obj in pairs(objs) do
  133. if obj:get_luaentity() ~= nil then
  134. if obj:get_luaentity().name ~= "minerdream:tinarrow" and obj:get_luaentity().name ~= "__builtin:item" then
  135. local damage = 2
  136. obj:punch(self.object, 1.0, {
  137. full_punch_interval = 1.0,
  138. damage_groups= {fleshy = damage},
  139. }, nil)
  140. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  141. self.object:remove()
  142. end
  143. else
  144. local damage = 2
  145. obj:punch(self.object, 1.0, {
  146. full_punch_interval = 1.0,
  147. damage_groups= {fleshy = damage},
  148. }, nil)
  149. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  150. self.object:remove()
  151. end
  152. end
  153. end
  154. if self.lastpos.x ~= nil then
  155. if minetest.registered_nodes[node.name].walkable then
  156. if not minetest.setting_getbool("creative_mode") then
  157. minetest.add_item(self.lastpos, "minerdream:arrow")
  158. end
  159. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  160. self.object:remove()
  161. end
  162. end
  163. self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
  164. end
  165. minetest.register_entity("minerdream:tinarrow", minerdream_tinarrow )
  166. minetest.register_tool("minerdream:bow_bronze", {
  167. description = "".. core.colorize("#BFFFFF", "Bronze bow\n")..core.colorize("#A0A0A0", "tier: 2 (uncommon)\n")..core.colorize("#A0A0A0", "projectile speed: 16\n")..core.colorize("#A0A0A0", "projectile gravity: 9.75\n")..core.colorize("#A0A0A0", "ranged damage: 2.5\n")..core.colorize("#A0A0A0", "ammo: arrows"),
  168. inventory_image = "minerdream_bow_bronze.png",
  169. wield_scale = {x=0.95,y=0.95,z=0.95},
  170. on_use = function(itemstack, user, pointed_thing)
  171. local inv = user:get_inventory()
  172. if not inv:contains_item("main", "minerdream:arrow 1") then
  173. minetest.sound_play("", {object=user})
  174. return itemstack
  175. end
  176. if not minetest.setting_getbool("creative_mode") then
  177. inv:remove_item("main", "minerdream:arrow")
  178. end
  179. local pos = user:getpos()
  180. local dir = user:get_look_dir()
  181. local yaw = user:get_look_yaw()
  182. if pos and dir and yaw then
  183. pos.y = pos.y + 1.6
  184. local obj = minetest.add_entity(pos, "minerdream:bronzearrow")
  185. if obj then
  186. minetest.sound_play("", {object=obj})
  187. obj:setvelocity({x=dir.x * 16, y=dir.y * 16, z=dir.z * 16})
  188. obj:setacceleration({x=dir.x * -9.75, y=-9.75, z=dir.z * -9.75})
  189. obj:setyaw(yaw + math.pi)
  190. local ent = obj:get_luaentity()
  191. if ent then
  192. ent.player = ent.player or user
  193. end
  194. end
  195. end
  196. return itemstack
  197. end,
  198. })
  199. local minerdream_bronzearrow = {
  200. physical = false,
  201. timer = 0,
  202. visual = "wielditem",
  203. visual_size = {x=0.5, y=0.5,},
  204. textures = {'minerdream:shotarrow'},
  205. lastpos= {},
  206. collisionbox = {0, 0, 0, 0, 0, 0},
  207. }
  208. minerdream_bronzearrow.on_step = function(self, dtime)
  209. self.timer = self.timer + dtime
  210. local pos = self.object:getpos()
  211. local node = minetest.get_node(pos)
  212. if self.timer > 0.195 then
  213. local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
  214. for k, obj in pairs(objs) do
  215. if obj:get_luaentity() ~= nil then
  216. if obj:get_luaentity().name ~= "minerdream:bronzearrow" and obj:get_luaentity().name ~= "__builtin:item" then
  217. local damage = 2.5
  218. obj:punch(self.object, 1.0, {
  219. full_punch_interval = 1.0,
  220. damage_groups= {fleshy = damage},
  221. }, nil)
  222. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  223. self.object:remove()
  224. end
  225. else
  226. local damage = 2.5
  227. obj:punch(self.object, 1.0, {
  228. full_punch_interval = 1.0,
  229. damage_groups= {fleshy = damage},
  230. }, nil)
  231. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  232. self.object:remove()
  233. end
  234. end
  235. end
  236. if self.lastpos.x ~= nil then
  237. if minetest.registered_nodes[node.name].walkable then
  238. if not minetest.setting_getbool("creative_mode") then
  239. minetest.add_item(self.lastpos, "minerdream:arrow")
  240. end
  241. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  242. self.object:remove()
  243. end
  244. end
  245. self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
  246. end
  247. minetest.register_entity("minerdream:bronzearrow", minerdream_bronzearrow )
  248. minetest.register_tool("minerdream:bow_steel", {
  249. description = "".. core.colorize("#BFFFFF", "Steel bow\n")..core.colorize("#A0A0A0", "tier: 2 (uncommon)\n")..core.colorize("#A0A0A0", "projectile speed: 17\n")..core.colorize("#A0A0A0", "projectile gravity: 9.5\n")..core.colorize("#A0A0A0", "ranged damage: 3\n")..core.colorize("#A0A0A0", "ammo: arrows"),
  250. inventory_image = "minerdream_bow_steel.png",
  251. wield_scale = {x=1.0,y=1.0,z=1.0},
  252. on_use = function(itemstack, user, pointed_thing)
  253. local inv = user:get_inventory()
  254. if not inv:contains_item("main", "minerdream:arrow 1") then
  255. minetest.sound_play("", {object=user})
  256. return itemstack
  257. end
  258. if not minetest.setting_getbool("creative_mode") then
  259. inv:remove_item("main", "minerdream:arrow")
  260. end
  261. local pos = user:getpos()
  262. local dir = user:get_look_dir()
  263. local yaw = user:get_look_yaw()
  264. if pos and dir and yaw then
  265. pos.y = pos.y + 1.6
  266. local obj = minetest.add_entity(pos, "minerdream:steelarrow")
  267. if obj then
  268. minetest.sound_play("", {object=obj})
  269. obj:setvelocity({x=dir.x * 17, y=dir.y * 17, z=dir.z * 17})
  270. obj:setacceleration({x=dir.x * -9.5, y=-9.5, z=dir.z * -9.5})
  271. obj:setyaw(yaw + math.pi)
  272. local ent = obj:get_luaentity()
  273. if ent then
  274. ent.player = ent.player or user
  275. end
  276. end
  277. end
  278. return itemstack
  279. end,
  280. })
  281. local minerdream_steelarrow = {
  282. physical = false,
  283. timer = 0,
  284. visual = "wielditem",
  285. visual_size = {x=0.5, y=0.5,},
  286. textures = {'minerdream:shotarrow'},
  287. lastpos= {},
  288. collisionbox = {0, 0, 0, 0, 0, 0},
  289. }
  290. minerdream_steelarrow.on_step = function(self, dtime)
  291. self.timer = self.timer + dtime
  292. local pos = self.object:getpos()
  293. local node = minetest.get_node(pos)
  294. if self.timer > 0.190 then
  295. local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
  296. for k, obj in pairs(objs) do
  297. if obj:get_luaentity() ~= nil then
  298. if obj:get_luaentity().name ~= "minerdream:steelarrow" and obj:get_luaentity().name ~= "__builtin:item" then
  299. local damage = 3
  300. obj:punch(self.object, 1.0, {
  301. full_punch_interval = 1.0,
  302. damage_groups= {fleshy = damage},
  303. }, nil)
  304. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  305. self.object:remove()
  306. end
  307. else
  308. local damage = 3
  309. obj:punch(self.object, 1.0, {
  310. full_punch_interval = 1.0,
  311. damage_groups= {fleshy = damage},
  312. }, nil)
  313. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  314. self.object:remove()
  315. end
  316. end
  317. end
  318. if self.lastpos.x ~= nil then
  319. if minetest.registered_nodes[node.name].walkable then
  320. if not minetest.setting_getbool("creative_mode") then
  321. minetest.add_item(self.lastpos, "minerdream:arrow")
  322. end
  323. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  324. self.object:remove()
  325. end
  326. end
  327. self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
  328. end
  329. minetest.register_entity("minerdream:steelarrow", minerdream_steelarrow )
  330. minetest.register_tool("minerdream:bow_stainlesssteel", {
  331. description = "".. core.colorize("#BFFFFF", "stainlesssteel bow\n")..core.colorize("#A0A0A0", "tier: 2 (uncommon)\n")..core.colorize("#A0A0A0", "projectile speed: 19\n")..core.colorize("#A0A0A0", "projectile gravity: 9.0\n")..core.colorize("#A0A0A0", "ranged damage: 3\n")..core.colorize("#A0A0A0", "ammo: arrows"),
  332. inventory_image = "minerdream_bow_stainlesssteel.png",
  333. wield_scale = {x=1.0,y=1.0,z=1.0},
  334. on_use = function(itemstack, user, pointed_thing)
  335. local inv = user:get_inventory()
  336. if not inv:contains_item("main", "minerdream:arrow 1") then
  337. minetest.sound_play("", {object=user})
  338. return itemstack
  339. end
  340. if not minetest.setting_getbool("creative_mode") then
  341. inv:remove_item("main", "minerdream:arrow")
  342. end
  343. local pos = user:getpos()
  344. local dir = user:get_look_dir()
  345. local yaw = user:get_look_yaw()
  346. if pos and dir and yaw then
  347. pos.y = pos.y + 1.6
  348. local obj = minetest.add_entity(pos, "minerdream:stainlesssteelarrow")
  349. if obj then
  350. minetest.sound_play("", {object=obj})
  351. obj:setvelocity({x=dir.x * 19, y=dir.y * 19, z=dir.z * 19})
  352. obj:setacceleration({x=dir.x * -9.0, y=-9.0, z=dir.z * -9.0})
  353. obj:setyaw(yaw + math.pi)
  354. local ent = obj:get_luaentity()
  355. if ent then
  356. ent.player = ent.player or user
  357. end
  358. end
  359. end
  360. return itemstack
  361. end,
  362. })
  363. local minerdream_stainlesssteelarrow = {
  364. physical = false,
  365. timer = 0,
  366. visual = "wielditem",
  367. visual_size = {x=0.5, y=0.5,},
  368. textures = {'minerdream:shotarrow'},
  369. lastpos= {},
  370. collisionbox = {0, 0, 0, 0, 0, 0},
  371. }
  372. minerdream_stainlesssteelarrow.on_step = function(self, dtime)
  373. self.timer = self.timer + dtime
  374. local pos = self.object:getpos()
  375. local node = minetest.get_node(pos)
  376. if self.timer > 0.185 then
  377. local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
  378. for k, obj in pairs(objs) do
  379. if obj:get_luaentity() ~= nil then
  380. if obj:get_luaentity().name ~= "minerdream:stainlesssteelarrow" and obj:get_luaentity().name ~= "__builtin:item" then
  381. local damage = 3
  382. obj:punch(self.object, 1.0, {
  383. full_punch_interval = 1.0,
  384. damage_groups= {fleshy = damage},
  385. }, nil)
  386. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  387. self.object:remove()
  388. end
  389. else
  390. local damage = 3
  391. obj:punch(self.object, 1.0, {
  392. full_punch_interval = 1.0,
  393. damage_groups= {fleshy = damage},
  394. }, nil)
  395. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  396. self.object:remove()
  397. end
  398. end
  399. end
  400. if self.lastpos.x ~= nil then
  401. if minetest.registered_nodes[node.name].walkable then
  402. if not minetest.setting_getbool("creative_mode") then
  403. minetest.add_item(self.lastpos, "minerdream:arrow")
  404. end
  405. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  406. self.object:remove()
  407. end
  408. end
  409. self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
  410. end
  411. minetest.register_entity("minerdream:stainlesssteelarrow", minerdream_stainlesssteelarrow )
  412. minetest.register_tool("minerdream:bow_nickel", {
  413. description = "".. core.colorize("#BFFFFF", "Nickel bow\n")..core.colorize("#A0A0A0", "tier: 2 (uncommon)\n")..core.colorize("#A0A0A0", "projectile speed: 18\n")..core.colorize("#A0A0A0", "projectile gravity: 9.25\n")..core.colorize("#A0A0A0", "ranged damage: 3.5\n")..core.colorize("#A0A0A0", "ammo: arrows"),
  414. inventory_image = "minerdream_bow_nickel.png",
  415. wield_scale = {x=1.05,y=1.05,z=1.05},
  416. on_use = function(itemstack, user, pointed_thing)
  417. local inv = user:get_inventory()
  418. if not inv:contains_item("main", "minerdream:arrow 1") then
  419. minetest.sound_play("", {object=user})
  420. return itemstack
  421. end
  422. if not minetest.setting_getbool("creative_mode") then
  423. inv:remove_item("main", "minerdream:arrow")
  424. end
  425. local pos = user:getpos()
  426. local dir = user:get_look_dir()
  427. local yaw = user:get_look_yaw()
  428. if pos and dir and yaw then
  429. pos.y = pos.y + 1.6
  430. local obj = minetest.add_entity(pos, "minerdream:nickelarrow")
  431. if obj then
  432. minetest.sound_play("", {object=obj})
  433. obj:setvelocity({x=dir.x * 18, y=dir.y * 18, z=dir.z * 18})
  434. obj:setacceleration({x=dir.x * -9.25, y=-9.25, z=dir.z * -9.25})
  435. obj:setyaw(yaw + math.pi)
  436. local ent = obj:get_luaentity()
  437. if ent then
  438. ent.player = ent.player or user
  439. end
  440. end
  441. end
  442. return itemstack
  443. end,
  444. })
  445. local minerdream_nickelarrow = {
  446. physical = false,
  447. timer = 0,
  448. visual = "wielditem",
  449. visual_size = {x=0.5, y=0.5,},
  450. textures = {'minerdream:shotarrow'},
  451. lastpos= {},
  452. collisionbox = {0, 0, 0, 0, 0, 0},
  453. }
  454. minerdream_nickelarrow.on_step = function(self, dtime)
  455. self.timer = self.timer + dtime
  456. local pos = self.object:getpos()
  457. local node = minetest.get_node(pos)
  458. if self.timer > 0.185 then
  459. local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
  460. for k, obj in pairs(objs) do
  461. if obj:get_luaentity() ~= nil then
  462. if obj:get_luaentity().name ~= "minerdream:nickelarrow" and obj:get_luaentity().name ~= "__builtin:item" then
  463. local damage = 3.5
  464. obj:punch(self.object, 1.0, {
  465. full_punch_interval = 1.0,
  466. damage_groups= {fleshy = damage},
  467. }, nil)
  468. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  469. self.object:remove()
  470. end
  471. else
  472. local damage = 3.5
  473. obj:punch(self.object, 1.0, {
  474. full_punch_interval = 1.0,
  475. damage_groups= {fleshy = damage},
  476. }, nil)
  477. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  478. self.object:remove()
  479. end
  480. end
  481. end
  482. if self.lastpos.x ~= nil then
  483. if minetest.registered_nodes[node.name].walkable then
  484. if not minetest.setting_getbool("creative_mode") then
  485. minetest.add_item(self.lastpos, "minerdream:arrow")
  486. end
  487. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  488. self.object:remove()
  489. end
  490. end
  491. self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
  492. end
  493. minetest.register_entity("minerdream:nickelarrow", minerdream_nickelarrow )
  494. minetest.register_tool("minerdream:bow_silver", {
  495. description = "".. core.colorize("#00FFFF", "Silver bow\n")..core.colorize("#A0A0A0", "tier: 3 (almost rare)\n")..core.colorize("#A0A0A0", "projectile speed: 19\n")..core.colorize("#A0A0A0", "projectile gravity: 9.0\n")..core.colorize("#A0A0A0", "ranged damage: 4\n")..core.colorize("#A0A0A0", "ammo: arrows"),
  496. inventory_image = "minerdream_bow_silver.png",
  497. wield_scale = {x=1.1,y=1.1,z=1.1},
  498. on_use = function(itemstack, user, pointed_thing)
  499. local inv = user:get_inventory()
  500. if not inv:contains_item("main", "minerdream:arrow 1") then
  501. minetest.sound_play("", {object=user})
  502. return itemstack
  503. end
  504. if not minetest.setting_getbool("creative_mode") then
  505. inv:remove_item("main", "minerdream:arrow")
  506. end
  507. local pos = user:getpos()
  508. local dir = user:get_look_dir()
  509. local yaw = user:get_look_yaw()
  510. if pos and dir and yaw then
  511. pos.y = pos.y + 1.6
  512. local obj = minetest.add_entity(pos, "minerdream:silverarrow")
  513. if obj then
  514. minetest.sound_play("", {object=obj})
  515. obj:setvelocity({x=dir.x * 19, y=dir.y * 19, z=dir.z * 19})
  516. obj:setacceleration({x=dir.x * -9.0, y=-9.0, z=dir.z * -9.0})
  517. obj:setyaw(yaw + math.pi)
  518. local ent = obj:get_luaentity()
  519. if ent then
  520. ent.player = ent.player or user
  521. end
  522. end
  523. end
  524. return itemstack
  525. end,
  526. })
  527. local minerdream_silverarrow = {
  528. physical = false,
  529. timer = 0,
  530. visual = "wielditem",
  531. visual_size = {x=0.5, y=0.5,},
  532. textures = {'minerdream:shotarrow'},
  533. lastpos= {},
  534. collisionbox = {0, 0, 0, 0, 0, 0},
  535. }
  536. minerdream_silverarrow.on_step = function(self, dtime)
  537. self.timer = self.timer + dtime
  538. local pos = self.object:getpos()
  539. local node = minetest.get_node(pos)
  540. if self.timer > 0.1825 then
  541. local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
  542. for k, obj in pairs(objs) do
  543. if obj:get_luaentity() ~= nil then
  544. if obj:get_luaentity().name ~= "minerdream:silverarrow" and obj:get_luaentity().name ~= "__builtin:item" then
  545. local damage = 4.0
  546. obj:punch(self.object, 1.0, {
  547. full_punch_interval = 1.0,
  548. damage_groups= {fleshy = damage},
  549. }, nil)
  550. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  551. self.object:remove()
  552. end
  553. else
  554. local damage = 4.0
  555. obj:punch(self.object, 1.0, {
  556. full_punch_interval = 1.0,
  557. damage_groups= {fleshy = damage},
  558. }, nil)
  559. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  560. self.object:remove()
  561. end
  562. end
  563. end
  564. if self.lastpos.x ~= nil then
  565. if minetest.registered_nodes[node.name].walkable then
  566. if not minetest.setting_getbool("creative_mode") then
  567. minetest.add_item(self.lastpos, "minerdream:arrow")
  568. end
  569. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  570. self.object:remove()
  571. end
  572. end
  573. self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
  574. end
  575. minetest.register_entity("minerdream:silverarrow", minerdream_silverarrow )
  576. minetest.register_tool("minerdream:bow_gold", {
  577. description = "".. core.colorize("#00FFFF", "Golden bow\n")..core.colorize("#A0A0A0", "tier: 3 (almost rare)\n")..core.colorize("#A0A0A0", "projectile speed: 20\n")..core.colorize("#A0A0A0", "projectile gravity: 8.75\n")..core.colorize("#A0A0A0", "ranged damage: 4.5\n")..core.colorize("#A0A0A0", "ammo: arrows"),
  578. inventory_image = "minerdream_bow_gold.png",
  579. wield_scale = {x=1.1,y=1.1,z=1.1},
  580. on_use = function(itemstack, user, pointed_thing)
  581. local inv = user:get_inventory()
  582. if not inv:contains_item("main", "minerdream:arrow 1") then
  583. minetest.sound_play("", {object=user})
  584. return itemstack
  585. end
  586. if not minetest.setting_getbool("creative_mode") then
  587. inv:remove_item("main", "minerdream:arrow")
  588. end
  589. local pos = user:getpos()
  590. local dir = user:get_look_dir()
  591. local yaw = user:get_look_yaw()
  592. if pos and dir and yaw then
  593. pos.y = pos.y + 1.6
  594. local obj = minetest.add_entity(pos, "minerdream:goldarrow")
  595. if obj then
  596. minetest.sound_play("", {object=obj})
  597. obj:setvelocity({x=dir.x * 20, y=dir.y * 20, z=dir.z * 20})
  598. obj:setacceleration({x=dir.x * -8.75, y=-8.75, z=dir.z * -8.75})
  599. obj:setyaw(yaw + math.pi)
  600. local ent = obj:get_luaentity()
  601. if ent then
  602. ent.player = ent.player or user
  603. end
  604. end
  605. end
  606. return itemstack
  607. end,
  608. })
  609. local minerdream_goldarrow = {
  610. physical = false,
  611. timer = 0,
  612. visual = "wielditem",
  613. visual_size = {x=0.5, y=0.5,},
  614. textures = {'minerdream:shotarrow'},
  615. lastpos= {},
  616. collisionbox = {0, 0, 0, 0, 0, 0},
  617. }
  618. minerdream_goldarrow.on_step = function(self, dtime)
  619. self.timer = self.timer + dtime
  620. local pos = self.object:getpos()
  621. local node = minetest.get_node(pos)
  622. if self.timer > 0.1825 then
  623. local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
  624. for k, obj in pairs(objs) do
  625. if obj:get_luaentity() ~= nil then
  626. if obj:get_luaentity().name ~= "minerdream:goldarrow" and obj:get_luaentity().name ~= "__builtin:item" then
  627. local damage = 4.5
  628. obj:punch(self.object, 1.0, {
  629. full_punch_interval = 1.0,
  630. damage_groups= {fleshy = damage},
  631. }, nil)
  632. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  633. self.object:remove()
  634. end
  635. else
  636. local damage = 4.5
  637. obj:punch(self.object, 1.0, {
  638. full_punch_interval = 1.0,
  639. damage_groups= {fleshy = damage},
  640. }, nil)
  641. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  642. self.object:remove()
  643. end
  644. end
  645. end
  646. if self.lastpos.x ~= nil then
  647. if minetest.registered_nodes[node.name].walkable then
  648. if not minetest.setting_getbool("creative_mode") then
  649. minetest.add_item(self.lastpos, "minerdream:arrow")
  650. end
  651. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  652. self.object:remove()
  653. end
  654. end
  655. self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
  656. end
  657. minetest.register_entity("minerdream:goldarrow", minerdream_goldarrow )
  658. minetest.register_tool("minerdream:bow_mese", {
  659. description = "".. core.colorize("#00FFFF", "MESE bow\n")..core.colorize("#A0A0A0", "tier: 3 (almost rare)\n")..core.colorize("#A0A0A0", "projectile speed: 20\n")..core.colorize("#A0A0A0", "projectile gravity: 8.75\n")..core.colorize("#A0A0A0", "ranged damage: 4.5\n")..core.colorize("#A0A0A0", "ammo: arrows"),
  660. inventory_image = "minerdream_bow_mese.png",
  661. wield_scale = {x=1.1,y=1.1,z=1.1},
  662. on_use = function(itemstack, user, pointed_thing)
  663. local inv = user:get_inventory()
  664. if not inv:contains_item("main", "minerdream:arrow 1") then
  665. minetest.sound_play("", {object=user})
  666. return itemstack
  667. end
  668. if not minetest.setting_getbool("creative_mode") then
  669. inv:remove_item("main", "minerdream:arrow")
  670. end
  671. local pos = user:getpos()
  672. local dir = user:get_look_dir()
  673. local yaw = user:get_look_yaw()
  674. if pos and dir and yaw then
  675. pos.y = pos.y + 1.6
  676. local obj = minetest.add_entity(pos, "minerdream:mesearrow")
  677. if obj then
  678. minetest.sound_play("", {object=obj})
  679. obj:setvelocity({x=dir.x * 20, y=dir.y * 20, z=dir.z * 20})
  680. obj:setacceleration({x=dir.x * -8.75, y=-8.75, z=dir.z * -8.75})
  681. obj:setyaw(yaw + math.pi)
  682. local ent = obj:get_luaentity()
  683. if ent then
  684. ent.player = ent.player or user
  685. end
  686. end
  687. end
  688. return itemstack
  689. end,
  690. })
  691. local minerdream_mesearrow = {
  692. physical = false,
  693. timer = 0,
  694. visual = "wielditem",
  695. visual_size = {x=0.5, y=0.5,},
  696. textures = {'minerdream:shotarrow'},
  697. lastpos= {},
  698. collisionbox = {0, 0, 0, 0, 0, 0},
  699. }
  700. minerdream_mesearrow.on_step = function(self, dtime)
  701. self.timer = self.timer + dtime
  702. local pos = self.object:getpos()
  703. local node = minetest.get_node(pos)
  704. if self.timer > 0.1825 then
  705. local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
  706. for k, obj in pairs(objs) do
  707. if obj:get_luaentity() ~= nil then
  708. if obj:get_luaentity().name ~= "minerdream:mesearrow" and obj:get_luaentity().name ~= "__builtin:item" then
  709. local damage = 4.5
  710. obj:punch(self.object, 1.0, {
  711. full_punch_interval = 1.0,
  712. damage_groups= {fleshy = damage},
  713. }, nil)
  714. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  715. self.object:remove()
  716. end
  717. else
  718. local damage = 4.5
  719. obj:punch(self.object, 1.0, {
  720. full_punch_interval = 1.0,
  721. damage_groups= {fleshy = damage},
  722. }, nil)
  723. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  724. self.object:remove()
  725. end
  726. end
  727. end
  728. if self.lastpos.x ~= nil then
  729. if minetest.registered_nodes[node.name].walkable then
  730. if not minetest.setting_getbool("creative_mode") then
  731. minetest.add_item(self.lastpos, "minerdream:arrow")
  732. end
  733. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  734. self.object:remove()
  735. end
  736. end
  737. self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
  738. end
  739. minetest.register_entity("minerdream:mesearrow", minerdream_mesearrow )
  740. minetest.register_tool("minerdream:bow_diamond", {
  741. description = "".. core.colorize("#00FFFF", "diamond bow\n")..core.colorize("#A0A0A0", "tier: 3 (almost rare)\n")..core.colorize("#A0A0A0", "projectile speed: 21\n")..core.colorize("#A0A0A0", "projectile gravity: 8.5\n")..core.colorize("#A0A0A0", "ranged damage: 5\n")..core.colorize("#A0A0A0", "ammo: arrows"),
  742. inventory_image = "minerdream_bow_diamond.png",
  743. wield_scale = {x=1.15,y=1.15,z=1.15},
  744. on_use = function(itemstack, user, pointed_thing)
  745. local inv = user:get_inventory()
  746. if not inv:contains_item("main", "minerdream:arrow 1") then
  747. minetest.sound_play("", {object=user})
  748. return itemstack
  749. end
  750. if not minetest.setting_getbool("creative_mode") then
  751. inv:remove_item("main", "minerdream:arrow")
  752. end
  753. local pos = user:getpos()
  754. local dir = user:get_look_dir()
  755. local yaw = user:get_look_yaw()
  756. if pos and dir and yaw then
  757. pos.y = pos.y + 1.6
  758. local obj = minetest.add_entity(pos, "minerdream:diamondarrow")
  759. if obj then
  760. minetest.sound_play("", {object=obj})
  761. obj:setvelocity({x=dir.x * 21, y=dir.y * 21, z=dir.z * 21})
  762. obj:setacceleration({x=dir.x * -8.5, y=-8.5, z=dir.z * -8.5})
  763. obj:setyaw(yaw + math.pi)
  764. local ent = obj:get_luaentity()
  765. if ent then
  766. ent.player = ent.player or user
  767. end
  768. end
  769. end
  770. return itemstack
  771. end,
  772. })
  773. local minerdream_diamondarrow = {
  774. physical = false,
  775. timer = 0,
  776. visual = "wielditem",
  777. visual_size = {x=0.5, y=0.5,},
  778. textures = {'minerdream:shotarrow'},
  779. lastpos= {},
  780. collisionbox = {0, 0, 0, 0, 0, 0},
  781. }
  782. minerdream_diamondarrow.on_step = function(self, dtime)
  783. self.timer = self.timer + dtime
  784. local pos = self.object:getpos()
  785. local node = minetest.get_node(pos)
  786. if self.timer > 0.18 then
  787. local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
  788. for k, obj in pairs(objs) do
  789. if obj:get_luaentity() ~= nil then
  790. if obj:get_luaentity().name ~= "minerdream:diamondarrow" and obj:get_luaentity().name ~= "__builtin:item" then
  791. local damage = 5
  792. obj:punch(self.object, 1.0, {
  793. full_punch_interval = 1.0,
  794. damage_groups= {fleshy = damage},
  795. }, nil)
  796. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  797. self.object:remove()
  798. end
  799. else
  800. local damage = 5
  801. obj:punch(self.object, 1.0, {
  802. full_punch_interval = 1.0,
  803. damage_groups= {fleshy = damage},
  804. }, nil)
  805. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  806. self.object:remove()
  807. end
  808. end
  809. end
  810. if self.lastpos.x ~= nil then
  811. if minetest.registered_nodes[node.name].walkable then
  812. if not minetest.setting_getbool("creative_mode") then
  813. minetest.add_item(self.lastpos, "minerdream:arrow")
  814. end
  815. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  816. self.object:remove()
  817. end
  818. end
  819. self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
  820. end
  821. minetest.register_entity("minerdream:diamondarrow", minerdream_diamondarrow )
  822. minetest.register_tool("minerdream:bow_aluminum", {
  823. description = "".. core.colorize("#40FF80", "Aluminum bow\n")..core.colorize("#A0A0A0", "tier: 4 (rare)\n")..core.colorize("#A0A0A0", "projectile speed: 20\n")..core.colorize("#A0A0A0", "projectile gravity: 8.75\n")..core.colorize("#A0A0A0", "ranged damage: 6\n")..core.colorize("#A0A0A0", "ammo: arrows"),
  824. inventory_image = "minerdream_bow_aluminum.png",
  825. wield_scale = {x=1.3,y=1.3,z=1.3},
  826. on_use = function(itemstack, user, pointed_thing)
  827. local inv = user:get_inventory()
  828. if not inv:contains_item("main", "minerdream:arrow 1") then
  829. minetest.sound_play("", {object=user})
  830. return itemstack
  831. end
  832. if not minetest.setting_getbool("creative_mode") then
  833. inv:remove_item("main", "minerdream:arrow")
  834. end
  835. local pos = user:getpos()
  836. local dir = user:get_look_dir()
  837. local yaw = user:get_look_yaw()
  838. if pos and dir and yaw then
  839. pos.y = pos.y + 1.6
  840. local obj = minetest.add_entity(pos, "minerdream:aluminumarrow")
  841. if obj then
  842. minetest.sound_play("", {object=obj})
  843. obj:setvelocity({x=dir.x * 20, y=dir.y * 20, z=dir.z * 20})
  844. obj:setacceleration({x=dir.x * -8.75, y=-8.75, z=dir.z * -8.75})
  845. obj:setyaw(yaw + math.pi)
  846. local ent = obj:get_luaentity()
  847. if ent then
  848. ent.player = ent.player or user
  849. end
  850. end
  851. end
  852. return itemstack
  853. end,
  854. })
  855. local minerdream_aluminumarrow = {
  856. physical = false,
  857. timer = 0,
  858. visual = "wielditem",
  859. visual_size = {x=0.5, y=0.5,},
  860. textures = {'minerdream:shotarrow'},
  861. lastpos= {},
  862. collisionbox = {0, 0, 0, 0, 0, 0},
  863. }
  864. minerdream_aluminumarrow.on_step = function(self, dtime)
  865. self.timer = self.timer + dtime
  866. local pos = self.object:getpos()
  867. local node = minetest.get_node(pos)
  868. if self.timer > 0.18 then
  869. local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
  870. for k, obj in pairs(objs) do
  871. if obj:get_luaentity() ~= nil then
  872. if obj:get_luaentity().name ~= "minerdream:aluminumarrow" and obj:get_luaentity().name ~= "__builtin:item" then
  873. local damage = 6
  874. obj:punch(self.object, 1.0, {
  875. full_punch_interval = 1.0,
  876. damage_groups= {fleshy = damage},
  877. }, nil)
  878. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  879. self.object:remove()
  880. end
  881. else
  882. local damage = 6
  883. obj:punch(self.object, 1.0, {
  884. full_punch_interval = 1.0,
  885. damage_groups= {fleshy = damage},
  886. }, nil)
  887. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  888. self.object:remove()
  889. end
  890. end
  891. end
  892. if self.lastpos.x ~= nil then
  893. if minetest.registered_nodes[node.name].walkable then
  894. if not minetest.setting_getbool("creative_mode") then
  895. minetest.add_item(self.lastpos, "minerdream:arrow")
  896. end
  897. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  898. self.object:remove()
  899. end
  900. end
  901. self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
  902. end
  903. minetest.register_entity("minerdream:aluminumarrow", minerdream_aluminumarrow )
  904. minetest.register_tool("minerdream:bow_lead", {
  905. description = "".. core.colorize("#00FFFF", "Lead bow\n")..core.colorize("#A0A0A0", "tier: 3 (almost rare)\n")..core.colorize("#A0A0A0", "projectile speed: 22\n")..core.colorize("#A0A0A0", "projectile gravity: 8.5\n")..core.colorize("#A0A0A0", "ranged damage: 5\n")..core.colorize("#A0A0A0", "ammo: arrows"),
  906. inventory_image = "minerdream_bow_lead.png",
  907. wield_scale = {x=1.1,y=1.1,z=1.1},
  908. on_use = function(itemstack, user, pointed_thing)
  909. local inv = user:get_inventory()
  910. if not inv:contains_item("main", "minerdream:arrow 1") then
  911. minetest.sound_play("", {object=user})
  912. return itemstack
  913. end
  914. if not minetest.setting_getbool("creative_mode") then
  915. inv:remove_item("main", "minerdream:arrow")
  916. end
  917. local pos = user:getpos()
  918. local dir = user:get_look_dir()
  919. local yaw = user:get_look_yaw()
  920. if pos and dir and yaw then
  921. pos.y = pos.y + 1.6
  922. local obj = minetest.add_entity(pos, "minerdream:leadarrow")
  923. if obj then
  924. minetest.sound_play("", {object=obj})
  925. obj:setvelocity({x=dir.x * 22, y=dir.y * 22, z=dir.z * 22})
  926. obj:setacceleration({x=dir.x * -8.5, y=-8.5, z=dir.z * -8.5})
  927. obj:setyaw(yaw + math.pi)
  928. local ent = obj:get_luaentity()
  929. if ent then
  930. ent.player = ent.player or user
  931. end
  932. end
  933. end
  934. return itemstack
  935. end,
  936. })
  937. local minerdream_leadarrow = {
  938. physical = false,
  939. timer = 0,
  940. visual = "wielditem",
  941. visual_size = {x=0.5, y=0.5,},
  942. textures = {'minerdream:shotarrow'},
  943. lastpos= {},
  944. collisionbox = {0, 0, 0, 0, 0, 0},
  945. }
  946. minerdream_leadarrow.on_step = function(self, dtime)
  947. self.timer = self.timer + dtime
  948. local pos = self.object:getpos()
  949. local node = minetest.get_node(pos)
  950. if self.timer > 0.18 then
  951. local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
  952. for k, obj in pairs(objs) do
  953. if obj:get_luaentity() ~= nil then
  954. if obj:get_luaentity().name ~= "minerdream:leadarrow" and obj:get_luaentity().name ~= "__builtin:item" then
  955. local damage = 5
  956. obj:punch(self.object, 1.0, {
  957. full_punch_interval = 1.0,
  958. damage_groups= {fleshy = damage},
  959. }, nil)
  960. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  961. self.object:remove()
  962. end
  963. else
  964. local damage = 5
  965. obj:punch(self.object, 1.0, {
  966. full_punch_interval = 1.0,
  967. damage_groups= {fleshy = damage},
  968. }, nil)
  969. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  970. self.object:remove()
  971. end
  972. end
  973. end
  974. if self.lastpos.x ~= nil then
  975. if minetest.registered_nodes[node.name].walkable then
  976. if not minetest.setting_getbool("creative_mode") then
  977. minetest.add_item(self.lastpos, "minerdream:arrow")
  978. end
  979. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  980. self.object:remove()
  981. end
  982. end
  983. self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
  984. end
  985. minetest.register_entity("minerdream:leadarrow", minerdream_leadarrow )
  986. minetest.register_craftitem("minerdream:arrow", {
  987. description = "".. core.colorize("#FFFFFF", "arrow\n")..core.colorize("#A0A0A0", "ammunition for bows"),
  988. stack_max= 1000,
  989. inventory_image = "minerdream_arrow_inv.png",
  990. })
  991. minetest.register_craftitem("minerdream:shotarrow", {
  992. inventory_image = "minerdream_arrow.png",
  993. })
  994. minetest.register_tool("minerdream:bow_platinum", {
  995. description = "".. core.colorize("#40FF80", "Platinum bow\n")..core.colorize("#A0A0A0", "tier: 4 (rare)\n")..core.colorize("#A0A0A0", "projectile speed: 24\n")..core.colorize("#A0A0A0", "projectile gravity: 8.0\n")..core.colorize("#A0A0A0", "ranged damage: 6\n")..core.colorize("#A0A0A0", "ammo: arrows"),
  996. inventory_image = "minerdream_bow_platinum.png",
  997. wield_scale = {x=1.3,y=1.3,z=1.3},
  998. on_use = function(itemstack, user, pointed_thing)
  999. local inv = user:get_inventory()
  1000. if not inv:contains_item("main", "minerdream:arrow 1") then
  1001. minetest.sound_play("", {object=user})
  1002. return itemstack
  1003. end
  1004. if not minetest.setting_getbool("creative_mode") then
  1005. inv:remove_item("main", "minerdream:arrow")
  1006. end
  1007. local pos = user:getpos()
  1008. local dir = user:get_look_dir()
  1009. local yaw = user:get_look_yaw()
  1010. if pos and dir and yaw then
  1011. pos.y = pos.y + 1.6
  1012. local obj = minetest.add_entity(pos, "minerdream:platinumarrow")
  1013. if obj then
  1014. minetest.sound_play("", {object=obj})
  1015. obj:setvelocity({x=dir.x * 24, y=dir.y * 24, z=dir.z * 24})
  1016. obj:setacceleration({x=dir.x * -8.0, y=-8.0, z=dir.z * -8.0})
  1017. obj:setyaw(yaw + math.pi)
  1018. local ent = obj:get_luaentity()
  1019. if ent then
  1020. ent.player = ent.player or user
  1021. end
  1022. end
  1023. end
  1024. return itemstack
  1025. end,
  1026. })
  1027. local minerdream_platinumarrow = {
  1028. physical = false,
  1029. timer = 0,
  1030. visual = "wielditem",
  1031. visual_size = {x=0.5, y=0.5,},
  1032. textures = {'minerdream:shotarrow'},
  1033. lastpos= {},
  1034. collisionbox = {0, 0, 0, 0, 0, 0},
  1035. }
  1036. minerdream_platinumarrow.on_step = function(self, dtime)
  1037. self.timer = self.timer + dtime
  1038. local pos = self.object:getpos()
  1039. local node = minetest.get_node(pos)
  1040. if self.timer > 0.15 then
  1041. local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
  1042. for k, obj in pairs(objs) do
  1043. if obj:get_luaentity() ~= nil then
  1044. if obj:get_luaentity().name ~= "minerdream:platinumarrow" and obj:get_luaentity().name ~= "__builtin:item" then
  1045. local damage = 6
  1046. obj:punch(self.object, 1.0, {
  1047. full_punch_interval = 1.0,
  1048. damage_groups= {fleshy = damage},
  1049. }, nil)
  1050. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  1051. self.object:remove()
  1052. end
  1053. else
  1054. local damage = 6
  1055. obj:punch(self.object, 1.0, {
  1056. full_punch_interval = 1.0,
  1057. damage_groups= {fleshy = damage},
  1058. }, nil)
  1059. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  1060. self.object:remove()
  1061. end
  1062. end
  1063. end
  1064. if self.lastpos.x ~= nil then
  1065. if minetest.registered_nodes[node.name].walkable then
  1066. if not minetest.setting_getbool("creative_mode") then
  1067. minetest.add_item(self.lastpos, "minerdream:arrow")
  1068. end
  1069. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  1070. self.object:remove()
  1071. end
  1072. end
  1073. self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
  1074. end
  1075. minetest.register_entity("minerdream:platinumarrow", minerdream_platinumarrow )
  1076. minetest.register_tool("minerdream:bow_cobalt", {
  1077. description = "".. core.colorize("#0040FF", "Cobalt bow\n")..core.colorize("#A0A0A0", "tier: 5 (extra rare)\n")..core.colorize("#A0A0A0", "projectile speed: 27\n")..core.colorize("#A0A0A0", "projectile gravity: 7.5\n")..core.colorize("#A0A0A0", "ranged damage: 7\n")..core.colorize("#A0A0A0", "ammo: arrows"),
  1078. inventory_image = "minerdream_bow_cobalt.png",
  1079. wield_scale = {x=1.4,y=1.4,z=1.4},
  1080. on_use = function(itemstack, user, pointed_thing)
  1081. local inv = user:get_inventory()
  1082. if not inv:contains_item("main", "minerdream:arrow 1") then
  1083. minetest.sound_play("", {object=user})
  1084. return itemstack
  1085. end
  1086. if not minetest.setting_getbool("creative_mode") then
  1087. inv:remove_item("main", "minerdream:arrow")
  1088. end
  1089. local pos = user:getpos()
  1090. local dir = user:get_look_dir()
  1091. local yaw = user:get_look_yaw()
  1092. if pos and dir and yaw then
  1093. pos.y = pos.y + 1.6
  1094. local obj = minetest.add_entity(pos, "minerdream:cobaltarrow")
  1095. if obj then
  1096. minetest.sound_play("", {object=obj})
  1097. obj:setvelocity({x=dir.x * 27, y=dir.y * 27, z=dir.z * 27})
  1098. obj:setacceleration({x=dir.x * -7.5, y=-7.5, z=dir.z * -7.5})
  1099. obj:setyaw(yaw + math.pi)
  1100. local ent = obj:get_luaentity()
  1101. if ent then
  1102. ent.player = ent.player or user
  1103. end
  1104. end
  1105. end
  1106. return itemstack
  1107. end,
  1108. })
  1109. local minerdream_cobaltarrow = {
  1110. physical = false,
  1111. timer = 0,
  1112. visual = "wielditem",
  1113. visual_size = {x=0.5, y=0.5,},
  1114. textures = {'minerdream:shotarrow'},
  1115. lastpos= {},
  1116. collisionbox = {0, 0, 0, 0, 0, 0},
  1117. }
  1118. minerdream_cobaltarrow.on_step = function(self, dtime)
  1119. self.timer = self.timer + dtime
  1120. local pos = self.object:getpos()
  1121. local node = minetest.get_node(pos)
  1122. if self.timer > 0.145 then
  1123. local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
  1124. for k, obj in pairs(objs) do
  1125. if obj:get_luaentity() ~= nil then
  1126. if obj:get_luaentity().name ~= "minerdream:cobaltarrow" and obj:get_luaentity().name ~= "__builtin:item" then
  1127. local damage = 7
  1128. obj:punch(self.object, 1.0, {
  1129. full_punch_interval = 1.0,
  1130. damage_groups= {fleshy = damage},
  1131. }, nil)
  1132. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  1133. self.object:remove()
  1134. end
  1135. else
  1136. local damage = 7
  1137. obj:punch(self.object, 1.0, {
  1138. full_punch_interval = 1.0,
  1139. damage_groups= {fleshy = damage},
  1140. }, nil)
  1141. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  1142. self.object:remove()
  1143. end
  1144. end
  1145. end
  1146. if self.lastpos.x ~= nil then
  1147. if minetest.registered_nodes[node.name].walkable then
  1148. if not minetest.setting_getbool("creative_mode") then
  1149. minetest.add_item(self.lastpos, "minerdream:arrow")
  1150. end
  1151. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  1152. self.object:remove()
  1153. end
  1154. end
  1155. self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
  1156. end
  1157. minetest.register_entity("minerdream:cobaltarrow", minerdream_cobaltarrow )
  1158. minetest.register_tool("minerdream:bow_ruthenium", {
  1159. description = "".. core.colorize("#0040FF", "ruthenium bow\n")..core.colorize("#A0A0A0", "tier: 5 (extra rare)\n")..core.colorize("#A0A0A0", "projectile speed: 28\n")..core.colorize("#A0A0A0", "projectile gravity: 7.25\n")..core.colorize("#A0A0A0", "ranged damage: 7\n")..core.colorize("#A0A0A0", "ammo: arrows"),
  1160. inventory_image = "minerdream_bow_ruthenium.png",
  1161. wield_scale = {x=1.4,y=1.4,z=1.4},
  1162. on_use = function(itemstack, user, pointed_thing)
  1163. local inv = user:get_inventory()
  1164. if not inv:contains_item("main", "minerdream:arrow 1") then
  1165. minetest.sound_play("", {object=user})
  1166. return itemstack
  1167. end
  1168. if not minetest.setting_getbool("creative_mode") then
  1169. inv:remove_item("main", "minerdream:arrow")
  1170. end
  1171. local pos = user:getpos()
  1172. local dir = user:get_look_dir()
  1173. local yaw = user:get_look_yaw()
  1174. if pos and dir and yaw then
  1175. pos.y = pos.y + 1.6
  1176. local obj = minetest.add_entity(pos, "minerdream:rutheniumarrow")
  1177. if obj then
  1178. minetest.sound_play("", {object=obj})
  1179. obj:setvelocity({x=dir.x * 28, y=dir.y * 28, z=dir.z * 28})
  1180. obj:setacceleration({x=dir.x * -7.25, y=-7.25, z=dir.z * -7.25})
  1181. obj:setyaw(yaw + math.pi)
  1182. local ent = obj:get_luaentity()
  1183. if ent then
  1184. ent.player = ent.player or user
  1185. end
  1186. end
  1187. end
  1188. return itemstack
  1189. end,
  1190. })
  1191. local minerdream_rutheniumarrow = {
  1192. physical = false,
  1193. timer = 0,
  1194. visual = "wielditem",
  1195. visual_size = {x=0.5, y=0.5,},
  1196. textures = {'minerdream:shotarrow'},
  1197. lastpos= {},
  1198. collisionbox = {0, 0, 0, 0, 0, 0},
  1199. }
  1200. minerdream_rutheniumarrow.on_step = function(self, dtime)
  1201. self.timer = self.timer + dtime
  1202. local pos = self.object:getpos()
  1203. local node = minetest.get_node(pos)
  1204. if self.timer > 0.1425 then
  1205. local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
  1206. for k, obj in pairs(objs) do
  1207. if obj:get_luaentity() ~= nil then
  1208. if obj:get_luaentity().name ~= "minerdream:rutheniumarrow" and obj:get_luaentity().name ~= "__builtin:item" then
  1209. local damage = 7
  1210. obj:punch(self.object, 1.0, {
  1211. full_punch_interval = 1.0,
  1212. damage_groups= {fleshy = damage},
  1213. }, nil)
  1214. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  1215. self.object:remove()
  1216. end
  1217. else
  1218. local damage = 7
  1219. obj:punch(self.object, 1.0, {
  1220. full_punch_interval = 1.0,
  1221. damage_groups= {fleshy = damage},
  1222. }, nil)
  1223. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  1224. self.object:remove()
  1225. end
  1226. end
  1227. end
  1228. if self.lastpos.x ~= nil then
  1229. if minetest.registered_nodes[node.name].walkable then
  1230. if not minetest.setting_getbool("creative_mode") then
  1231. minetest.add_item(self.lastpos, "minerdream:arrow")
  1232. end
  1233. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  1234. self.object:remove()
  1235. end
  1236. end
  1237. self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
  1238. end
  1239. minetest.register_entity("minerdream:rutheniumarrow", minerdream_rutheniumarrow )
  1240. minetest.register_tool("minerdream:bow_tantalum", {
  1241. description = "".. core.colorize("#00FF00", "tantalum bow\n")..core.colorize("#A0A0A0", "tier: 6 (epic)\n")..core.colorize("#A0A0A0", "projectile speed: 32.5\n")..core.colorize("#A0A0A0", "projectile gravity: 6.5\n")..core.colorize("#A0A0A0", "ranged damage: 9\n")..core.colorize("#A0A0A0", "ammo: arrows"),
  1242. inventory_image = "minerdream_bow_tantalum.png",
  1243. wield_scale = {x=1.55,y=1.55,z=1.2},
  1244. on_use = function(itemstack, user, pointed_thing)
  1245. local inv = user:get_inventory()
  1246. if not inv:contains_item("main", "minerdream:arrow 1") then
  1247. minetest.sound_play("", {object=user})
  1248. return itemstack
  1249. end
  1250. if not minetest.setting_getbool("creative_mode") then
  1251. inv:remove_item("main", "minerdream:arrow")
  1252. end
  1253. local pos = user:getpos()
  1254. local dir = user:get_look_dir()
  1255. local yaw = user:get_look_yaw()
  1256. if pos and dir and yaw then
  1257. pos.y = pos.y + 1.6
  1258. local obj = minetest.add_entity(pos, "minerdream:tantalumarrow")
  1259. if obj then
  1260. minetest.sound_play("", {object=obj})
  1261. obj:setvelocity({x=dir.x * 32.5, y=dir.y * 32.5, z=dir.z * 32.5})
  1262. obj:setacceleration({x=dir.x * -6.5, y=-6.5, z=dir.z * -6.5})
  1263. obj:setyaw(yaw + math.pi)
  1264. local ent = obj:get_luaentity()
  1265. if ent then
  1266. ent.player = ent.player or user
  1267. end
  1268. end
  1269. end
  1270. return itemstack
  1271. end,
  1272. })
  1273. local minerdream_tantalumarrow = {
  1274. physical = false,
  1275. timer = 0,
  1276. visual = "wielditem",
  1277. visual_size = {x=0.5, y=0.5,},
  1278. textures = {'minerdream:shotarrow'},
  1279. lastpos= {},
  1280. collisionbox = {0, 0, 0, 0, 0, 0},
  1281. }
  1282. minerdream_tantalumarrow.on_step = function(self, dtime)
  1283. self.timer = self.timer + dtime
  1284. local pos = self.object:getpos()
  1285. local node = minetest.get_node(pos)
  1286. if self.timer > 0.140 then
  1287. local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
  1288. for k, obj in pairs(objs) do
  1289. if obj:get_luaentity() ~= nil then
  1290. if obj:get_luaentity().name ~= "minerdream:tantalumarrow" and obj:get_luaentity().name ~= "__builtin:item" then
  1291. local damage = 9
  1292. obj:punch(self.object, 1.0, {
  1293. full_punch_interval = 1.0,
  1294. damage_groups= {fleshy = damage},
  1295. }, nil)
  1296. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  1297. self.object:remove()
  1298. end
  1299. else
  1300. local damage = 9
  1301. obj:punch(self.object, 1.0, {
  1302. full_punch_interval = 1.0,
  1303. damage_groups= {fleshy = damage},
  1304. }, nil)
  1305. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  1306. self.object:remove()
  1307. end
  1308. end
  1309. end
  1310. if self.lastpos.x ~= nil then
  1311. if minetest.registered_nodes[node.name].walkable then
  1312. if not minetest.setting_getbool("creative_mode") then
  1313. minetest.add_item(self.lastpos, "minerdream:arrow")
  1314. end
  1315. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  1316. self.object:remove()
  1317. end
  1318. end
  1319. self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
  1320. end
  1321. minetest.register_entity("minerdream:tantalumarrow", minerdream_tantalumarrow )
  1322. minetest.register_tool("minerdream:bow_rhodium", {
  1323. description = "".. core.colorize("#00FF00", "rhodium bow\n")..core.colorize("#A0A0A0", "tier: 6 (epic)\n")..core.colorize("#A0A0A0", "projectile speed: 33.0\n")..core.colorize("#A0A0A0", "projectile gravity: 6.5\n")..core.colorize("#A0A0A0", "ranged damage: 9\n")..core.colorize("#A0A0A0", "ammo: arrows"),
  1324. inventory_image = "minerdream_bow_rhodium.png",
  1325. wield_scale = {x=1.55,y=1.55,z=1.2},
  1326. on_use = function(itemstack, user, pointed_thing)
  1327. local inv = user:get_inventory()
  1328. if not inv:contains_item("main", "minerdream:arrow 1") then
  1329. minetest.sound_play("", {object=user})
  1330. return itemstack
  1331. end
  1332. if not minetest.setting_getbool("creative_mode") then
  1333. inv:remove_item("main", "minerdream:arrow")
  1334. end
  1335. local pos = user:getpos()
  1336. local dir = user:get_look_dir()
  1337. local yaw = user:get_look_yaw()
  1338. if pos and dir and yaw then
  1339. pos.y = pos.y + 1.6
  1340. local obj = minetest.add_entity(pos, "minerdream:rhodiumarrow")
  1341. if obj then
  1342. minetest.sound_play("", {object=obj})
  1343. obj:setvelocity({x=dir.x * 33.0, y=dir.y * 33.0, z=dir.z * 33.0})
  1344. obj:setacceleration({x=dir.x * -6.5, y=-6.5, z=dir.z * -6.5})
  1345. obj:setyaw(yaw + math.pi)
  1346. local ent = obj:get_luaentity()
  1347. if ent then
  1348. ent.player = ent.player or user
  1349. end
  1350. end
  1351. end
  1352. return itemstack
  1353. end,
  1354. })
  1355. local minerdream_rhodiumarrow = {
  1356. physical = false,
  1357. timer = 0,
  1358. visual = "wielditem",
  1359. visual_size = {x=0.5, y=0.5,},
  1360. textures = {'minerdream:shotarrow'},
  1361. lastpos= {},
  1362. collisionbox = {0, 0, 0, 0, 0, 0},
  1363. }
  1364. minerdream_rhodiumarrow.on_step = function(self, dtime)
  1365. self.timer = self.timer + dtime
  1366. local pos = self.object:getpos()
  1367. local node = minetest.get_node(pos)
  1368. if self.timer > 0.140 then
  1369. local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
  1370. for k, obj in pairs(objs) do
  1371. if obj:get_luaentity() ~= nil then
  1372. if obj:get_luaentity().name ~= "minerdream:rhodiumarrow" and obj:get_luaentity().name ~= "__builtin:item" then
  1373. local damage = 9
  1374. obj:punch(self.object, 1.0, {
  1375. full_punch_interval = 1.0,
  1376. damage_groups= {fleshy = damage},
  1377. }, nil)
  1378. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  1379. self.object:remove()
  1380. end
  1381. else
  1382. local damage = 9
  1383. obj:punch(self.object, 1.0, {
  1384. full_punch_interval = 1.0,
  1385. damage_groups= {fleshy = damage},
  1386. }, nil)
  1387. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  1388. self.object:remove()
  1389. end
  1390. end
  1391. end
  1392. if self.lastpos.x ~= nil then
  1393. if minetest.registered_nodes[node.name].walkable then
  1394. if not minetest.setting_getbool("creative_mode") then
  1395. minetest.add_item(self.lastpos, "minerdream:arrow")
  1396. end
  1397. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  1398. self.object:remove()
  1399. end
  1400. end
  1401. self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
  1402. end
  1403. minetest.register_entity("minerdream:rhodiumarrow", minerdream_rhodiumarrow )
  1404. -----------------------guns---------------
  1405. minetest.register_tool("minerdream:handgun", {
  1406. description = "".. core.colorize("#00FFFF", "handgun\n")..core.colorize("#A0A0A0", "tier: 3 (almost rare)\n")..core.colorize("#A0A0A0", "projectile speed: 20\n")..core.colorize("#A0A0A0", "ranged damage: 4\n")..core.colorize("#A0A0A0", "ammo: bullets"),
  1407. inventory_image = "minerdream_handgun.png",
  1408. wield_scale = {x=1.0,y=1.0,z=1.0},
  1409. on_use = function(itemstack, user, pointed_thing)
  1410. local inv = user:get_inventory()
  1411. if not inv:contains_item("main", "minerdream:bullet 1") then
  1412. minetest.sound_play("minerdream_empty", {object=user})
  1413. return itemstack
  1414. end
  1415. if not minetest.setting_getbool("creative_mode") then
  1416. inv:remove_item("main", "minerdream:bullet")
  1417. end
  1418. local pos = user:getpos()
  1419. local dir = user:get_look_dir()
  1420. local yaw = user:get_look_yaw()
  1421. if pos and dir and yaw then
  1422. pos.y = pos.y + 1.6
  1423. local obj = minetest.add_entity(pos, "minerdream:handgunshot")
  1424. if obj then
  1425. minetest.sound_play("minerdream_handgun", {object=obj})
  1426. obj:setvelocity({x=dir.x * 20, y=dir.y * 20, z=dir.z * 20})
  1427. obj:setacceleration({x=dir.x * 0, y=0, z=dir.z * 0})
  1428. obj:setyaw(yaw + math.pi)
  1429. pos.y = pos.y - 0.2
  1430. local obj = minetest.add_entity(pos, "minerdream:gunsmoke")
  1431. minetest.sound_play("minerdream_handgun", {object=obj})
  1432. obj:setvelocity({x=dir.x * 3, y=dir.y * 3, z=dir.z * 3})
  1433. obj:setacceleration({x=dir.x * -4, y=2, z=dir.z * -4})
  1434. obj:setyaw(yaw + math.pi)
  1435. pos.y = pos.y + 0.3
  1436. local obj = minetest.add_entity(pos, "minerdream:pellet")
  1437. minetest.sound_play("minerdream_handgun", {object=obj})
  1438. obj:setvelocity({x=dir.x * -25, y=dir.y * 0, z=dir.z * -25})
  1439. obj:setacceleration({x=dir.x * 10, y=-25, z=dir.z * 10})
  1440. obj:setyaw(yaw + math.pi)
  1441. local ent = obj:get_luaentity()
  1442. if ent then
  1443. ent.player = ent.player or user
  1444. end
  1445. end
  1446. end
  1447. return itemstack
  1448. end,
  1449. })
  1450. local minerdream_handgunshot = {
  1451. physical = false,
  1452. timer = 0,
  1453. visual = "wielditem",
  1454. visual_size = {x=0.25, y=0.4,},
  1455. textures = {'minerdream:shot'},
  1456. lastpos= {},
  1457. collisionbox = {0, 0, 0, 0, 0, 0},
  1458. }
  1459. minerdream_handgunshot.on_step = function(self, dtime)
  1460. self.timer = self.timer + dtime
  1461. local pos = self.object:getpos()
  1462. local node = minetest.get_node(pos)
  1463. if self.timer > 0.15 then
  1464. local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
  1465. for k, obj in pairs(objs) do
  1466. if obj:get_luaentity() ~= nil then
  1467. if obj:get_luaentity().name ~= "minerdream:handgunshot" and obj:get_luaentity().name ~= "__builtin:item" then
  1468. local damage = 4
  1469. obj:punch(self.object, 1.0, {
  1470. full_punch_interval = 1.0,
  1471. damage_groups= {fleshy = damage},
  1472. }, nil)
  1473. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  1474. self.object:remove()
  1475. end
  1476. else
  1477. local damage = 4
  1478. obj:punch(self.object, 1.0, {
  1479. full_punch_interval = 1.0,
  1480. damage_groups= {fleshy = damage},
  1481. }, nil)
  1482. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  1483. self.object:remove()
  1484. end
  1485. end
  1486. end
  1487. if self.lastpos.x ~= nil then
  1488. if minetest.registered_nodes[node.name].walkable then
  1489. if not minetest.setting_getbool("creative_mode") then
  1490. minetest.add_item(self.lastpos, "")
  1491. end
  1492. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  1493. self.object:remove()
  1494. end
  1495. end
  1496. self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
  1497. end
  1498. minetest.register_entity("minerdream:handgunshot", minerdream_handgunshot)
  1499. minetest.register_craftitem("minerdream:bullet", {
  1500. description = "".. core.colorize("#FFFFFF", "bullet\n")..core.colorize("#A0A0A0", "ammunition for guns"),
  1501. stack_max= 2000,
  1502. inventory_image = "minerdream_bullet_inv.png",
  1503. })
  1504. minetest.register_craftitem("minerdream:casing", {
  1505. description = "".. core.colorize("#FFFFFF", "bullet casing\n")..core.colorize("#A0A0A0", "this buleet is empty, and mostly useless, but if you collect 9 of those, you can recicle them into a brass nugget"),
  1506. stack_max= 2000,
  1507. inventory_image = "minerdream_casing.png",
  1508. })
  1509. minetest.register_craftitem("minerdream:shot", {
  1510. inventory_image = "minerdream_shot.png",
  1511. })
  1512. local minerdream_gunsmoke = {
  1513. physical = false,
  1514. timer = 0,
  1515. visual = "sprite",
  1516. visual_size = {x=0.5, y=0.5,},
  1517. textures = {'tnt_smoke.png'},
  1518. lastpos= { },
  1519. collisionbox = {0, 0, 0, 0, 0, 0},
  1520. }
  1521. minerdream_gunsmoke.on_step = function(self, dtime)
  1522. self.timer = self.timer + dtime
  1523. local pos = self.object:getpos()
  1524. local node = minetest.get_node(pos)
  1525. if self.timer > 1 then
  1526. local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 100)
  1527. for k, obj in pairs(objs) do
  1528. if obj:get_luaentity() ~= nil then
  1529. if obj:get_luaentity().name ~= "minerdream:gunsmoke" and obj:get_luaentity().name ~= "__builtin:item" then
  1530. local damage = 0
  1531. obj:punch(self.object, 1.0, {
  1532. full_punch_interval = 1.0,
  1533. damage_groups= {fleshy = damage},
  1534. }, nil)
  1535. self.object:remove()
  1536. end
  1537. else
  1538. local damage = 0
  1539. obj:punch(self.object, 1.0, {
  1540. full_punch_interval = 1.0,
  1541. damage_groups= {fleshy = damage},
  1542. }, nil)
  1543. self.object:remove()
  1544. end
  1545. end
  1546. end
  1547. if self.lastpos.x ~= nil then
  1548. if minetest.registered_nodes[node.name].walkable then
  1549. if not minetest.setting_getbool("creative_mode") then
  1550. minetest.add_item(self.lastpos, "")
  1551. end
  1552. self.object:remove()
  1553. end
  1554. end
  1555. self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
  1556. end
  1557. minetest.register_entity("minerdream:gunsmoke", minerdream_gunsmoke)
  1558. local minerdream_pellet = {
  1559. physical = false,
  1560. timer = 0,
  1561. visual = "wielditem",
  1562. visual_size = {x=0.5, y=0.5,},
  1563. textures = {'minerdream:pellet'},
  1564. lastpos= {},
  1565. collisionbox = {0, 0, 0, 0, 0, 0},
  1566. }
  1567. minerdream_pellet.on_step = function(self, dtime)
  1568. self.timer = self.timer + dtime
  1569. local pos = self.object:getpos()
  1570. local node = minetest.get_node(pos)
  1571. if self.timer > 0.0 then
  1572. local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
  1573. for k, obj in pairs(objs) do
  1574. if obj:get_luaentity() ~= nil then
  1575. if obj:get_luaentity().name ~= "minerdream:pellet" and obj:get_luaentity().name ~= "__builtin:item" then
  1576. local damage = 0
  1577. obj:punch(self.object, 1.0, {
  1578. full_punch_interval = 1.0,
  1579. damage_groups= {fleshy = damage},
  1580. }, nil)
  1581. end
  1582. else
  1583. local damage = 0
  1584. obj:punch(self.object, 1.0, {
  1585. full_punch_interval = 1.0,
  1586. damage_groups= {fleshy = damage},
  1587. }, nil)
  1588. end
  1589. end
  1590. end
  1591. if self.lastpos.x ~= nil then
  1592. if minetest.registered_nodes[node.name].walkable then
  1593. if not minetest.setting_getbool("creative_mode") then
  1594. minetest.add_item(self.lastpos, "minerdream:casing")
  1595. end
  1596. minetest.sound_play("minerdream_pelletfall", {pos = self.lastpos, gain = 0.8})
  1597. self.object:remove()
  1598. end
  1599. end
  1600. self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
  1601. end
  1602. minetest.register_entity("minerdream:pellet", minerdream_pellet)
  1603. minetest.register_tool("minerdream:revolver", {
  1604. description = "".. core.colorize("#0040FF", "Revolver\n")..core.colorize("#A0A0A0", "tier: 5 (extra rare)\n")..core.colorize("#A0A0A0", "projectile speed: 40\n")..core.colorize("#A0A0A0", "ranged damage: 6\n")..core.colorize("#A0A0A0", "ammo: bullets"),
  1605. inventory_image = "minerdream_revolver.png",
  1606. wield_scale = {x=1.0,y=1.0,z=1.0},
  1607. on_use = function(itemstack, user, pointed_thing)
  1608. local inv = user:get_inventory()
  1609. if not inv:contains_item("main", "minerdream:bullet 1") then
  1610. minetest.sound_play("minerdream_empty", {object=user})
  1611. return itemstack
  1612. end
  1613. if not minetest.setting_getbool("creative_mode") then
  1614. inv:remove_item("main", "minerdream:bullet")
  1615. end
  1616. local pos = user:getpos()
  1617. local dir = user:get_look_dir()
  1618. local yaw = user:get_look_yaw()
  1619. if pos and dir and yaw then
  1620. pos.y = pos.y + 1.6
  1621. local obj = minetest.add_entity(pos, "minerdream:revolvershot")
  1622. if obj then
  1623. minetest.sound_play("minerdream_revolver", {object=obj})
  1624. obj:setvelocity({x=dir.x * 40, y=dir.y * 40, z=dir.z * 40})
  1625. obj:setacceleration({x=dir.x * 0, y=0, z=dir.z * 0})
  1626. obj:setyaw(yaw + math.pi)
  1627. pos.y = pos.y - 0.2
  1628. local obj = minetest.add_entity(pos, "minerdream:gunsmoke")
  1629. minetest.sound_play("minerdream_handgun", {object=obj})
  1630. obj:setvelocity({x=dir.x * 3, y=dir.y * 3, z=dir.z * 3})
  1631. obj:setacceleration({x=dir.x * -4, y=2, z=dir.z * -4})
  1632. obj:setyaw(yaw + math.pi)
  1633. pos.y = pos.y + 0.3
  1634. local obj = minetest.add_entity(pos, "minerdream:pellet")
  1635. minetest.sound_play("minerdream_handgun", {object=obj})
  1636. obj:setvelocity({x=dir.x * -25, y=dir.y * 0, z=dir.z * -25})
  1637. obj:setacceleration({x=dir.x * 10, y=-25, z=dir.z * 10})
  1638. obj:setyaw(yaw + math.pi)
  1639. local ent = obj:get_luaentity()
  1640. if ent then
  1641. ent.player = ent.player or user
  1642. end
  1643. end
  1644. end
  1645. return itemstack
  1646. end,
  1647. })
  1648. local minerdream_revolvershot = {
  1649. physical = false,
  1650. timer = 0,
  1651. visual = "wielditem",
  1652. visual_size = {x=0.25, y=0.4,},
  1653. textures = {'minerdream:shot'},
  1654. lastpos= {},
  1655. collisionbox = {0, 0, 0, 0, 0, 0},
  1656. }
  1657. minerdream_revolvershot.on_step = function(self, dtime)
  1658. self.timer = self.timer + dtime
  1659. local pos = self.object:getpos()
  1660. local node = minetest.get_node(pos)
  1661. if self.timer > 0.10 then
  1662. local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
  1663. for k, obj in pairs(objs) do
  1664. if obj:get_luaentity() ~= nil then
  1665. if obj:get_luaentity().name ~= "minerdream:revolvershot" and obj:get_luaentity().name ~= "__builtin:item" then
  1666. local damage = 6
  1667. obj:punch(self.object, 1.0, {
  1668. full_punch_interval = 1.0,
  1669. damage_groups= {fleshy = damage},
  1670. }, nil)
  1671. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  1672. self.object:remove()
  1673. end
  1674. else
  1675. local damage = 6
  1676. obj:punch(self.object, 1.0, {
  1677. full_punch_interval = 1.0,
  1678. damage_groups= {fleshy = damage},
  1679. }, nil)
  1680. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  1681. self.object:remove()
  1682. end
  1683. end
  1684. end
  1685. if self.lastpos.x ~= nil then
  1686. if minetest.registered_nodes[node.name].walkable then
  1687. if not minetest.setting_getbool("creative_mode") then
  1688. minetest.add_item(self.lastpos, "")
  1689. end
  1690. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  1691. self.object:remove()
  1692. end
  1693. end
  1694. self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
  1695. end
  1696. minetest.register_entity("minerdream:revolvershot", minerdream_revolvershot)
  1697. minetest.register_tool("minerdream:shotgun", {
  1698. description = "".. core.colorize("#00FF00", "Shotgun\n")..core.colorize("#A0A0A0", "tier: 6 (epic)\n")..core.colorize("#A0A0A0", "projectile speed: 20\n")..core.colorize("#A0A0A0", "Projectile ammount: 5\n")..core.colorize("#A0A0A0", "ranged damage: 6\n")..core.colorize("#A0A0A0", "ammo: bullets x2"),
  1699. inventory_image = "minerdream_shotgun.png",
  1700. wield_scale = {x=2.0,y=2.0,z=1.0},
  1701. on_use = function(itemstack, user, pointed_thing)
  1702. local inv = user:get_inventory()
  1703. if not inv:contains_item("main", "minerdream:bullet 2") then
  1704. minetest.sound_play("minerdream_empty", {object=user})
  1705. return itemstack
  1706. end
  1707. if not minetest.setting_getbool("creative_mode") then
  1708. inv:remove_item("main", "minerdream:bullet 2")
  1709. end
  1710. local pos = user:getpos()
  1711. local dir = user:get_look_dir()
  1712. local yaw = user:get_look_yaw()
  1713. if pos and dir and yaw then
  1714. pos.y = pos.y + 1.6
  1715. local obj = minetest.add_entity(pos, "minerdream:shotgunshot")
  1716. if obj then
  1717. minetest.sound_play("minerdream_shotgun", {object=obj})
  1718. obj:setvelocity({x=dir.x * 20, y=dir.y * 20, z=dir.z * 20})
  1719. obj:setacceleration({x=dir.x * 0, y=0, z=dir.z * 0})
  1720. obj:setyaw(yaw + math.pi)
  1721. pos.y = pos.y + 0.0
  1722. local obj = minetest.add_entity(pos, "minerdream:shotgunshot")
  1723. minetest.sound_play("", {object=obj})
  1724. obj:setvelocity({x=dir.x * 23, y=dir.y * 20, z=dir.z * 20})
  1725. obj:setacceleration({x=dir.x * 0, y=0, z=dir.z * 0})
  1726. obj:setyaw(yaw + math.pi)
  1727. pos.y = pos.y + 0.0
  1728. local obj = minetest.add_entity(pos, "minerdream:shotgunshot")
  1729. minetest.sound_play("", {object=obj})
  1730. obj:setvelocity({x=dir.x * 26, y=dir.y * 20, z=dir.z * 20})
  1731. obj:setacceleration({x=dir.x * 0, y=0, z=dir.z * 0})
  1732. obj:setyaw(yaw + math.pi)
  1733. pos.y = pos.y + 0.0
  1734. local obj = minetest.add_entity(pos, "minerdream:shotgunshot")
  1735. minetest.sound_play("", {object=obj})
  1736. obj:setvelocity({x=dir.x * 17, y=dir.y * 20, z=dir.z * 20})
  1737. obj:setacceleration({x=dir.x * 0, y=0, z=dir.z * 0})
  1738. obj:setyaw(yaw + math.pi)
  1739. pos.y = pos.y + 0.0
  1740. local obj = minetest.add_entity(pos, "minerdream:shotgunshot")
  1741. minetest.sound_play("", {object=obj})
  1742. obj:setvelocity({x=dir.x * 14, y=dir.y * 20, z=dir.z * 20})
  1743. obj:setacceleration({x=dir.x * 0, y=0, z=dir.z * 0})
  1744. obj:setyaw(yaw + math.pi)
  1745. pos.y = pos.y - 0.2
  1746. local obj = minetest.add_entity(pos, "minerdream:gunsmoke")
  1747. minetest.sound_play("", {object=obj})
  1748. obj:setvelocity({x=dir.x * 3, y=dir.y * 3, z=dir.z * 3})
  1749. obj:setacceleration({x=dir.x * -4, y=2, z=dir.z * -4})
  1750. obj:setyaw(yaw + math.pi)
  1751. pos.y = pos.y + 0.3
  1752. local obj = minetest.add_entity(pos, "minerdream:pellet")
  1753. minetest.sound_play("", {object=obj})
  1754. obj:setvelocity({x=dir.x * -25, y=dir.y * 0, z=dir.z * -25})
  1755. obj:setacceleration({x=dir.x * 10, y=-25, z=dir.z * 10})
  1756. obj:setyaw(yaw + math.pi)
  1757. pos.y = pos.y + 0.3
  1758. local obj = minetest.add_entity(pos, "minerdream:pellet")
  1759. minetest.sound_play("", {object=obj})
  1760. obj:setvelocity({x=dir.x * -26, y=dir.y * 0, z=dir.z * -26})
  1761. obj:setacceleration({x=dir.x * 10, y=-25, z=dir.z * 10})
  1762. obj:setyaw(yaw + math.pi)
  1763. local ent = obj:get_luaentity()
  1764. if ent then
  1765. ent.player = ent.player or user
  1766. end
  1767. end
  1768. end
  1769. return itemstack
  1770. end,
  1771. })
  1772. local minerdream_shotgunshot = {
  1773. physical = false,
  1774. timer = 0,
  1775. visual = "wielditem",
  1776. visual_size = {x=0.25, y=0.4,},
  1777. textures = {'minerdream:shot'},
  1778. lastpos= {},
  1779. collisionbox = {0, 0, 0, 0, 0, 0},
  1780. }
  1781. minerdream_shotgunshot.on_step = function(self, dtime)
  1782. self.timer = self.timer + dtime
  1783. local pos = self.object:getpos()
  1784. local node = minetest.get_node(pos)
  1785. if self.timer > 0.15 then
  1786. local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
  1787. for k, obj in pairs(objs) do
  1788. if obj:get_luaentity() ~= nil then
  1789. if obj:get_luaentity().name ~= "minerdream:shotgunshot" and obj:get_luaentity().name ~= "__builtin:item" then
  1790. local damage = 6
  1791. obj:punch(self.object, 1.0, {
  1792. full_punch_interval = 1.0,
  1793. damage_groups= {fleshy = damage},
  1794. }, nil)
  1795. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  1796. self.object:remove()
  1797. end
  1798. else
  1799. local damage = 6
  1800. obj:punch(self.object, 1.0, {
  1801. full_punch_interval = 1.0,
  1802. damage_groups= {fleshy = damage},
  1803. }, nil)
  1804. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  1805. self.object:remove()
  1806. end
  1807. end
  1808. end
  1809. if self.lastpos.x ~= nil then
  1810. if minetest.registered_nodes[node.name].walkable then
  1811. if not minetest.setting_getbool("creative_mode") then
  1812. minetest.add_item(self.lastpos, "")
  1813. end
  1814. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  1815. self.object:remove()
  1816. end
  1817. end
  1818. self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
  1819. end
  1820. minetest.register_entity("minerdream:shotgunshot", minerdream_shotgunshot)
  1821. minetest.register_craftitem("minerdream:pellet", {
  1822. wield_scale = {x=6.0,y=2.0,z=0.5},
  1823. inventory_image = "minerdream_pellet.png",
  1824. })
  1825. ---------------throwable----------------
  1826. minetest.register_craftitem("minerdream:shuriken", {
  1827. description = "".. core.colorize("#BFFFFF", "Shuriken\n")..core.colorize("#A0A0A0", "tier: 2 (uncommon)\n")..core.colorize("#A0A0A0", "throwable speed: 20\n")..core.colorize("#A0A0A0", "throwable gravity: 8\n")..core.colorize("#A0A0A0", "throwing damage: 4"),
  1828. range = 0,
  1829. stack_max= 500,
  1830. inventory_image = "minerdream_shuriken.png",
  1831. on_use = function(itemstack, user, pointed_thing)
  1832. if not minetest.setting_getbool("creative_mode") then itemstack:take_item()
  1833. end
  1834. if pointed_thing.type ~= "nothing" then
  1835. local pointed = minetest.get_pointed_thing_position(pointed_thing)
  1836. if vector.distance(user:getpos(), pointed) < 8 then
  1837. return itemstack
  1838. end
  1839. end
  1840. local pos = user:getpos()
  1841. local dir = user:get_look_dir()
  1842. local yaw = user:get_look_yaw()
  1843. if pos and dir then
  1844. pos.y = pos.y + 1.5
  1845. local obj = minetest.add_entity(pos, "minerdream:shuriken")
  1846. if obj then
  1847. obj:setvelocity({x=dir.x * 20, y=dir.y * 20, z=dir.z * 20})
  1848. obj:setacceleration({x=dir.x * -8, y=-8, z=dir.z * -8})
  1849. obj:setyaw(yaw + math.pi)
  1850. local ent = obj:get_luaentity()
  1851. if ent then
  1852. ent.player = ent.player or user
  1853. end
  1854. end
  1855. end
  1856. return itemstack
  1857. end,
  1858. })
  1859. local minerdream_shuriken = {
  1860. physical = false,
  1861. timer = 0,
  1862. visual = "cube",
  1863. visual_size = {x=0.5, y=0.0,},
  1864. textures = {'minerdream_shuriken.png','minerdream_shuriken.png','minerdream_shuriken.png','minerdream_shuriken.png','minerdream_shuriken.png','minerdream_shuriken.png'},
  1865. lastpos= {},
  1866. collisionbox = {0, 0, 0, 0, 0, 0},
  1867. }
  1868. minerdream_shuriken.on_step = function(self, dtime)
  1869. self.timer = self.timer + dtime
  1870. local pos = self.object:getpos()
  1871. local node = minetest.get_node(pos)
  1872. if self.timer > 0.16 then
  1873. local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
  1874. for k, obj in pairs(objs) do
  1875. if obj:get_luaentity() ~= nil then
  1876. if obj:get_luaentity().name ~= "minerdream:shuriken" and obj:get_luaentity().name ~= "__builtin:item" then
  1877. local damage = 4
  1878. obj:punch(self.object, 1.0, {
  1879. full_punch_interval = 1.0,
  1880. damage_groups= {fleshy = damage},
  1881. }, nil)
  1882. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  1883. self.object:remove()
  1884. end
  1885. else
  1886. local damage = 4
  1887. obj:punch(self.object, 1.0, {
  1888. full_punch_interval = 1.0,
  1889. damage_groups= {fleshy = damage},
  1890. }, nil)
  1891. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  1892. self.object:remove()
  1893. end
  1894. end
  1895. end
  1896. if self.lastpos.x ~= nil then
  1897. if minetest.registered_nodes[node.name].walkable then
  1898. if not minetest.setting_getbool("creative_mode") then
  1899. minetest.add_item(self.lastpos, "minerdream:shuriken")
  1900. end
  1901. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  1902. self.object:remove()
  1903. end
  1904. end
  1905. self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
  1906. end
  1907. minetest.register_entity("minerdream:shuriken", minerdream_shuriken)
  1908. minetest.register_craftitem("minerdream:throwing_knife", {
  1909. description = "".. core.colorize("#40FF80", "throwing_knife\n")..core.colorize("#A0A0A0", "tier: 4 (rare)\n")..core.colorize("#A0A0A0", "throwable speed: 25\n")..core.colorize("#A0A0A0", "throwable gravity: 6\n")..core.colorize("#A0A0A0", "throwing damage: 6"),
  1910. range = 0,
  1911. stack_max= 500,
  1912. inventory_image = "minerdream_throwing_knife.png",
  1913. on_use = function(itemstack, user, pointed_thing)
  1914. if not minetest.setting_getbool("creative_mode") then itemstack:take_item()
  1915. end
  1916. if pointed_thing.type ~= "nothing" then
  1917. local pointed = minetest.get_pointed_thing_position(pointed_thing)
  1918. if vector.distance(user:getpos(), pointed) < 8 then
  1919. return itemstack
  1920. end
  1921. end
  1922. local pos = user:getpos()
  1923. local dir = user:get_look_dir()
  1924. local yaw = user:get_look_yaw()
  1925. if pos and dir then
  1926. pos.y = pos.y + 1.5
  1927. local obj = minetest.add_entity(pos, "minerdream:throwing_knife")
  1928. if obj then
  1929. obj:setvelocity({x=dir.x * 25, y=dir.y * 25, z=dir.z * 25})
  1930. obj:setacceleration({x=dir.x * -6, y=-6, z=dir.z * -6})
  1931. obj:setyaw(yaw + math.pi)
  1932. local ent = obj:get_luaentity()
  1933. if ent then
  1934. ent.player = ent.player or user
  1935. end
  1936. end
  1937. end
  1938. return itemstack
  1939. end,
  1940. })
  1941. local minerdream_throwing_knife = {
  1942. physical = false,
  1943. timer = 0,
  1944. visual = "wielditem",
  1945. visual_size = {x=0.5, y=0.5,},
  1946. textures = {'minerdream:thrownknife'},
  1947. lastpos= {},
  1948. collisionbox = {0, 0, 0, 0, 0, 0},
  1949. }
  1950. minerdream_throwing_knife.on_step = function(self, dtime)
  1951. self.timer = self.timer + dtime
  1952. local pos = self.object:getpos()
  1953. local node = minetest.get_node(pos)
  1954. if self.timer > 0.145 then
  1955. local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
  1956. for k, obj in pairs(objs) do
  1957. if obj:get_luaentity() ~= nil then
  1958. if obj:get_luaentity().name ~= "minerdream:throwing_knife" and obj:get_luaentity().name ~= "__builtin:item" then
  1959. local damage = 6
  1960. obj:punch(self.object, 1.0, {
  1961. full_punch_interval = 1.0,
  1962. damage_groups= {fleshy = damage},
  1963. }, nil)
  1964. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  1965. self.object:remove()
  1966. end
  1967. else
  1968. local damage = 6
  1969. obj:punch(self.object, 1.0, {
  1970. full_punch_interval = 1.0,
  1971. damage_groups= {fleshy = damage},
  1972. }, nil)
  1973. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  1974. self.object:remove()
  1975. end
  1976. end
  1977. end
  1978. if self.lastpos.x ~= nil then
  1979. if minetest.registered_nodes[node.name].walkable then
  1980. if not minetest.setting_getbool("creative_mode") then
  1981. minetest.add_item(self.lastpos, "minerdream:throwing_knife")
  1982. end
  1983. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  1984. self.object:remove()
  1985. end
  1986. end
  1987. self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
  1988. end
  1989. minetest.register_entity("minerdream:throwing_knife", minerdream_throwing_knife)
  1990. minetest.register_craftitem("minerdream:thrownknife", {
  1991. inventory_image = "minerdream_thrownknife.png",
  1992. })
  1993. minetest.register_craftitem("minerdream:dark_shuriken", {
  1994. description = "".. core.colorize("#00FF00", "dark shuriken\n")..core.colorize("#A0A0A0", "tier: 6 (epic)\n")..core.colorize("#A0A0A0", "throwable speed: 50\n")..core.colorize("#A0A0A0", "throwable gravity: 5\n")..core.colorize("#A0A0A0", "throwing damage: 8"),
  1995. range = 0,
  1996. stack_max= 500,
  1997. inventory_image = "minerdream_dark_shuriken.png",
  1998. on_use = function(itemstack, user, pointed_thing)
  1999. if not minetest.setting_getbool("creative_mode") then itemstack:take_item()
  2000. end
  2001. if pointed_thing.type ~= "nothing" then
  2002. local pointed = minetest.get_pointed_thing_position(pointed_thing)
  2003. if vector.distance(user:getpos(), pointed) < 8 then
  2004. return itemstack
  2005. end
  2006. end
  2007. local pos = user:getpos()
  2008. local dir = user:get_look_dir()
  2009. local yaw = user:get_look_yaw()
  2010. if pos and dir then
  2011. pos.y = pos.y + 1.5
  2012. local obj = minetest.add_entity(pos, "minerdream:dark_shuriken")
  2013. if obj then
  2014. obj:setvelocity({x=dir.x * 50, y=dir.y * 50, z=dir.z * 50})
  2015. obj:setacceleration({x=dir.x * -5, y=-5, z=dir.z * -5})
  2016. obj:setyaw(yaw + math.pi)
  2017. local ent = obj:get_luaentity()
  2018. if ent then
  2019. ent.player = ent.player or user
  2020. end
  2021. end
  2022. end
  2023. return itemstack
  2024. end,
  2025. })
  2026. local minerdream_dark_shuriken = {
  2027. physical = false,
  2028. timer = 0,
  2029. visual = "cube",
  2030. visual_size = {x=0.5, y=0.0,},
  2031. textures = {'minerdream_dark_shuriken.png','minerdream_dark_shuriken.png','minerdream_dark_shuriken.png','minerdream_dark_shuriken.png','minerdream_dark_shuriken.png','minerdream_dark_shuriken.png'},
  2032. lastpos= {},
  2033. collisionbox = {0, 0, 0, 0, 0, 0},
  2034. }
  2035. minerdream_dark_shuriken.on_step = function(self, dtime)
  2036. self.timer = self.timer + dtime
  2037. local pos = self.object:getpos()
  2038. local node = minetest.get_node(pos)
  2039. if self.timer > 0.065 then
  2040. local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
  2041. for k, obj in pairs(objs) do
  2042. if obj:get_luaentity() ~= nil then
  2043. if obj:get_luaentity().name ~= "minerdream:dark_shuriken" and obj:get_luaentity().name ~= "__builtin:item" then
  2044. local damage = 8
  2045. obj:punch(self.object, 1.0, {
  2046. full_punch_interval = 1.0,
  2047. damage_groups= {fleshy = damage},
  2048. }, nil)
  2049. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  2050. self.object:remove()
  2051. end
  2052. else
  2053. local damage = 8
  2054. obj:punch(self.object, 1.0, {
  2055. full_punch_interval = 1.0,
  2056. damage_groups= {fleshy = damage},
  2057. }, nil)
  2058. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  2059. self.object:remove()
  2060. end
  2061. end
  2062. end
  2063. if self.lastpos.x ~= nil then
  2064. if minetest.registered_nodes[node.name].walkable then
  2065. if not minetest.setting_getbool("creative_mode") then
  2066. minetest.add_item(self.lastpos, "minerdream:dark_shuriken")
  2067. end
  2068. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  2069. self.object:remove()
  2070. end
  2071. end
  2072. self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
  2073. end
  2074. minetest.register_entity("minerdream:dark_shuriken", minerdream_dark_shuriken)
  2075. ----------------specthrowables-------
  2076. minetest.register_craftitem("minerdream:grenade", {
  2077. description = "".. core.colorize("#00FFFF", "Grenade\n")..core.colorize("#A0A0A0", "tier: 3 (almost rare)\n")..core.colorize("#A0A0A0", "throwable speed: 15\n")..core.colorize("#A0A0A0", "throwable gravity: 7\n")..core.colorize("#A0A0A0", "explosion range : 3\n")..core.colorize("#A0A0A0", "explosive damage: 15"),
  2078. range = 0,
  2079. stack_max= 25,
  2080. inventory_image = "minerdream_grenade.png",
  2081. on_use = function(itemstack, user, pointed_thing)
  2082. if not minetest.setting_getbool("creative_mode") then itemstack:take_item()
  2083. end
  2084. if pointed_thing.type ~= "nothing" then
  2085. local pointed = minetest.get_pointed_thing_position(pointed_thing)
  2086. if vector.distance(user:getpos(), pointed) < 8 then
  2087. return itemstack
  2088. end
  2089. end
  2090. local pos = user:getpos()
  2091. local dir = user:get_look_dir()
  2092. local yaw = user:get_look_yaw()
  2093. if pos and dir then
  2094. pos.y = pos.y + 1.5
  2095. local obj = minetest.add_entity(pos, "minerdream:grenade")
  2096. if obj then
  2097. obj:setvelocity({x=dir.x * 15, y=dir.y * 15, z=dir.z * 15})
  2098. obj:setacceleration({x=dir.x * -7, y=-7, z=dir.z * -7})
  2099. obj:setyaw(yaw + math.pi)
  2100. local ent = obj:get_luaentity()
  2101. if ent then
  2102. ent.player = ent.player or user
  2103. end
  2104. end
  2105. end
  2106. return itemstack
  2107. end,
  2108. })
  2109. local minerdream_grenade = {
  2110. physical = false,
  2111. timer = 0,
  2112. visual = "sprite",
  2113. visual_size = {x=0.30, y=0.30,},
  2114. textures = {'minerdream_grenade_nopin.png'},
  2115. lastpos= {},
  2116. collisionbox = {0, 0, 0, 0, 0, 0},
  2117. }
  2118. minerdream_grenade.on_step = function(self, dtime)
  2119. self.timer = self.timer + dtime
  2120. local pos = self.object:getpos()
  2121. local node = minetest.get_node(pos)
  2122. if self.timer > 0.2 then
  2123. local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
  2124. for k, obj in pairs(objs) do
  2125. if obj:get_luaentity() ~= nil then
  2126. if obj:get_luaentity().name ~= "minerdream:grenade" and obj:get_luaentity().name ~= "__builtin:item" then
  2127. local damage = 0
  2128. obj:punch(self.object, 1.0, {
  2129. full_punch_interval = 1.0,
  2130. damage_groups= {fleshy = damage},
  2131. }, nil)
  2132. end
  2133. else
  2134. local damage = 0
  2135. obj:punch(self.object, 1.0, {
  2136. full_punch_interval = 1.0,
  2137. damage_groups= {fleshy = damage},
  2138. }, nil)
  2139. end
  2140. end
  2141. end
  2142. if self.lastpos.x ~= nil then
  2143. if minetest.registered_nodes[node.name].walkable then
  2144. if not minetest.setting_getbool("creative_mode") then
  2145. minetest.add_entity(self.lastpos, "minerdream:grenade_explosion")
  2146. minetest.add_entity(self.lastpos, "minerdream:grenadedmg")
  2147. end
  2148. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  2149. self.object:remove()
  2150. end
  2151. end
  2152. self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
  2153. end
  2154. minetest.register_entity("minerdream:grenade", minerdream_grenade )
  2155. local minerdream_grenade_explosion = {
  2156. physical = false,
  2157. timer = 0,
  2158. visual = "mesh",
  2159. mesh = "boom.obj",
  2160. visual_size = {x=45.0, y=45.0,},
  2161. textures = {'minerdream_boom.png'},
  2162. lastpos= {},
  2163. collisionbox = {0, 0, 0, 0, 0, 0},
  2164. }
  2165. minerdream_grenade_explosion.on_step = function(self, dtime)
  2166. self.timer = self.timer + dtime
  2167. local pos = self.object:getpos()
  2168. local node = minetest.get_node(pos)
  2169. local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 3)
  2170. for k, obj in pairs(objs) do
  2171. if obj:get_luaentity() ~= nil then
  2172. if obj:get_luaentity().name ~= "minerdream:grenade_explosion" and obj:get_luaentity().name ~= "__builtin:item" then
  2173. local damage = 0
  2174. obj:punch(self.object, 0.1, {
  2175. full_punch_interval = 0.1,
  2176. damage_groups= {fleshy = damage},
  2177. }, nil)
  2178. minetest.sound_play("minerdream_explosion", {pos = self.lastpos, gain = 0.8})
  2179. end
  2180. else
  2181. local damage = 0
  2182. obj:punch(self.object, 0.1, {
  2183. full_punch_interval = 0.1,
  2184. damage_groups= {fleshy = damage},
  2185. }, nil)
  2186. minetest.sound_play("minerdream_explosion", {pos = self.lastpos, gain = 0.8})
  2187. end
  2188. if self.timer > 0.1 then
  2189. self.object:remove()
  2190. end
  2191. end
  2192. self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
  2193. end
  2194. minetest.register_entity("minerdream:grenade_explosion", minerdream_grenade_explosion )
  2195. local minerdream_grenadedmg = {
  2196. physical = false,
  2197. timer = 0,
  2198. visual = "sprite",
  2199. visual_size = {x=0.30, y=0.30,},
  2200. textures = {'minerdream_grenade_nopin.png'},
  2201. lastpos= {},
  2202. collisionbox = {0, 0, 0, 0, 0, 0},
  2203. }
  2204. minerdream_grenadedmg.on_step = function(self, dtime)
  2205. self.timer = self.timer + dtime
  2206. local pos = self.object:getpos()
  2207. local node = minetest.get_node(pos)
  2208. local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 3)
  2209. for k, obj in pairs(objs) do
  2210. if obj:get_luaentity() ~= nil then
  2211. if obj:get_luaentity().name ~= "minerdream:grenadedmg" and obj:get_luaentity().name ~=
  2212. "minerdream:grenade_explosion" and obj:get_luaentity().name ~= "__builtin:item" then
  2213. local damage = 15
  2214. obj:punch(self.object, 1.0, {
  2215. full_punch_interval = 1.0,
  2216. damage_groups= {fleshy = damage},
  2217. }, nil)
  2218. self.object:remove()
  2219. end
  2220. else
  2221. local damage = 15
  2222. obj:punch(self.object, 0.1, {
  2223. full_punch_interval = 0.1,
  2224. damage_groups= {fleshy = damage},
  2225. }, nil)
  2226. minetest.sound_play("", {pos = self.lastpos, gain = 0.8})
  2227. self.object:remove()
  2228. end
  2229. if self.timer > 0.075 then
  2230. self.object:remove()
  2231. end
  2232. end
  2233. self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
  2234. end
  2235. minetest.register_entity("minerdream:grenadedmg", minerdream_grenadedmg )
  2236. --------------magic-------------------
  2237. minetest.register_tool("minerdream:amethyst_staff", {
  2238. description = "".. core.colorize("#0040FF", "Amethyst staff\n")..core.colorize("#A0A0A0", "tier: 5 (extra rare)\n")..core.colorize("#A0A0A0", "projectile speed: 15\n")..core.colorize("#A0A0A0", "magic damage: 7\n")..core.colorize("#A0A0A0", "mana usage: 10"),
  2239. inventory_image = "minerdream_amethyst_staff.png",
  2240. wield_scale = {x=1.25,y=1.25,z=1.25},
  2241. on_use = function(itemstack, placer, pointed_thing)
  2242. if mana.subtract(placer:get_player_name(), 10) then
  2243. local dir = placer:get_look_dir();
  2244. local yaw = placer:get_look_yaw()
  2245. local playerpos = placer:getpos();
  2246. local obj = minetest.env:add_entity({x=playerpos.x+0+dir.x,y=playerpos.y+1.5+dir.y,z=playerpos.z+0+dir.z}, "minerdream:amethyst_ray")
  2247. local vec = {x=dir.x*15,y=dir.y*15,z=dir.z*15}
  2248. obj:setvelocity(vec)
  2249. local acc = {x=dir.x*0,y=dir.y*0,z=dir.z*0}
  2250. obj:setacceleration(acc)
  2251. obj:setyaw(yaw + math.pi)
  2252. end
  2253. return itemstack
  2254. end,
  2255. })
  2256. local minerdream_amethyst_ray = {
  2257. physical = false,
  2258. timer = 0,
  2259. visual = "wielditem",
  2260. visual_size = {x=0.5, y=0.5,},
  2261. textures = {'minerdream:amethyst_ray'},
  2262. lastpos= {},
  2263. collisionbox = {0, 0, 0, 0, 0, 0},
  2264. }
  2265. minerdream_amethyst_ray.on_step = function(self, dtime)
  2266. self.timer = self.timer + dtime
  2267. local pos = self.object:getpos()
  2268. local node = minetest.get_node(pos)
  2269. if self.timer > 0.15 then
  2270. local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
  2271. for k, obj in pairs(objs) do
  2272. if obj:get_luaentity() ~= nil then
  2273. if obj:get_luaentity().name ~= "minerdream:amethyst_ray" and obj:get_luaentity().name ~= "__builtin:item" then
  2274. local damage = 7
  2275. obj:punch(self.object, 1.0, {
  2276. full_punch_interval = 1.0,
  2277. damage_groups= {fleshy = damage},
  2278. }, nil)
  2279. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  2280. self.object:remove()
  2281. end
  2282. else
  2283. local damage = 7
  2284. obj:punch(self.object, 1.0, {
  2285. full_punch_interval = 1.0,
  2286. damage_groups= {fleshy = damage},
  2287. }, nil)
  2288. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  2289. self.object:remove()
  2290. end
  2291. end
  2292. end
  2293. if self.lastpos.x ~= nil then
  2294. if minetest.registered_nodes[node.name].walkable then
  2295. if not minetest.setting_getbool("creative_mode") then
  2296. minetest.add_item(self.lastpos, "")
  2297. end
  2298. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  2299. self.object:remove()
  2300. end
  2301. end
  2302. self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
  2303. end
  2304. minetest.register_entity("minerdream:amethyst_ray", minerdream_amethyst_ray )
  2305. minetest.register_craftitem("minerdream:amethyst_ray", {
  2306. inventory_image = "minerdream_amethyst_ray.png",
  2307. })
  2308. minetest.register_tool("minerdream:ocean_staff", {
  2309. description = "".. core.colorize("#00FF00", "Staff of ocean\n")..core.colorize("#A0A0A0", "tier: 6 (epic)\n")..core.colorize("#A0A0A0", "projectile speed: 10-15\n")..core.colorize("#A0A0A0", "magic damage: 4\n")..core.colorize("#A0A0A0", "mana usage: 25\n")..core.colorize("#A0A0A0", "Sprays a beam of water, that can hit 6 times, and extiguish flames"),
  2310. inventory_image = "minerdream_oceanstaff.png",
  2311. wield_scale = {x=1.25,y=1.25,z=1.25},
  2312. on_use = function(itemstack, placer, user, pointed_thing)
  2313. if mana.subtract(placer:get_player_name(), 25) then
  2314. local dir = placer:get_look_dir();
  2315. local yaw = placer:get_look_yaw()
  2316. local playerpos = placer:getpos();
  2317. local obj = minetest.env:add_entity({x=playerpos.x+0+dir.x,y=playerpos.y+1.5+dir.y,z=playerpos.z+0+dir.z}, "minerdream:water_ray")
  2318. local vec = {x=dir.x*10,y=dir.y*10,z=dir.z*10}
  2319. obj:setvelocity(vec)
  2320. local acc = {x=dir.x*0,y=dir.y*0,z=dir.z*0}
  2321. obj:setacceleration(acc)
  2322. obj:setyaw(yaw + math.pi)
  2323. minetest.sound_play("minerdream_waterspray", {object=obj})
  2324. ---------------------------------------------------
  2325. local dir = placer:get_look_dir();
  2326. local yaw = placer:get_look_yaw()
  2327. local playerpos = placer:getpos();
  2328. local obj = minetest.env:add_entity({x=playerpos.x+0+dir.x,y=playerpos.y+1.5+dir.y,z=playerpos.z+0+dir.z}, "minerdream:water_ray")
  2329. local vec = {x=dir.x*11,y=dir.y*11,z=dir.z*11}
  2330. obj:setvelocity(vec)
  2331. local acc = {x=dir.x*0,y=dir.y*0,z=dir.z*0}
  2332. obj:setacceleration(acc)
  2333. obj:setyaw(yaw + math.pi)
  2334. ---------------------------------------------------
  2335. local dir = placer:get_look_dir();
  2336. local yaw = placer:get_look_yaw()
  2337. local playerpos = placer:getpos();
  2338. local obj = minetest.env:add_entity({x=playerpos.x+0+dir.x,y=playerpos.y+1.5+dir.y,z=playerpos.z+0+dir.z}, "minerdream:water_ray")
  2339. local vec = {x=dir.x*12,y=dir.y*12,z=dir.z*12}
  2340. obj:setvelocity(vec)
  2341. local acc = {x=dir.x*0,y=dir.y*0,z=dir.z*0}
  2342. obj:setacceleration(acc)
  2343. obj:setyaw(yaw + math.pi)
  2344. ---------------------------------------------------
  2345. local dir = placer:get_look_dir();
  2346. local yaw = placer:get_look_yaw()
  2347. local playerpos = placer:getpos();
  2348. local obj = minetest.env:add_entity({x=playerpos.x+0+dir.x,y=playerpos.y+1.5+dir.y,z=playerpos.z+0+dir.z}, "minerdream:water_ray")
  2349. local vec = {x=dir.x*13,y=dir.y*13,z=dir.z*13}
  2350. obj:setvelocity(vec)
  2351. local acc = {x=dir.x*0,y=dir.y*0,z=dir.z*0}
  2352. obj:setacceleration(acc)
  2353. obj:setyaw(yaw + math.pi)
  2354. ---------------------------------------------------
  2355. local dir = placer:get_look_dir();
  2356. local yaw = placer:get_look_yaw()
  2357. local playerpos = placer:getpos();
  2358. local obj = minetest.env:add_entity({x=playerpos.x+0+dir.x,y=playerpos.y+1.5+dir.y,z=playerpos.z+0+dir.z}, "minerdream:water_ray")
  2359. local vec = {x=dir.x*14,y=dir.y*14,z=dir.z*14}
  2360. obj:setvelocity(vec)
  2361. local acc = {x=dir.x*0,y=dir.y*0,z=dir.z*0}
  2362. obj:setacceleration(acc)
  2363. obj:setyaw(yaw + math.pi)
  2364. ---------------------------------------------------
  2365. local dir = placer:get_look_dir();
  2366. local yaw = placer:get_look_yaw()
  2367. local playerpos = placer:getpos();
  2368. local obj = minetest.env:add_entity({x=playerpos.x+0+dir.x,y=playerpos.y+1.5+dir.y,z=playerpos.z+0+dir.z}, "minerdream:water_ray")
  2369. local vec = {x=dir.x*15,y=dir.y*15,z=dir.z*15}
  2370. obj:setvelocity(vec)
  2371. local acc = {x=dir.x*0,y=dir.y*0,z=dir.z*0}
  2372. obj:setacceleration(acc)
  2373. obj:setyaw(yaw + math.pi)
  2374. end
  2375. return itemstack
  2376. end,
  2377. })
  2378. local minerdream_water_ray = {
  2379. physical = false,
  2380. timer = 0,
  2381. visual = "wielditem",
  2382. visual_size = {x=1.25, y=1.25,},
  2383. textures = {'minerdream:water_ray'},
  2384. lastpos= {},
  2385. collisionbox = {0, 0, 0, 0, 0, 0},
  2386. }
  2387. minerdream_water_ray.on_step = function(self, dtime)
  2388. self.timer = self.timer + dtime
  2389. local pos = self.object:getpos()
  2390. local node = minetest.get_node(pos)
  2391. if self.timer > 0.15 then
  2392. local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
  2393. for k, obj in pairs(objs) do
  2394. if obj:get_luaentity() ~= nil then
  2395. if obj:get_luaentity().name ~= "minerdream:water_ray" and obj:get_luaentity().name ~= "__builtin:item" then
  2396. local damage = 4
  2397. obj:punch(self.object, 1.0, {
  2398. full_punch_interval = 1.0,
  2399. damage_groups= {fleshy = damage},
  2400. }, nil)
  2401. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  2402. self.object:remove()
  2403. end
  2404. else
  2405. local damage = 4
  2406. obj:punch(self.object, 1.0, {
  2407. full_punch_interval = 1.0,
  2408. damage_groups= {fleshy = damage},
  2409. }, nil)
  2410. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  2411. end
  2412. end
  2413. end
  2414. if self.lastpos.x ~= nil then
  2415. if minetest.registered_nodes[node.name].walkable then
  2416. if not minetest.setting_getbool("creative_mode") then
  2417. minetest.add_item(self.lastpos, "")
  2418. end
  2419. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  2420. self.object:remove()
  2421. end
  2422. if math.floor(self.lastpos.x+0.5) ~= math.floor(pos.x+0.5) or math.floor(self.lastpos.y+0.5) ~= math.floor(pos.y+0.5) or math.floor(self.lastpos.z+0.5) ~= math.floor(pos.z+0.5) then
  2423. if minetest.env:get_node(self.lastpos).name == "fire:basic_flame" then
  2424. minetest.env:remove_node(self.lastpos)
  2425. minetest.sound_play("minerdream_extinguish", {pos = self.lastpos, gain = 0.8})
  2426. end
  2427. end
  2428. end
  2429. self.lastpos={x=pos.x, y=pos.y, z=pos.z}
  2430. end
  2431. minetest.register_entity("minerdream:water_ray", minerdream_water_ray )
  2432. minetest.register_craftitem("minerdream:water_ray", {
  2433. inventory_image = "minerdream_water_ray.png",
  2434. })
  2435. minetest.register_tool("minerdream:pink_blaster", {
  2436. description = "".. core.colorize("#00FF00", "Pink blaster\n")..core.colorize("#A0A0A0", "tier: 6 (epic)\n")..core.colorize("#A0A0A0", "projectile speed: 35\n")..core.colorize("#A0A0A0", "magic damage: 7\n")..core.colorize("#A0A0A0", "mana usage: 20\n")..core.colorize("#A0A0A0", "Shoots out a pink ray, that penetrates enemies"),
  2437. inventory_image = "minerdream_pink_blaster.png",
  2438. wield_scale = {x=1.1,y=1.1,z=1.1},
  2439. on_use = function(itemstack, placer, user, pointed_thing)
  2440. if mana.subtract(placer:get_player_name(), 20) then
  2441. local dir = placer:get_look_dir();
  2442. local yaw = placer:get_look_yaw()
  2443. local playerpos = placer:getpos();
  2444. local obj = minetest.env:add_entity({x=playerpos.x+0+dir.x,y=playerpos.y+1.5+dir.y,z=playerpos.z+0+dir.z}, "minerdream:pink_ray")
  2445. local vec = {x=dir.x*35,y=dir.y*35,z=dir.z*35}
  2446. obj:setvelocity(vec)
  2447. local acc = {x=dir.x*0,y=dir.y*0,z=dir.z*0}
  2448. obj:setacceleration(acc)
  2449. obj:setyaw(yaw + math.pi)
  2450. minetest.sound_play("minerdream_laser", {object=obj})
  2451. end
  2452. return itemstack
  2453. end,
  2454. })
  2455. local minerdream_pink_ray = {
  2456. physical = false,
  2457. timer = 0,
  2458. visual = "wielditem",
  2459. visual_size = {x=0.5, y=0.5,},
  2460. textures = {'minerdream:pink_ray'},
  2461. lastpos= {},
  2462. collisionbox = {0, 0, 0, 0, 0, 0},
  2463. }
  2464. minerdream_pink_ray.on_step = function(self, dtime)
  2465. self.timer = self.timer + dtime
  2466. local pos = self.object:getpos()
  2467. local node = minetest.get_node(pos)
  2468. if self.timer > 0.12 then
  2469. local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
  2470. for k, obj in pairs(objs) do
  2471. if obj:get_luaentity() ~= nil then
  2472. if obj:get_luaentity().name ~= "minerdream:pink_ray" and obj:get_luaentity().name ~= "__builtin:item" then
  2473. local damage = 7
  2474. obj:punch(self.object, 1.0, {
  2475. full_punch_interval = 1.0,
  2476. damage_groups= {fleshy = damage},
  2477. }, nil)
  2478. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  2479. end
  2480. else
  2481. local damage = 7
  2482. obj:punch(self.object, 1.0, {
  2483. full_punch_interval = 1.0,
  2484. damage_groups= {fleshy = damage},
  2485. }, nil)
  2486. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  2487. end
  2488. end
  2489. end
  2490. if self.lastpos.x ~= nil then
  2491. if minetest.registered_nodes[node.name].walkable then
  2492. if not minetest.setting_getbool("creative_mode") then
  2493. minetest.add_item(self.lastpos, "")
  2494. end
  2495. minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
  2496. self.object:remove()
  2497. end
  2498. end
  2499. self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
  2500. end
  2501. minetest.register_entity("minerdream:pink_ray", minerdream_pink_ray )
  2502. minetest.register_craftitem("minerdream:pink_ray", {
  2503. inventory_image = "minerdream_pink_ray.png",
  2504. })
  2505. minetest.register_tool('minerdream:golden_crystal_trisword', {
  2506. description = "".. core.colorize("#00FF00", "Golden crystal tri-sword\n")..core.colorize("#A0A0A0", "tier: 6 (epic)\n")..core.colorize("#A0A0A0", "mele damage: 18\n")..core.colorize("#A0A0A0", "range: 4.8 \n")..core.colorize("#A0A0A0", "attack interval: 0.725 "),
  2507. wield_scale = {x=1.45,y=1.45,z=1.45},
  2508. inventory_image = "minerdream_golden_crystal_trisword.png",
  2509. range = 4.8,
  2510. tool_capabilities = {
  2511. full_punch_interval = 0.725,
  2512. max_drop_level=1,
  2513. groupcaps={
  2514. snappy={times={[1]=1.50, [2]=0.7, [3]=0.10}, uses=80, maxlevel=3},
  2515. },
  2516. damage_groups = {fleshy=18},
  2517. },
  2518. })
  2519. ----------------spears---------------
  2520. minetest.register_tool("minerdream:spear_bronze", {
  2521. description = "".. core.colorize("#BFFFFF", "Bronze spear\n")..core.colorize("#A0A0A0", "tier: 2 (uncommon)\n")..core.colorize("#A0A0A0", "mele damage: 7\n")..core.colorize("#A0A0A0", "range: 6.0 \n")..core.colorize("#A0A0A0", "attack interval: 1.50 "),
  2522. inventory_image = "minerdream_spear_bronze.png",
  2523. wield_scale = {x=2.0,y=2.0,z=1.0},
  2524. range = 6.00,
  2525. tool_capabilities = {
  2526. full_punch_interval = 1.50,
  2527. max_drop_level=1,
  2528. groupcaps={
  2529. },
  2530. damage_groups = {fleshy=7},
  2531. },
  2532. sound = {breaks = "default_tool_breaks"},
  2533. })
  2534. minetest.register_tool("minerdream:spear_flint", {
  2535. description = "".. core.colorize("#FFFFFF", "Flint spear\n")..core.colorize("#A0A0A0", "tier: 1 (common)\n")..core.colorize("#A0A0A0", "mele damage: 7\n")..core.colorize("#A0A0A0", "range: 5.9 \n")..core.colorize("#A0A0A0", "attack interval: 1.60 "),
  2536. inventory_image = "minerdream_spear_flint.png",
  2537. wield_scale = {x=1.975,y=1.975,z=0.985},
  2538. range = 5.90,
  2539. tool_capabilities = {
  2540. full_punch_interval = 1.60,
  2541. max_drop_level=1,
  2542. groupcaps={
  2543. },
  2544. damage_groups = {fleshy=7},
  2545. },
  2546. sound = {breaks = "default_tool_breaks"},
  2547. })
  2548. minetest.register_tool("minerdream:spear_steel", {
  2549. description = "".. core.colorize("#BFFFFF", "Steel spear\n")..core.colorize("#A0A0A0", "tier: 2 (uncommon)\n")..core.colorize("#A0A0A0", "mele damage: 7.25\n")..core.colorize("#A0A0A0", "range: 6.1 \n")..core.colorize("#A0A0A0", "attack interval: 1.475 "),
  2550. inventory_image = "minerdream_spear_steel.png",
  2551. wield_scale = {x=2.1,y=2.1,z=1.05},
  2552. range = 6.1,
  2553. tool_capabilities = {
  2554. full_punch_interval = 1.475,
  2555. max_drop_level=1,
  2556. groupcaps={
  2557. },
  2558. damage_groups = {fleshy=7.25},
  2559. },
  2560. sound = {breaks = "default_tool_breaks"},
  2561. })
  2562. minetest.register_tool("minerdream:spear_stainlesssteel", {
  2563. description = "".. core.colorize("#BFFFFF", "Stainless steel spear\n")..core.colorize("#A0A0A0", "tier: 2 (uncommon)\n")..core.colorize("#A0A0A0", "mele damage: 7.25\n")..core.colorize("#A0A0A0", "range: 6.1 \n")..core.colorize("#A0A0A0", "attack interval: 1.475 "),
  2564. inventory_image = "minerdream_spear_stainlesssteel.png",
  2565. wield_scale = {x=2.1,y=2.1,z=1.05},
  2566. range = 6.1,
  2567. tool_capabilities = {
  2568. full_punch_interval = 1.475,
  2569. max_drop_level=1,
  2570. groupcaps={
  2571. },
  2572. damage_groups = {fleshy=7.25},
  2573. },
  2574. sound = {breaks = "default_tool_breaks"},
  2575. })
  2576. minetest.register_tool("minerdream:spear_nickel", {
  2577. description = "".. core.colorize("#BFFFFF", "Nickel spear\n")..core.colorize("#A0A0A0", "tier: 2 (uncommon)\n")..core.colorize("#A0A0A0", "mele damage: 7.75\n")..core.colorize("#A0A0A0", "range: 6.2 \n")..core.colorize("#A0A0A0", "attack interval: 1.45 "),
  2578. inventory_image = "minerdream_spear_nickel.png",
  2579. wield_scale = {x=2.2,y=2.2,z=1.1},
  2580. range = 6.2,
  2581. tool_capabilities = {
  2582. full_punch_interval = 1.45,
  2583. max_drop_level=1,
  2584. groupcaps={
  2585. },
  2586. damage_groups = {fleshy=7.75},
  2587. },
  2588. sound = {breaks = "default_tool_breaks"},
  2589. })
  2590. minetest.register_tool('minerdream:spear_gold', {
  2591. description = "".. core.colorize("#00FFFF", "Golden spear\n")..core.colorize("#A0A0A0", "tier: 3 (almost rare)\n")..core.colorize("#A0A0A0", "mele damage: 8\n")..core.colorize("#A0A0A0", "range: 6.25 \n")..core.colorize("#A0A0A0", "attack interval: 1.675 "),
  2592. wield_scale = {x=2.3,y=2.3,z=1.15},
  2593. inventory_image = "minerdream_spear_gold.png",
  2594. range = 6.25,
  2595. tool_capabilities = {
  2596. full_punch_interval = 1.675,
  2597. max_drop_level=1,
  2598. groupcaps={
  2599. },
  2600. damage_groups = {fleshy=8},
  2601. },
  2602. })
  2603. minetest.register_tool('minerdream:spear_lead', {
  2604. description = "".. core.colorize("#00FFFF", "Golden spear\n")..core.colorize("#A0A0A0", "tier: 3 (almost rare)\n")..core.colorize("#A0A0A0", "mele damage: 11\n")..core.colorize("#A0A0A0", "range: 6.25 \n")..core.colorize("#A0A0A0", "attack interval: 2.2 "),
  2605. wield_scale = {x=2.3,y=2.3,z=1.15},
  2606. inventory_image = "minerdream_spear_lead.png",
  2607. range = 6.25,
  2608. tool_capabilities = {
  2609. full_punch_interval = 2.2,
  2610. max_drop_level=1,
  2611. groupcaps={
  2612. },
  2613. damage_groups = {fleshy=11},
  2614. },
  2615. })
  2616. minetest.register_tool('minerdream:spear_silver', {
  2617. description = "".. core.colorize("#00FFFF", "Silver spear\n")..core.colorize("#A0A0A0", "tier: 3 (almost rare)\n")..core.colorize("#A0A0A0", "mele damage: 8\n")..core.colorize("#A0A0A0", "range: 6.25 \n")..core.colorize("#A0A0A0", "attack interval: 1.475 "),
  2618. wield_scale = {x=2.3,y=2.3,z=1.15},
  2619. inventory_image = "minerdream_spear_silver.png",
  2620. range = 6.25,
  2621. tool_capabilities = {
  2622. full_punch_interval = 1.475,
  2623. max_drop_level=1,
  2624. groupcaps={
  2625. },
  2626. damage_groups = {fleshy=8},
  2627. },
  2628. })
  2629. minetest.register_tool('minerdream:spear_mese', {
  2630. description = "".. core.colorize("#00FFFF", "MESE spear\n")..core.colorize("#A0A0A0", "tier: 3 (almost rare)\n")..core.colorize("#A0A0A0", "mele damage: 8\n")..core.colorize("#A0A0A0", "range: 6.25 \n")..core.colorize("#A0A0A0", "attack interval: 1.475 "),
  2631. wield_scale = {x=2.3,y=2.3,z=1.15},
  2632. inventory_image = "minerdream_spear_mese.png",
  2633. range = 6.25,
  2634. tool_capabilities = {
  2635. full_punch_interval = 1.475,
  2636. max_drop_level=1,
  2637. groupcaps={
  2638. },
  2639. damage_groups = {fleshy=8},
  2640. },
  2641. })
  2642. minetest.register_tool('minerdream:spear_diamond', {
  2643. description = "".. core.colorize("#00FFFF", "Soft diamond spear\n")..core.colorize("#A0A0A0", "tier: 3 (almost rare)\n")..core.colorize("#A0A0A0", "mele damage: 9\n")..core.colorize("#A0A0A0", "range: 6.3 \n")..core.colorize("#A0A0A0", "attack interval: 1.45 "),
  2644. wield_scale = {x=2.4,y=2.4,z=1.2},
  2645. inventory_image = "minerdream_spear_diamond.png",
  2646. range = 6.3,
  2647. tool_capabilities = {
  2648. full_punch_interval = 1.45,
  2649. max_drop_level=1,
  2650. groupcaps={
  2651. },
  2652. damage_groups = {fleshy=9},
  2653. },
  2654. })
  2655. minetest.register_tool('minerdream:spear_aluminum', {
  2656. description = "".. core.colorize("#40FF80", "Aluminum spear\n")..core.colorize("#A0A0A0", "tier: 4 (rare)\n")..core.colorize("#A0A0A0", "mele damage: 9\n")..core.colorize("#A0A0A0", "range: 6.7 \n")..core.colorize("#A0A0A0", "attack interval: 1.1 "),
  2657. wield_scale = {x=2.6,y=2.6,z=1.3},
  2658. inventory_image = "minerdream_spear_aluminum.png",
  2659. range = 6.7,
  2660. tool_capabilities = {
  2661. full_punch_interval = 1.1,
  2662. max_drop_level=1,
  2663. groupcaps={
  2664. },
  2665. damage_groups = {fleshy=9},
  2666. },
  2667. })
  2668. minetest.register_tool('minerdream:spear_platinum', {
  2669. description = "".. core.colorize("#40FF80", "Platinum spear\n")..core.colorize("#A0A0A0", "tier: 4 (rare)\n")..core.colorize("#A0A0A0", "mele damage: 10\n")..core.colorize("#A0A0A0", "range: 6.7 \n")..core.colorize("#A0A0A0", "attack interval: 1.3 "),
  2670. wield_scale = {x=2.6,y=2.6,z=1.3},
  2671. inventory_image = "minerdream_spear_platinum.png",
  2672. range = 6.7,
  2673. tool_capabilities = {
  2674. full_punch_interval = 1.3,
  2675. max_drop_level=1,
  2676. groupcaps={
  2677. },
  2678. damage_groups = {fleshy=10},
  2679. },
  2680. })
  2681. minetest.register_tool('minerdream:spear_cobalt', {
  2682. description = "".. core.colorize("#0040FF", "Cobalt spear\n")..core.colorize("#A0A0A0", "tier: 5 (extra rare)\n")..core.colorize("#A0A0A0", "mele damage: 11\n")..core.colorize("#A0A0A0", "range: 6.9 \n")..core.colorize("#A0A0A0", "attack interval: 1.2 "),
  2683. wield_scale = {x=2.8,y=2.8,z=1.4},
  2684. inventory_image = "minerdream_spear_cobalt.png",
  2685. range = 6.9,
  2686. tool_capabilities = {
  2687. full_punch_interval = 1.2,
  2688. max_drop_level=1,
  2689. groupcaps={
  2690. },
  2691. damage_groups = {fleshy=11},
  2692. },
  2693. })
  2694. minetest.register_tool('minerdream:spear_ruthenium', {
  2695. description = "".. core.colorize("#0040FF", "Ruthenium spear\n")..core.colorize("#A0A0A0", "tier: 5 (extra rare)\n")..core.colorize("#A0A0A0", "mele damage: 12\n")..core.colorize("#A0A0A0", "range: 6.9 \n")..core.colorize("#A0A0A0", "attack interval: 1.35 "),
  2696. wield_scale = {x=2.8,y=2.8,z=1.4},
  2697. inventory_image = "minerdream_spear_ruthenium.png",
  2698. range = 6.9,
  2699. tool_capabilities = {
  2700. full_punch_interval = 1.35,
  2701. max_drop_level=1,
  2702. groupcaps={
  2703. },
  2704. damage_groups = {fleshy=12},
  2705. },
  2706. })
  2707. minetest.register_tool('minerdream:spear_tantalum', {
  2708. description = "".. core.colorize("#00FF00", "Tantalum spear\n")..core.colorize("#A0A0A0", "tier: 6 (epic)\n")..core.colorize("#A0A0A0", "mele damage: 15\n")..core.colorize("#A0A0A0", "range: 7.25 \n")..core.colorize("#A0A0A0", "attack interval: 1.30 "),
  2709. wield_scale = {x=3.1,y=3.1,z=1.5},
  2710. inventory_image = "minerdream_spear_tantalum.png",
  2711. range = 7.25,
  2712. tool_capabilities = {
  2713. full_punch_interval = 1.30,
  2714. max_drop_level=1,
  2715. groupcaps={
  2716. },
  2717. damage_groups = {fleshy=15},
  2718. },
  2719. })
  2720. minetest.register_tool('minerdream:spear_rhodium', {
  2721. description = "".. core.colorize("#00FF00", "rhodium spear\n")..core.colorize("#A0A0A0", "tier: 6 (epic)\n")..core.colorize("#A0A0A0", "mele damage: 15\n")..core.colorize("#A0A0A0", "range: 7.25 \n")..core.colorize("#A0A0A0", "attack interval: 1.30 "),
  2722. wield_scale = {x=3.1,y=3.1,z=1.5},
  2723. inventory_image = "minerdream_spear_rhodium.png",
  2724. range = 7.25,
  2725. tool_capabilities = {
  2726. full_punch_interval = 1.30,
  2727. max_drop_level=1,
  2728. groupcaps={
  2729. },
  2730. damage_groups = {fleshy=15},
  2731. },
  2732. })
  2733. ---------------artefact--------
  2734. minetest.register_tool('minerdream:dagger', {
  2735. description = "".. core.colorize("#BFFFFF", "Dagger\n")..core.colorize("#A0A0A0", "tier: 2 (uncommon)\n")..core.colorize("#A0A0A0", "mele damage: 4\n")..core.colorize("#A0A0A0", "range: 2.5 \n")..core.colorize("#A0A0A0", "attack interval: 0.3 "),
  2736. wield_scale = {x=0.8,y=0.8,z=0.8},
  2737. inventory_image = "minerdream_dagger.png",
  2738. range = 2.5,
  2739. tool_capabilities = {
  2740. full_punch_interval = 0.3,
  2741. max_drop_level=1,
  2742. groupcaps={
  2743. snappy={times={[1]=1.0, [2]=0.5, [3]=0.25}, uses=100, maxlevel=3},
  2744. },
  2745. damage_groups = {fleshy=4},
  2746. },
  2747. })
  2748. minetest.register_tool('minerdream:shortsword', {
  2749. description = "".. core.colorize("#00FFFF", "Shortsword\n")..core.colorize("#A0A0A0", "tier: 3 (almost rare)\n")..core.colorize("#A0A0A0", "mele damage: 5\n")..core.colorize("#A0A0A0", "range: 3 \n")..core.colorize("#A0A0A0", "attack interval: 0.35 "),
  2750. wield_scale = {x=0.9,y=0.9,z=0.9},
  2751. inventory_image = "minerdream_shortsword.png",
  2752. range = 3.0,
  2753. tool_capabilities = {
  2754. full_punch_interval = 0.35,
  2755. max_drop_level=1,
  2756. groupcaps={
  2757. snappy={times={[1]=1.0, [2]=0.5, [3]=0.25}, uses=100, maxlevel=3},
  2758. },
  2759. damage_groups = {fleshy=5},
  2760. },
  2761. })
  2762. minetest.register_tool('minerdream:club', {
  2763. description = "".. core.colorize("#00FFFF", "Heavy club\n")..core.colorize("#A0A0A0", "tier: 3 (almost rare)\n")..core.colorize("#A0A0A0", "mele damage: 10\n")..core.colorize("#A0A0A0", "range: 4.1 \n")..core.colorize("#A0A0A0", "attack interval: 1.5 "),
  2764. wield_scale = {x=1.1,y=1.1,z=1.5},
  2765. inventory_image = "minerdream_club.png",
  2766. range = 4.1,
  2767. tool_capabilities = {
  2768. full_punch_interval = 1.5,
  2769. max_drop_level=1,
  2770. groupcaps={
  2771. snappy={times={[1]=1.0, [2]=0.5, [3]=0.25}, uses=100, maxlevel=3},
  2772. },
  2773. damage_groups = {fleshy=10},
  2774. },
  2775. })
  2776. minetest.register_tool('minerdream:mace', {
  2777. description = "".. core.colorize("#40FF80", "Mace\n")..core.colorize("#A0A0A0", "tier: 4 (rare)\n")..core.colorize("#A0A0A0", "mele damage: 10\n")..core.colorize("#A0A0A0", "range: 4.25 \n")..core.colorize("#A0A0A0", "attack interval: 1.15 "),
  2778. wield_scale = {x=1.2,y=1.2,z=1.5},
  2779. inventory_image = "minerdream_mace.png",
  2780. range = 4.25,
  2781. tool_capabilities = {
  2782. full_punch_interval = 1.15,
  2783. max_drop_level=1,
  2784. groupcaps={
  2785. snappy={times={[1]=1.0, [2]=0.5, [3]=0.25}, uses=100, maxlevel=3},
  2786. },
  2787. damage_groups = {fleshy=10},
  2788. },
  2789. })
  2790. minetest.register_tool('minerdream:claymore', {
  2791. description = "".. core.colorize("#0040FF", "Shortsword\n")..core.colorize("#A0A0A0", "tier: 5 (extra rare)\n")..core.colorize("#A0A0A0", "mele damage: 11\n")..core.colorize("#A0A0A0", "range:4.8 \n")..core.colorize("#A0A0A0", "attack interval: 0.575 "),
  2792. wield_scale = {x=1.45,y=1.45,z=0.9},
  2793. inventory_image = "minerdream_claymore.png",
  2794. range = 4.8,
  2795. tool_capabilities = {
  2796. full_punch_interval = 0.575,
  2797. max_drop_level=1,
  2798. groupcaps={
  2799. snappy={times={[1]=0.3, [2]=0.15, [3]=0.075}, uses=200, maxlevel=3},
  2800. },
  2801. damage_groups = {fleshy=11},
  2802. },
  2803. })
  2804. minetest.register_tool('minerdream:katana', {
  2805. description = "".. core.colorize("#00FF00", "Shortsword\n")..core.colorize("#A0A0A0", "tier: 6 (epic)\n")..core.colorize("#A0A0A0", "mele damage: 10\n")..core.colorize("#A0A0A0", "range:5.25 \n")..core.colorize("#A0A0A0", "attack interval: 0.5 "),
  2806. wield_scale = {x=1.6,y=1.6,z=0.8},
  2807. inventory_image = "minerdream_katana.png",
  2808. range = 5.25,
  2809. tool_capabilities = {
  2810. full_punch_interval = 0.5,
  2811. max_drop_level=1,
  2812. groupcaps={
  2813. snappy={times={[1]=0.2, [2]=0.1, [3]=0.05}, uses=200, maxlevel=3},
  2814. },
  2815. damage_groups = {fleshy=12},
  2816. },
  2817. })