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