ammo.lua 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778
  1. forbidden_ents = {
  2. "",
  3. }
  4. minetest.register_alias("rangedweapons:726mm", "rangedweapons:762mm")
  5. bullet_particles = bullet_particles or "rangedweapons_bullet_fly.png"
  6. minetest.register_craftitem("rangedweapons:shot_bullet_visual", {
  7. wield_scale = {x=1.0,y=1.0,z=1.0},
  8. inventory_image = "rangedweapons_bulletshot.png",
  9. })
  10. local rangedweapons_shot_bullet = {
  11. timer = 0,
  12. initial_properties = {
  13. physical = true,
  14. hp_max = 420,
  15. glow = 100,
  16. visual = "wielditem",
  17. visual_size = {x=0.75, y=0.75},
  18. textures = {"rangedweapons:shot_bullet_visual"},
  19. lastpos = {},
  20. collide_with_objects = false,
  21. collisionbox = {-0.0025, -0.0025, -0.0025, 0.0025, 0.0025, 0.0025},
  22. },
  23. }
  24. rangedweapons_shot_bullet.on_step = function(self, dtime, moveresult)
  25. ----------------------------------------
  26. ---------------------------------------
  27. if self.owner == nil then
  28. self.object:remove()
  29. end
  30. local sparks = self.sparks or 0
  31. local ignite = self.ignite or 0
  32. local size = self.size or 0.0025
  33. local SBP = self.bullet_particles
  34. if SBP ~= nil then
  35. for i=1,math.random(SBP.amount[1],SBP.amount[2]) do
  36. minetest.add_particle({
  37. pos = {x=self.object:get_pos().x+(math.random(-SBP.pos_randomness,SBP.pos_randomness)/100),y=self.object:get_pos().y+(math.random(-SBP.pos_randomness,SBP.pos_randomness)/100),z=self.object:get_pos().z+(math.random(-SBP.pos_randomness,SBP.pos_randomness)/100)},
  38. velocity = {x=math.random(-SBP.velocity.x,SBP.velocity.x), y=math.random(-SBP.velocity.y,SBP.velocity.y), z=math.random(-SBP.velocity.z,SBP.velocity.z)},
  39. acceleration = {x=math.random(-SBP.acceleration.x,SBP.acceleration.x), y=math.random(-SBP.acceleration.y,SBP.acceleration.y)-SBP.gravity, z=math.random(-SBP.acceleration.z,SBP.acceleration.z)},
  40. expirationtime = SBP.lifetime,
  41. size = math.random(SBP.minsize,SBP.maxsize)/10,
  42. collisiondetection = SBP.collisiondetection,
  43. vertical = false,
  44. texture = SBP.texture,
  45. animation = {type="vertical_frames", aspect_w=8, aspect_h=8, length = SBP.lifetime+0.1,},
  46. glow = SBP.glow,
  47. })
  48. end end
  49. self.timer = self.timer + dtime
  50. if self.timer > 0.06 then
  51. self.object:set_properties({collide_with_objects = true})
  52. self.object:set_properties({collisionbox = {-size, -size, -size, size, size, size}})
  53. end
  54. if self.timer > 10 then
  55. self.object:remove()
  56. end
  57. if moveresult.collides == true then
  58. if moveresult.collisions[1] ~= nil then
  59. local mobPen = self.mobPen or 0
  60. local nodePen = self.nodePen or 0
  61. local door_break = self.door_break or 0
  62. local glass_break = self.glass_break or 0
  63. if moveresult.collisions[1].type == "node" then
  64. minetest.check_for_falling(moveresult.collisions[1].node_pos)
  65. if minetest.registered_nodes[minetest.get_node(moveresult.collisions[1].node_pos).name] and
  66. minetest.registered_nodes[minetest.get_node(moveresult.collisions[1].node_pos).name].tiles and
  67. minetest.registered_nodes[minetest.get_node(moveresult.collisions[1].node_pos).name].tiles[1]
  68. then
  69. local hit_texture = minetest.registered_nodes[minetest.get_node(moveresult.collisions[1].node_pos).name].tiles[1]
  70. if hit_texture.name ~= nil then
  71. hit_texture = hit_texture.name
  72. end
  73. minetest.add_particle({
  74. pos = self.object:get_pos(),
  75. velocity = {x=0, y=0, z=0},
  76. acceleration = {x=0, y=0, z=0},
  77. expirationtime = 30,
  78. size = math.random(10,20)/10,
  79. collisiondetection = false,
  80. vertical = false,
  81. texture = "rangedweapons_bullethole.png",
  82. glow = 0,
  83. })
  84. for i=1,math.random(4,8) do
  85. minetest.add_particle({
  86. pos = self.object:get_pos(),
  87. velocity = {x=math.random(-3.0,3.0), y=math.random(2.0,5.0), z=math.random(-3.0,3.0)},
  88. acceleration = {x=math.random(-3.0,3.0), y=math.random(-10.0,-15.0), z=math.random(-3.0,3.0)},
  89. expirationtime = 0.5,
  90. size = math.random(10,20)/10,
  91. collisiondetection = true,
  92. vertical = false,
  93. texture = ""..hit_texture.."^[resize:4x4".."",
  94. glow = 0,
  95. })
  96. end
  97. end
  98. minetest.sound_play("default_dig_cracky", {self.object:get_pos(), gain = 1.0})
  99. if ignite > 0 then
  100. if minetest.get_node(moveresult.collisions[1].node_pos).name == "rangedweapons:barrel" then
  101. minetest.swap_node(moveresult.collisions[1].node_pos, {name = "air"})
  102. tnt.boom(moveresult.collisions[1].node_pos, {radius = 3})
  103. end
  104. if minetest.get_node(moveresult.collisions[1].node_pos).name == "tnt:tnt" then
  105. minetest.swap_node(moveresult.collisions[1].node_pos, {name = "tnt:tnt_burning"})
  106. minetest.sound_play("tnt_ignite", {moveresult.collisions[1].node_pos}, true)
  107. minetest.get_node_timer(moveresult.collisions[1].node_pos):start(3)
  108. minetest.check_for_falling(moveresult.collisions[1].node_pos)
  109. end
  110. end
  111. if rweapons_door_breaking == "true" and door_break > 0 then
  112. if string.find(minetest.get_node(moveresult.collisions[1].node_pos).name,"door_wood") then
  113. minetest.swap_node(moveresult.collisions[1].node_pos, {name = "air"})
  114. minetest.add_item(moveresult.collisions[1].node_pos, "default:wood 5")
  115. minetest.sound_play("rangedweapons_woodbreak",{moveresult.collisions[1].node_pos})
  116. end end
  117. if rweapons_glass_breaking == "true" and glass_break > 0 then
  118. local nodeName = minetest.get_node(moveresult.collisions[1].node_pos).name
  119. if nodeName == "default:glass" then
  120. minetest.swap_node(moveresult.collisions[1].node_pos, {name = "rangedweapons:broken_glass"})
  121. minetest.sound_play("glass_break",{moveresult.collisions[1].node_pos})
  122. end
  123. if nodeName == "xpanes:pane" or
  124. nodeName == "xpanes:pane_flat" then
  125. minetest.swap_node(moveresult.collisions[1].node_pos, {name = "air"})
  126. minetest.add_item(moveresult.collisions[1].node_pos, "rangedweapons:glass_shards")
  127. minetest.sound_play("glass_break",{moveresult.collisions[1].node_pos})
  128. end
  129. if string.find(nodeName,"door_glass") then
  130. minetest.swap_node(moveresult.collisions[1].node_pos, {name = "air"})
  131. minetest.add_item(moveresult.collisions[1].node_pos, "vessels:glass_fragments 5")
  132. minetest.sound_play("glass_break",{moveresult.collisions[1].node_pos})
  133. end
  134. end
  135. if minetest.get_item_group(minetest.get_node(moveresult.collisions[1].node_pos).name, "level") > 1 then
  136. self.object:set_velocity(moveresult.collisions[1].old_velocity)
  137. if sparks > 0 then
  138. make_sparks(self.object:get_pos())
  139. end
  140. local objVel = moveresult.collisions[1].old_velocity
  141. local objRot = self.object:get_rotation()
  142. if objRot and objVel then
  143. if moveresult.collisions[1].axis == "x" then
  144. self.object:set_rotation({x=0,y=objRot.y,z=objRot.z+3})
  145. self.object:set_velocity({x=objVel.x*-1,y=objVel.y,z=objVel.z})
  146. end
  147. if moveresult.collisions[1].axis == "z" then
  148. self.object:set_rotation({x=0,y=objRot.y,z=objRot.z+3})
  149. self.object:set_velocity({x=objVel.x,y=objVel.y,z=objVel.z*-1})
  150. end
  151. if moveresult.collisions[1].axis == "y" then
  152. self.object:set_rotation({x=0,y=objRot.y+3,z=objRot.z+3})
  153. self.object:set_velocity({x=objVel.x,y=objVel.y*-1,z=objVel.z})
  154. end end
  155. else
  156. if math.random(1,100) <= nodePen then
  157. for i=1,10 do
  158. minetest.add_particle({
  159. pos = self.object:get_pos(),
  160. velocity = {x=1.5, y=1.5, z=1.5} ,
  161. acceleration = {x=math.random(-3.0,3.0), y=math.random(-4.0,4.0), z=math.random(-3.0,3.0)},
  162. expirationtime = 1.25,
  163. size = math.random(3,6),
  164. collisiondetection = false,
  165. vertical = false,
  166. texture = "tnt_smoke.png",
  167. glow = 2,
  168. })
  169. end
  170. minetest.sound_play("default_dig_cracky", {self.object:get_pos(), gain = 1.0})
  171. self.object:set_properties({collisionbox = {0,0,0,0,0,0}})
  172. --minetest.chat_send_all("hit")
  173. self.object:set_velocity(moveresult.collisions[1].old_velocity)
  174. else
  175. if minetest.get_item_group(minetest.get_node(moveresult.collisions[1].node_pos).name, "leaves") > 0 then
  176. minetest.sound_play("default_dig_snappy", {self.object:get_pos(), gain = 1.5})
  177. for i = 1,math.random(3,6) do
  178. minetest.add_particle({
  179. pos = self.object:get_pos(),
  180. velocity = {x=math.random(-2,2), y=math.random(3,6), z=math.random(-2,2)},
  181. acceleration = {x=math.random(-2,2), y=math.random(-3,-6), z=math.random(-2,2)},
  182. expirationtime = math.random(2,4),
  183. size = math.random(6,9),
  184. collisiondetection = true,
  185. collision_removal = false,
  186. vertical = false,
  187. texture = "rangedweapons_leaf.png",
  188. animation = {type="vertical_frames", aspect_w=8, aspect_h=8, length = 0.8,},
  189. glow = 15,
  190. })
  191. end
  192. self.object:set_properties({collisionbox = {0,0,0,0,0,0}})
  193. self.object:set_velocity(moveresult.collisions[1].old_velocity)
  194. else
  195. if self.OnCollision ~= nil then
  196. self.OnCollision(self.owner,self,moveresult.collisions[1])
  197. end
  198. self.object:remove()
  199. end
  200. end
  201. end
  202. end
  203. if moveresult.collisions[1].type == "object" then
  204. local actualDamage = self.damage or {fleshy=1}
  205. local damage = {}
  206. local crit = self.crit or 0
  207. local critEffc = self.critEffc or 1
  208. local owner = minetest.get_player_by_name(self.owner)
  209. local hit_texture = "rangedweapons_hit.png"
  210. local dps = self.dps or 0
  211. local skill = self.skill_value or 1
  212. for _, dmg in pairs(actualDamage) do
  213. damage[_] = actualDamage[_]
  214. end
  215. if moveresult.collisions[1].object:is_player() then
  216. for _, player_dmg in pairs(damage) do
  217. damage[_] = damage[_] * rweapons_player_dmg_multiplier
  218. end
  219. if self.object:get_pos().y - moveresult.collisions[1].object:get_pos().y > 1.5 then
  220. for _, hs_dmg in pairs(damage) do
  221. damage[_] = damage[_] * rweapons_headshot_dmg_multiplier
  222. end
  223. end
  224. knockback = damage.knockback or 0
  225. projectile_kb(moveresult.collisions[1].object,self.object,knockback)
  226. else
  227. for _, mob_dmg in pairs(damage) do
  228. damage[_] = damage[_] * rweapons_mob_dmg_multiplier
  229. end
  230. end
  231. for _, bonus_dmg in pairs(damage) do
  232. damage[_] = (damage[_]*skill) + (self.dps*self.timer)
  233. end
  234. --minetest.chat_send_all(critEffc)
  235. if math.random(1,100) <= crit+((skill*10)-10) then
  236. for _, critDmg in pairs(damage) do
  237. damage[_] = damage[_] * critEffc
  238. end
  239. entpos = self.object:get_pos()
  240. minetest.add_particle ({
  241. pos = entpos, velocity = 0, acceleration = {x=0, y=5, z=0},
  242. expirationtime = 0.75, size = 12, collisiondetection = false,
  243. vertical = false, texture = "rangedweapons_crit.png", glow = 30,})
  244. hit_texture = "rangedweapons_crithit.png"
  245. end
  246. moveresult.collisions[1].object:punch(owner, 1.0, {
  247. full_punch_interval = 1.0,
  248. damage_groups = damage,}, nil)
  249. owner:hud_change(hit, "text", hit_texture)
  250. for i=1,math.random(math.ceil(rweapons_bloodyness*0.66),math.ceil(rweapons_bloodyness*1.5)) do
  251. minetest.add_particle({
  252. pos = self.object:get_pos(),
  253. velocity = {x=math.random(-15.0,15.0)/10, y=math.random(2.0,5.0), z=math.random(-15.0,15.0)/10},
  254. acceleration = {x=math.random(-3.0,3.0), y=math.random(-10.0,-15.0), z=math.random(-3.0,3.0)},
  255. expirationtime = 0.75,
  256. size = math.random(10,20)/10,
  257. collisiondetection = true,
  258. vertical = false,
  259. texture = "rangedweapons_blood.png",
  260. animation = {type="vertical_frames", aspect_w=8, aspect_h=8, length = 0.8,},
  261. glow = 0,
  262. })
  263. end
  264. if math.random(1,100) <= mobPen then
  265. for i=1,10 do
  266. minetest.add_particle({
  267. pos = self.object:get_pos(),
  268. velocity = {x=1.5, y=1.5, z=1.5} ,
  269. acceleration = {x=math.random(-3.0,3.0), y=math.random(-4.0,4.0), z=math.random(-3.0,3.0)},
  270. expirationtime = 1.25,
  271. size = math.random(3,6),
  272. collisiondetection = false,
  273. vertical = false,
  274. texture = "tnt_smoke.png",
  275. glow = 2,
  276. })
  277. end
  278. minetest.sound_play("default_dig_cracky", {self.object:get_pos(), gain = 1.0})
  279. self.object:set_properties({collisionbox = {0,0,0,0,0,0}})
  280. self.object:set_velocity(moveresult.collisions[1].old_velocity)
  281. else
  282. if self.OnCollision ~= nil then
  283. self.OnCollision(self.owner,self,moveresult.collisions[1])
  284. end
  285. self.object:remove()
  286. end
  287. end
  288. else
  289. self.object:remove()
  290. end
  291. end
  292. end
  293. minetest.register_entity("rangedweapons:shot_bullet", rangedweapons_shot_bullet)
  294. ---
  295. --- actual mags
  296. ---
  297. ---
  298. --- visual drop mags
  299. ---
  300. minetest.register_craftitem("rangedweapons:drum_mag", {
  301. wield_scale = {x=1.0,y=1.0,z=1.5},
  302. inventory_image = "rangedweapons_drum_mag.png",
  303. })
  304. minetest.register_craftitem("rangedweapons:handgun_mag_black", {
  305. wield_scale = {x=0.6,y=0.6,z=0.8},
  306. inventory_image = "rangedweapons_magazine_handgun.png",
  307. })
  308. local rangedweapons_mag = {
  309. physical = false,
  310. timer = 0,
  311. visual = "wielditem",
  312. visual_size = {x=0.3, y=0.3},
  313. textures = {"rangedweapons:handgun_mag_black"},
  314. lastpos= {},
  315. collisionbox = {0, 0, 0, 0, 0, 0},
  316. }
  317. rangedweapons_mag.on_step = function(self, dtime, pos)
  318. self.timer = self.timer + dtime
  319. local pos = self.object:get_pos()
  320. local node = minetest.get_node(pos)
  321. if self.lastpos.y ~= nil then
  322. if minetest.registered_nodes[node.name] ~= nil then
  323. if minetest.registered_nodes[node.name].walkable then
  324. local vel = self.object:get_velocity()
  325. local acc = self.object:get_acceleration()
  326. self.object:set_velocity({x=0, y=0, z=0})
  327. self.object:set_acceleration({x=0, y=0, z=0})
  328. end end
  329. end
  330. if self.timer > 2.0 then
  331. self.object:remove()
  332. end
  333. self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
  334. end
  335. minetest.register_entity("rangedweapons:mag", rangedweapons_mag)
  336. minetest.register_craftitem("rangedweapons:handgun_mag_white", {
  337. wield_scale = {x=0.6,y=0.6,z=0.8},
  338. inventory_image = "rangedweapons_handgun_mag_white.png",
  339. })
  340. minetest.register_craftitem("rangedweapons:machinepistol_mag", {
  341. wield_scale = {x=0.6,y=0.6,z=0.8},
  342. inventory_image = "rangedweapons_machinepistol_mag.png",
  343. })
  344. minetest.register_craftitem("rangedweapons:assaultrifle_mag", {
  345. wield_scale = {x=0.6,y=0.6,z=0.8},
  346. inventory_image = "rangedweapons_assaultrifle_mag.png",
  347. })
  348. minetest.register_craftitem("rangedweapons:rifle_mag", {
  349. wield_scale = {x=0.6,y=0.6,z=0.8},
  350. inventory_image = "rangedweapons_rifle_mag.png",
  351. })
  352. minetest.register_craftitem("rangedweapons:9mm", {
  353. stack_max= 500,
  354. wield_scale = {x=0.4,y=0.4,z=1.2},
  355. description = "" ..core.colorize("#35cdff","9x19mm Parabellum\n")..core.colorize("#FFFFFF", "Bullet damage: 1 \n") ..core.colorize("#FFFFFF", "Bullet crit efficiency: 0.25 \n") ..core.colorize("#FFFFFF", "Bullet crit chance: 1% \n") ..core.colorize("#FFFFFF", "Bullet velocity: 25 \n") ..core.colorize("#FFFFFF", "Bullet knockback: 1 \n") ..core.colorize("#FFFFFF", "Ammunition for some guns"),
  356. inventory_image = "rangedweapons_9mm.png",
  357. RW_ammo_capabilities = {
  358. ammo_damage = {fleshy=1,knockback=1},
  359. ammo_critEffc = 0.25,
  360. ammo_crit = 1,
  361. ammo_velocity = 25,
  362. ammo_glass_breaking = 1,
  363. ammo_entity = "rangedweapons:shot_bullet",
  364. ammo_visual = "wielditem",
  365. ammo_texture = "rangedweapons:shot_bullet_visual",
  366. shell_entity = "rangedweapons:empty_shell",
  367. shell_visual = "wielditem",
  368. shell_texture = "rangedweapons:shelldrop",
  369. ammo_projectile_size = 0.0025,
  370. has_sparks = 1,
  371. ignites_explosives = 1,
  372. }
  373. })
  374. minetest.register_craftitem("rangedweapons:45acp", {
  375. stack_max= 450,
  376. wield_scale = {x=0.4,y=0.4,z=1.2},
  377. description = "" ..core.colorize("#35cdff",".45ACP catridge\n")..core.colorize("#FFFFFF", "Bullet damage: 2 \n") ..core.colorize("#FFFFFF", "Bullet crit efficiency: 0.50 \n") ..core.colorize("#FFFFFF", "Bullet crit chance: 2% \n")
  378. ..core.colorize("#FFFFFF", "Bullet velocity: 20 \n")
  379. ..core.colorize("#FFFFFF", "Bullet knockback: 2 \n") ..core.colorize("#FFFFFF", "Ammunition for some guns"),
  380. inventory_image = "rangedweapons_45acp.png",
  381. RW_ammo_capabilities = {
  382. ammo_damage = {fleshy=2,knockback=1},
  383. ammo_critEffc = 0.50,
  384. ammo_crit = 1,
  385. ammo_velocity = 20,
  386. ammo_glass_breaking = 1,
  387. ammo_entity = "rangedweapons:shot_bullet",
  388. ammo_visual = "wielditem",
  389. ammo_texture = "rangedweapons:shot_bullet_visual",
  390. shell_entity = "rangedweapons:empty_shell",
  391. shell_visual = "wielditem",
  392. shell_texture = "rangedweapons:shelldrop",
  393. ammo_projectile_size = 0.0025,
  394. has_sparks = 1,
  395. ignites_explosives = 1,
  396. },
  397. })
  398. minetest.register_craftitem("rangedweapons:10mm", {
  399. stack_max= 400,
  400. wield_scale = {x=0.4,y=0.4,z=1.2},
  401. description = "" ..core.colorize("#35cdff","10mm Auto\n")..core.colorize("#FFFFFF", "Bullet damage: 2 \n") ..core.colorize("#FFFFFF", "Bullet crit efficiency:0.30 \n") ..core.colorize("#FFFFFF", "Bullet velocity: 25 \n")
  402. ..core.colorize("#FFFFFF", "Bullet knockback: 1 \n") ..core.colorize("#FFFFFF", "Bullet crit chance: 1% \n") ..core.colorize("#FFFFFF", "Ammunition for some guns"),
  403. inventory_image = "rangedweapons_10mm.png",
  404. RW_ammo_capabilities = {
  405. ammo_damage = {fleshy=2,knockback=1},
  406. ammo_critEffc = 0.3,
  407. ammo_crit = 1,
  408. ammo_velocity = 25,
  409. ammo_glass_breaking = 1,
  410. ammo_entity = "rangedweapons:shot_bullet",
  411. ammo_visual = "wielditem",
  412. ammo_texture = "rangedweapons:shot_bullet_visual",
  413. shell_entity = "rangedweapons:empty_shell",
  414. shell_visual = "wielditem",
  415. shell_texture = "rangedweapons:shell_whitedrop",
  416. ammo_projectile_size = 0.0025,
  417. has_sparks = 1,
  418. ignites_explosives = 1,
  419. }
  420. })
  421. minetest.register_craftitem("rangedweapons:357", {
  422. stack_max= 150,
  423. wield_scale = {x=0.4,y=0.4,z=1.2},
  424. description = "" ..core.colorize("#35cdff",".357 magnum round\n")..core.colorize("#FFFFFF", "Bullet damage: 4 \n") ..core.colorize("#FFFFFF", "Bullet crit efficiency: 0.6 \n") ..core.colorize("#FFFFFF", "Bullet crit chance: 3% \n") ..core.colorize("#FFFFFF", "Bullet knockback: 5 \n") ..core.colorize("#FFFFFF", "Bullet enemy Penetration: 5%\n") ..core.colorize("#FFFFFF", "Bullet velocity: 45 \n") ..core.colorize("#FFFFFF", "Ammunition for some guns"),
  425. inventory_image = "rangedweapons_357.png",
  426. RW_ammo_capabilities = {
  427. ammo_damage = {fleshy=4,knockback=5},
  428. ammo_critEffc = 0.6,
  429. ammo_crit = 3,
  430. ammo_velocity = 45,
  431. ammo_glass_breaking = 1,
  432. ammo_mob_penetration = 5,
  433. ammo_entity = "rangedweapons:shot_bullet",
  434. ammo_visual = "wielditem",
  435. ammo_texture = "rangedweapons:shot_bullet_visual",
  436. shell_entity = "rangedweapons:empty_shell",
  437. shell_visual = "wielditem",
  438. shell_texture = "rangedweapons:shelldrop",
  439. ammo_projectile_size = 0.0025,
  440. has_sparks = 1,
  441. ignites_explosives = 1,
  442. }
  443. })
  444. minetest.register_craftitem("rangedweapons:50ae", {
  445. stack_max= 100,
  446. wield_scale = {x=0.6,y=0.6,z=1.5},
  447. description = "" ..core.colorize("#35cdff",".50AE catridge\n")..core.colorize("#FFFFFF", "Bullet damage: 8 \n") ..core.colorize("#FFFFFF", "Bullet crit efficiency: 0.9 \n") ..core.colorize("#FFFFFF", "Bullet crit chance: 6% \n") ..core.colorize("#FFFFFF", "Bullet knockback: 10 \n") ..core.colorize("#FFFFFF", "Bullet enemy Penetration: 15%\n") ..core.colorize("#FFFFFF", "Bullet velocity: 55 \n") ..core.colorize("#FFFFFF", "Ammunition for some guns"),
  448. inventory_image = "rangedweapons_50ae.png",
  449. RW_ammo_capabilities = {
  450. ammo_damage = {fleshy=8,knockback=10},
  451. ammo_critEffc = 0.9,
  452. ammo_crit = 6,
  453. ammo_velocity = 55,
  454. ammo_glass_breaking = 1,
  455. ammo_mob_penetration = 15,
  456. ammo_entity = "rangedweapons:shot_bullet",
  457. ammo_visual = "wielditem",
  458. ammo_texture = "rangedweapons:shot_bullet_visual",
  459. shell_entity = "rangedweapons:empty_shell",
  460. shell_visual = "wielditem",
  461. shell_texture = "rangedweapons:shelldrop",
  462. ammo_projectile_size = 0.0025,
  463. has_sparks = 1,
  464. ignites_explosives = 1,
  465. }
  466. })
  467. minetest.register_craftitem("rangedweapons:44", {
  468. stack_max= 150,
  469. wield_scale = {x=0.4,y=0.4,z=1.2},
  470. description = "" ..core.colorize("#35cdff",".44 magnum round\n")..core.colorize("#FFFFFF", "Bullet damage: 4 \n") ..core.colorize("#FFFFFF", "Bullet crit efficiency: 0.7 \n") ..core.colorize("#FFFFFF", "Bullet crit chance: 4% \n") ..core.colorize("#FFFFFF", "Bullet knockback: 6 \n") ..core.colorize("#FFFFFF", "Bullet enemy Penetration: 6%\n") ..core.colorize("#FFFFFF", "Bullet velocity: 50 \n") ..core.colorize("#FFFFFF", "Ammunition for some guns"),
  471. inventory_image = "rangedweapons_44.png",
  472. RW_ammo_capabilities = {
  473. ammo_damage = {fleshy=4,knockback=6},
  474. ammo_critEffc = 0.7,
  475. ammo_crit = 4,
  476. ammo_velocity = 50,
  477. ammo_glass_breaking = 1,
  478. ammo_mob_penetration = 6,
  479. ammo_entity = "rangedweapons:shot_bullet",
  480. ammo_visual = "wielditem",
  481. ammo_texture = "rangedweapons:shot_bullet_visual",
  482. shell_entity = "rangedweapons:empty_shell",
  483. shell_visual = "wielditem",
  484. shell_texture = "rangedweapons:shelldrop",
  485. ammo_projectile_size = 0.0025,
  486. has_sparks = 1,
  487. ignites_explosives = 1,
  488. }
  489. })
  490. minetest.register_craftitem("rangedweapons:762mm", {
  491. stack_max= 250,
  492. wield_scale = {x=0.4,y=0.4,z=1.2},
  493. description = "" ..core.colorize("#35cdff","7.62mm round\n")..core.colorize("#FFFFFF", "Bullet damage: 4 \n") ..core.colorize("#FFFFFF", "Bullet crit efficiency: 0.5 \n") ..core.colorize("#FFFFFF", "Bullet crit chance: 2% \n") ..core.colorize("#FFFFFF", "Bullet velocity: 40 \n") ..core.colorize("#FFFFFF", "Bullet knockback: 4 \n") ..core.colorize("#FFFFFF", "Bullet enemy Penetration: 5%\n") ..core.colorize("#FFFFFF", "Ammunition for some guns"),
  494. inventory_image = "rangedweapons_762mm.png",
  495. RW_ammo_capabilities = {
  496. ammo_damage = {fleshy=4,knockback=4},
  497. ammo_critEffc = 0.5,
  498. ammo_crit = 2,
  499. ammo_velocity = 40,
  500. ammo_glass_breaking = 1,
  501. ammo_entity = "rangedweapons:shot_bullet",
  502. ammo_visual = "wielditem",
  503. ammo_texture = "rangedweapons:shot_bullet_visual",
  504. shell_entity = "rangedweapons:empty_shell",
  505. shell_visual = "wielditem",
  506. shell_texture = "rangedweapons:shelldrop",
  507. ammo_mob_penetration = 5,
  508. ammo_projectile_size = 0.0025,
  509. has_sparks = 1,
  510. ignites_explosives = 1,
  511. },
  512. })
  513. minetest.register_craftitem("rangedweapons:556mm", {
  514. stack_max= 300,
  515. wield_scale = {x=0.4,y=0.4,z=1.2},
  516. description = "" ..core.colorize("#35cdff","5.56mm round\n")..core.colorize("#FFFFFF", "Bullet damage: 3 \n") ..core.colorize("#FFFFFF", "Bullet crit efficiency: 0.4 \n") ..core.colorize("#FFFFFF", "Bullet crit chance: 2% \n") ..core.colorize("#FFFFFF", "Bullet velocity: 35 \n") ..core.colorize("#FFFFFF", "Bullet knockback: 3 \n") ..core.colorize("#FFFFFF", "Ammunition for some guns"),
  517. inventory_image = "rangedweapons_556mm.png",
  518. RW_ammo_capabilities = {
  519. ammo_damage = {fleshy=3,knockback=3},
  520. ammo_critEffc = 0.4,
  521. ammo_crit = 2,
  522. ammo_velocity = 35,
  523. ammo_glass_breaking = 1,
  524. ammo_entity = "rangedweapons:shot_bullet",
  525. ammo_visual = "wielditem",
  526. ammo_texture = "rangedweapons:shot_bullet_visual",
  527. shell_entity = "rangedweapons:empty_shell",
  528. shell_visual = "wielditem",
  529. shell_texture = "rangedweapons:shelldrop",
  530. ammo_projectile_size = 0.0025,
  531. has_sparks = 1,
  532. ignites_explosives = 1,
  533. },
  534. })
  535. minetest.register_craftitem("rangedweapons:shell", {
  536. stack_max= 50,
  537. wield_scale = {x=0.4,y=0.4,z=1.2},
  538. description = "" ..core.colorize("#35cdff","12 Gauge shell\n")..core.colorize("#FFFFFF", "Bullet damage: 2 \n") ..core.colorize("#FFFFFF", "Bullet crit efficiency: 0.15 \n") ..core.colorize("#FFFFFF", "Bullet crit chance: 1% \n") ..core.colorize("#FFFFFF", "Bullet velocity: 20 \n") ..core.colorize("#FFFFFF", "Bullet knockback: 4 \n") ..core.colorize("#FFFFFF", "Bullet gravity: 5 \n") ..core.colorize("#FFFFFF", "Bullet projectile multiplier: 1.5x\n") ..core.colorize("#FFFFFF", "Ammunition for some guns"),
  539. inventory_image = "rangedweapons_shell.png",
  540. RW_ammo_capabilities = {
  541. ammo_damage = {fleshy=2,knockback=4},
  542. ammo_projectile_multiplier = 1.5,
  543. ammo_critEffc = 0.15,
  544. ammo_crit = 1,
  545. ammo_velocity = 20,
  546. ammo_glass_breaking = 1,
  547. ammo_entity = "rangedweapons:shot_bullet",
  548. ammo_visual = "sprite",
  549. ammo_texture = "rangedweapons_buckball.png",
  550. shell_entity = "rangedweapons:empty_shell",
  551. shell_visual = "wielditem",
  552. shell_texture = "rangedweapons:shell_shotgundrop",
  553. ammo_gravity = 5,
  554. ammo_projectile_size = 0.00175,
  555. ammo_projectile_glow = 0,
  556. has_sparks = 1,
  557. ignites_explosives = 1,
  558. },
  559. })
  560. minetest.register_craftitem("rangedweapons:308winchester", {
  561. stack_max= 75,
  562. wield_scale = {x=0.4,y=0.4,z=1.2},
  563. description = "" ..core.colorize("#35cdff",".308 winchester round\n")..core.colorize("#FFFFFF", "Bullet damage: 8 \n") ..core.colorize("#FFFFFF", "Bullet crit efficiency: 0.75 \n") ..core.colorize("#FFFFFF", "Bullet crit chance: 4% \n") ..core.colorize("#FFFFFF", "Bullet velocity: 60 \n") ..core.colorize("#FFFFFF", "Bullet knockback: 10 \n") ..core.colorize("#FFFFFF", "Damage gain over 1 sec of flight time: 40 \n") ..core.colorize("#FFFFFF", "Bullet enemy Penetration: 20%\n") ..core.colorize("#FFFFFF", "Bullet node Penetration: 10%\n") ..core.colorize("#FFFFFF", "Ammunition for some guns"),
  564. inventory_image = "rangedweapons_308winchester.png",
  565. RW_ammo_capabilities = {
  566. ammo_damage = {fleshy=8,knockback=10},
  567. ammo_critEffc = 0.75,
  568. ammo_crit = 2,
  569. ammo_velocity = 60,
  570. ammo_glass_breaking = 1,
  571. ammo_entity = "rangedweapons:shot_bullet",
  572. ammo_visual = "wielditem",
  573. ammo_texture = "rangedweapons:shot_bullet_visual",
  574. shell_entity = "rangedweapons:empty_shell",
  575. shell_visual = "wielditem",
  576. shell_texture = "rangedweapons:shelldrop",
  577. ammo_mob_penetration = 20,
  578. ammo_node_penetration = 10,
  579. ammo_projectile_size = 0.0025,
  580. ammo_dps = 40,
  581. has_sparks = 1,
  582. ignites_explosives = 1,
  583. },
  584. })
  585. minetest.register_craftitem("rangedweapons:408cheytac", {
  586. stack_max= 40,
  587. wield_scale = {x=0.65,y=0.65,z=1.5},
  588. description = "" ..core.colorize("#35cdff",".408 chey tac\n")..core.colorize("#FFFFFF", "Bullet damage: 10 \n") ..core.colorize("#FFFFFF", "Bullet crit efficiency: 0.8 \n") ..core.colorize("#FFFFFF", "Bullet crit chance: 5% \n") ..core.colorize("#FFFFFF", "Bullet velocity: 70 \n") ..core.colorize("#FFFFFF", "Bullet knockback: 15 \n") ..core.colorize("#FFFFFF", "Damage gain over 1 sec of flight time: 80 \n") ..core.colorize("#FFFFFF", "Bullet enemy Penetration: 45%\n") ..core.colorize("#FFFFFF", "Bullet node Penetration: 20%\n") ..core.colorize("#FFFFFF", "Ammunition for some guns"),
  589. inventory_image = "rangedweapons_408cheytac.png",
  590. RW_ammo_capabilities = {
  591. ammo_damage = {fleshy=10,knockback=15},
  592. ammo_critEffc = 0.8,
  593. ammo_crit = 5,
  594. ammo_velocity = 70,
  595. ammo_glass_breaking = 1,
  596. ammo_entity = "rangedweapons:shot_bullet",
  597. ammo_visual = "wielditem",
  598. ammo_texture = "rangedweapons:shot_bullet_visual",
  599. shell_entity = "rangedweapons:empty_shell",
  600. shell_visual = "wielditem",
  601. shell_texture = "rangedweapons:shelldrop",
  602. ammo_mob_penetration = 45,
  603. ammo_node_penetration = 20,
  604. ammo_projectile_size = 0.0025,
  605. ammo_dps = 80,
  606. has_sparks = 1,
  607. ignites_explosives = 1,
  608. },
  609. })
  610. minetest.register_craftitem("rangedweapons:40mm", {
  611. stack_max= 25,
  612. wield_scale = {x=0.8,y=0.8,z=2.4},
  613. description = "" ..core.colorize("#35cdff",".40mm grenade\n")..core.colorize("#FFFFFF", "Bullet damage: 10 \n") ..core.colorize("#FFFFFF", "Bullet crit efficiency: 1.0 \n") ..core.colorize("#FFFFFF", "Bullet crit chance: 1% \n") ..core.colorize("#FFFFFF", "Bullet velocity: 15 \n") ..core.colorize("#FFFFFF", "Bullet knockback: 10 \n") ..core.colorize("#FFFFFF", "Bullet gravity: 5 \n") ..core.colorize("#FFFFFF", "explodes on impact with a radius of 2\n") ..core.colorize("#FFFFFF", "Ammunition for grenade launchers"),
  614. inventory_image = "rangedweapons_40mm.png",
  615. RW_ammo_capabilities = {
  616. ammo_damage = {fleshy=10,knockback=15},
  617. ammo_critEffc = 1.0,
  618. ammo_crit = 1,
  619. ammo_velocity = 15,
  620. ammo_glass_breaking = 1,
  621. ammo_entity = "rangedweapons:shot_bullet",
  622. ammo_visual = "sprite",
  623. ammo_texture = "rangedweapons_rocket_fly.png",
  624. shell_entity = "rangedweapons:empty_shell",
  625. shell_visual = "wielditem",
  626. shell_texture = "rangedweapons:shell_grenadedrop",
  627. ammo_projectile_size = 0.15,
  628. has_sparks = 1,
  629. ammo_gravity = 5,
  630. ignites_explosives = 1,
  631. OnCollision = function(player,bullet,target)
  632. tnt.boom(bullet.object:get_pos(), {radius = 2})
  633. end,
  634. ammo_particles = {
  635. velocity = {x=1,y=1,z=1},
  636. acceleration = {x=1,y=1,z=1},
  637. collisiondetection = true,
  638. lifetime = 1,
  639. texture = "tnt_smoke.png",
  640. minsize = 50,
  641. maxsize = 75,
  642. pos_randomness = 50,
  643. glow = 20,
  644. gravity = 10,
  645. amount = {1,1}
  646. },
  647. },
  648. })
  649. minetest.register_craftitem("rangedweapons:rocket", {
  650. stack_max= 15,
  651. wield_scale = {x=1.2,y=1.2,z=2.4},
  652. description = "" ..core.colorize("#35cdff","rocket\n")..core.colorize("#FFFFFF", "Bullet damage: 15 \n") ..core.colorize("#FFFFFF", "Bullet crit efficiency: 1.0 \n") ..core.colorize("#FFFFFF", "Bullet crit chance: 1% \n") ..core.colorize("#FFFFFF", "Bullet velocity: 20 \n") ..core.colorize("#FFFFFF", "Bullet knockback: 20 \n") ..core.colorize("#FFFFFF", "Bullet gravity: 5 \n") ..core.colorize("#FFFFFF", "explodes on impact with a radius of 3\n") ..core.colorize("#FFFFFF", "Ammunition for rocket launchers"),
  653. inventory_image = "rangedweapons_rocket.png",
  654. RW_ammo_capabilities = {
  655. ammo_damage = {fleshy=15,knockback=20},
  656. ammo_critEffc = 1.0,
  657. ammo_crit = 1,
  658. ammo_velocity = 20,
  659. ammo_glass_breaking = 1,
  660. ammo_entity = "rangedweapons:shot_bullet",
  661. ammo_visual = "sprite",
  662. ammo_texture = "rangedweapons_rocket_fly.png",
  663. ammo_projectile_size = 0.15,
  664. has_sparks = 1,
  665. ignites_explosives = 1,
  666. OnCollision = function(player,bullet,target)
  667. tnt.boom(bullet.object:get_pos() , {radius = 3})
  668. end,
  669. ammo_particles = {
  670. velocity = {x=1,y=1,z=1},
  671. acceleration = {x=1,y=1,z=1},
  672. collisiondetection = true,
  673. lifetime = 1,
  674. texture = "tnt_smoke.png",
  675. minsize = 50,
  676. maxsize = 75,
  677. pos_randomness = 50,
  678. glow = 20,
  679. gravity = 10,
  680. amount = {1,1}
  681. },
  682. },
  683. })