Initial commit

This commit is contained in:
ekl 2023-01-12 00:22:42 -08:00
commit 43b6d0bef9
15 changed files with 451 additions and 0 deletions

29
LICENSE.md Normal file
View File

@ -0,0 +1,29 @@
# Code
All code (*.lua) is licensed under the MIT license:
```
MIT License
Copyright (c) 2023 ekl
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
# Textures and models
All textures and models (*.png, *.obj) are licensed under [CC0](https://creativecommons.org/publicdomain/zero/1.0/).

9
README.md Normal file
View File

@ -0,0 +1,9 @@
# Splooshy Bombs
Weapons using the Splooshy Bombs API.
Current weapons:
Grenade (explodes on contact)
RPG
Note: The RPG has some intentionally funky ballistics. Aim high to account for gravity and the burn characteristics.

4
modpack.conf Normal file
View File

@ -0,0 +1,4 @@
name = splooshy_bombs
title = Splooshy Bombs
description = Block-flinging explosive weapons (grenade and RPG)
depends = splooshy_bombs_api

View File

@ -0,0 +1,60 @@
local grenadeDuration = 10
local gravity = 9.8
minetest.register_entity("splooshy_bombs_grenade:grenade_entity", {
initial_properties = {
visual = "sprite",
textures = {"splooshy_bombs_grenade_pulled.png"}
},
_age = 0,
_last_pos = false,
on_step = function(self, dtime, moveresult)
self._age = self._age + dtime
local obj = self.object
if not obj then
return
end
if self._age > grenadeDuration then
splooshy_bombs.boom(obj:get_pos(), 4, 50, nil, 0, true, true)
obj:remove()
return
end
obj:add_velocity(vector.new(0, -gravity * dtime, 0))
local current_pos = obj:get_pos()
if not self._last_pos then -- Fallback to approximation if not available
self._last_pos = current_pos:subtract(obj:get_velocity() * dtime)
end
-- Slight offset backwards in an attempt to reduce phasing
local last_pos = self._last_pos:add(obj:get_velocity():normalize():multiply(0.1))
self._last_pos = current_pos
local hit = Raycast(last_pos, current_pos, false, true):next()
if hit then
splooshy_bombs.boom(hit.under or current_pos, 4, {
damage = 50,
damage_radius = 8,
vaporize = false
})
obj:remove()
end
end
})
minetest.register_tool("splooshy_bombs_grenade:grenade", {
description = "Grenade",
visual = "wielditem",
inventory_image = "splooshy_bombs_grenade.png",
on_use = function(itemstack, user, pointed_thing)
local entity = minetest.add_entity(user:get_pos():offset(0, user:get_properties().eye_height, 0),
"splooshy_bombs_grenade:grenade_entity", nil)
if entity then
entity:set_velocity(user:get_velocity():add(user:get_look_dir():multiply(30)))
end
if not (minetest.check_player_privs(user, "creative")) then
return ItemStack()
end
end
})

View File

@ -0,0 +1,4 @@
name = splooshy_bombs_grenade
title = Splooshy Bombs Grenade
description = Hand Grenade
depends = splooshy_bombs_api

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 B

View File

@ -0,0 +1,86 @@
local rocketExpireSeconds = 10
local rocketPropulsionSeconds = 1.5
local rocketGravity = 9.8
-- Todo fix model/textures
minetest.register_entity("splooshy_bombs_rpg:rpg_entity", {
initial_properties = {
visual = "mesh",
mesh = "splooshy_bombs_rpg.obj",
textures = {"splooshy_bombs_rpg_body.png", "splooshy_bombs_rpg_head.png"}
},
_age = 0,
_last_pos = false,
on_step = function(self, dtime, moveresult)
self._age = self._age + dtime
local obj = self.object
if not obj then
return
end
if self._age > rocketExpireSeconds then
obj:remove()
return
end
if self._age < rocketPropulsionSeconds then
obj:add_velocity(vector.new(0, 0, dtime * 100 * (math.min(self._age ^ 2, 1))):rotate(obj:get_rotation()))
end
obj:add_velocity(vector.new(0, -rocketGravity * dtime, 0))
local current_pos = obj:get_pos()
if not self._last_pos then -- Fallback to approximation if not available
self._last_pos = current_pos:subtract(obj:get_velocity() * dtime)
end
-- Slight offset backwards in an attempt to reduce phasing
local last_pos = self._last_pos:add(obj:get_velocity():normalize():multiply(0.1))
self._last_pos = current_pos
local hit = Raycast(last_pos, current_pos, false, true):next()
if hit then
splooshy_bombs.boom(hit.under or current_pos, 5, {
damage = 50,
damage_radius = 7,
vaporize = false,
velocity = obj:get_velocity():multiply(0.05):offset(0, 20, 0)
}, nil)
obj:remove()
end
end
})
minetest.register_tool("splooshy_bombs_rpg:rocket_tube_loaded", {
description = "Rocket launcher",
visual = "wielditem",
inventory_image = "splooshy_bombs_rpg_loaded.png",
on_use = function(itemstack, user, pointed_thing)
local entity = minetest.add_entity(user:get_pos():offset(0, user:get_properties().eye_height, 0),
"splooshy_bombs_rpg:rpg_entity", nil)
if entity then
entity:set_velocity(user:get_velocity():add(user:get_look_dir():multiply(20)))
entity:set_rotation(user:get_look_dir():dir_to_rotation())
end
if not (minetest.check_player_privs(user, "creative")) then
return ItemStack("splooshy_bombs_rpg:rocket_tube")
end
end
})
minetest.register_craftitem("splooshy_bombs_rpg:rocket_tube", {
description = "Rocket launcher",
visual = "wielditem",
inventory_image = "splooshy_bombs_rpg_unloaded.png"
})
minetest.register_craftitem("splooshy_bombs_rpg:rocket", {
description = "RPG Rocket",
visual = "wielditem",
inventory_image = "splooshy_bombs_rpg_rocket.png"
})
minetest.register_craft({
type = "shapeless",
output = "splooshy_bombs_rpg:rocket_tube_loaded",
recipe = {"splooshy_bombs_rpg:rocket_tube", "splooshy_bombs_rpg:rocket"}
})

View File

@ -0,0 +1,4 @@
name = splooshy_bombs_rpg
title = Splooshy Bombs RPG
description = RPG/Rocket launcher
depends = splooshy_bombs_api

View File

@ -0,0 +1,255 @@
# Blender 3.4.1
# www.blender.org
mtllib splooshy_bombs_rpg.mtl
o Cylinder.001
v -0.000000 0.273837 -1.317601
v 0.193632 0.193632 -1.317601
v 0.273837 -0.000000 -1.317601
v 0.193632 -0.193632 -1.317601
v -0.000000 -0.273837 -1.317601
v -0.193632 -0.193632 -1.317601
v -0.193632 0.193632 -1.317601
v 0.000003 0.273837 -7.189894
v 0.193635 0.193632 -7.189894
v 0.273840 -0.000000 -7.189894
v 0.193635 -0.193632 -7.189894
v 0.000003 -0.273837 -7.189894
v -0.193629 -0.193632 -7.189894
v -0.273833 -0.000000 -7.189895
v -0.193629 0.193632 -7.189894
v -0.000000 0.273837 -1.317601
v 0.193632 0.193632 -1.317601
v 0.273837 -0.000000 -1.317601
v 0.193632 -0.193632 -1.317601
v -0.000000 -0.273837 -1.317601
v -0.193632 -0.193632 -1.317601
v -0.273837 -0.000000 -1.317601
v -0.273837 -0.000000 -1.317601
v -0.193632 0.193632 -1.317601
vn -0.9239 0.3827 -0.0000
vn -0.0000 -0.0000 -1.0000
vn -0.3827 -0.9239 -0.0000
vn 0.9239 -0.3827 -0.0000
vn 0.3827 0.9239 -0.0000
vn -0.3827 0.9239 -0.0000
vn -0.9239 -0.3827 -0.0000
vn 0.3827 -0.9239 -0.0000
vn 0.9239 0.3827 -0.0000
vt 0.750000 0.315721
vt 0.796472 0.296472
vt 0.815721 0.250000
vt 0.796472 0.203528
vt 0.750000 0.184279
vt 0.703528 0.203528
vt 0.703528 0.296472
vt 0.750000 0.315721
vt 0.796472 0.296472
vt 0.815721 0.250000
vt 0.796472 0.203528
vt 0.750000 0.184279
vt 0.703528 0.203528
vt 0.684279 0.250000
vt 0.703528 0.296472
vt 0.750000 0.315721
vt 0.796472 0.296472
vt 0.815721 0.250000
vt 0.796472 0.203528
vt 0.750000 0.184279
vt 0.703528 0.203528
vt 0.684279 0.250000
vt 0.684279 0.250000
vt 0.703528 0.296472
s 0
usemtl Material.002
f 22/22/1 24/24/1 15/15/1 14/14/1
f 8/8/2 9/9/2 10/10/2 11/11/2 12/12/2 13/13/2 14/14/2 15/15/2
f 20/20/3 21/21/3 13/13/3 12/12/3
f 18/18/4 19/19/4 11/11/4 10/10/4
f 16/16/5 17/17/5 9/9/5 8/8/5
f 7/7/6 1/1/6 8/8/6 15/15/6
f 6/6/7 23/23/7 14/14/7 13/13/7
f 4/4/8 5/5/8 12/12/8 11/11/8
f 2/2/9 3/3/9 10/10/9 9/9/9
o Cylinder.002
v -0.000000 0.266777 1.388399
v 0.188640 0.188640 1.388399
v -0.188640 0.188640 1.388399
v 0.000000 0.648206 1.153791
v 0.458351 0.458351 1.153791
v -0.458351 0.458351 1.153791
v 0.000000 1.000000 0.279523
v 0.707107 0.707107 0.279523
v 0.000000 1.000000 -0.559599
v -0.707107 0.707107 0.279523
v -1.000000 0.000000 0.279523
v -0.707107 0.707107 -0.559599
v -1.000000 -0.000000 -0.559599
v -0.193632 0.193632 -1.317601
v -0.193632 0.193632 -1.317601
v -0.000000 0.273837 -1.317601
v -0.273837 -0.000000 -1.317601
v -0.707107 -0.707107 -0.559599
v -0.273837 -0.000000 -1.317601
v -0.193632 -0.193632 -1.317601
v 0.000000 -1.000000 -0.559599
v -0.707107 -0.707107 0.279523
v -0.193632 -0.193632 -1.317601
v -0.000000 -0.273837 -1.317601
v 0.000000 -1.000000 0.279523
v -0.458351 -0.458351 1.153791
v 0.000000 -0.648206 1.153791
v -0.648206 0.000000 1.153791
v -0.188640 -0.188640 1.388399
v -0.000000 -0.266777 1.388399
v -0.266777 0.000000 1.388399
v 0.188640 -0.188640 1.388399
v 0.266777 0.000000 1.388399
v 0.458351 -0.458351 1.153791
v 0.648206 0.000000 1.153791
v 0.707107 -0.707107 0.279523
v 1.000000 0.000000 0.279523
v 0.707107 -0.707107 -0.559599
v 1.000000 -0.000000 -0.559599
v 0.193632 -0.193632 -1.317601
v 0.193632 -0.193632 -1.317601
v -0.000000 -0.273837 -1.317601
v 0.273837 -0.000000 -1.317601
v 0.707107 0.707107 -0.559599
v 0.273837 -0.000000 -1.317601
v 0.193632 0.193632 -1.317601
v 0.193632 0.193632 -1.317601
v -0.000000 0.273837 -1.317601
vn 0.2121 0.5120 0.8324
vn -0.0000 -0.0000 1.0000
vn -0.2121 0.5120 0.8324
vn 0.3587 0.8660 0.3485
vn -0.3587 0.8660 0.3485
vn 0.3827 0.9239 -0.0000
vn -0.3827 0.9239 -0.0000
vn -0.8660 0.3587 0.3485
vn -0.9239 0.3827 -0.0000
vn -0.6918 0.2866 -0.6628
vn -0.2866 0.6918 -0.6628
vn -0.6918 -0.2866 -0.6628
vn -0.9239 -0.3827 -0.0000
vn -0.2866 -0.6918 -0.6628
vn -0.3827 -0.9239 -0.0000
vn -0.3587 -0.8660 0.3485
vn -0.8660 -0.3587 0.3485
vn -0.2121 -0.5120 0.8324
vn -0.5120 -0.2121 0.8324
vn -0.5120 0.2121 0.8324
vn 0.2121 -0.5120 0.8324
vn 0.5120 -0.2121 0.8324
vn 0.8660 -0.3587 0.3485
vn 0.3587 -0.8660 0.3485
vn 0.9239 -0.3827 -0.0000
vn 0.3827 -0.9239 -0.0000
vn 0.6918 -0.2866 -0.6628
vn 0.2866 -0.6918 -0.6628
vn 0.6918 0.2866 -0.6628
vn 0.9239 0.3827 -0.0000
vn 0.2866 0.6918 -0.6628
vn 0.8660 0.3587 0.3485
vn 0.5120 0.2121 0.8324
vt 0.250000 0.314027
vt 0.295274 0.295274
vt 0.204726 0.295274
vt 0.250000 0.405570
vt 0.360004 0.360004
vt 0.139996 0.360004
vt 0.250000 0.490000
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 0.875000 1.000000
vt 0.419706 0.419706
vt 1.000000 0.500000
vt 0.000000 0.500000
vt 0.750000 0.490000
vt 0.080294 0.419706
vt 0.125000 1.000000
vt 0.250000 1.000000
vt 0.010000 0.250000
vt 0.125000 0.500000
vt 0.580294 0.419706
vt 0.510000 0.250000
vt 0.250000 0.500000
vt 0.703528 0.296472
vt 0.703528 0.296472
vt 0.750000 0.315721
vt 0.684279 0.250000
vt 0.580294 0.080294
vt 0.375000 0.500000
vt 0.684279 0.250000
vt 0.703528 0.203528
vt 0.500000 0.500000
vt 0.750000 0.010000
vt 0.375000 1.000000
vt 0.080294 0.080294
vt 0.703528 0.203528
vt 0.750000 0.184279
vt 0.250000 0.010000
vt 0.500000 1.000000
vt 0.139996 0.139996
vt 0.250000 0.094430
vt 0.094430 0.250000
vt 0.204726 0.204726
vt 0.250000 0.185973
vt 0.185973 0.250000
vt 0.295274 0.204726
vt 0.314027 0.250000
vt 0.360004 0.139996
vt 0.405570 0.250000
vt 0.419706 0.080294
vt 0.625000 1.000000
vt 0.750000 1.000000
vt 0.490000 0.250000
vt 0.625000 0.500000
vt 0.919706 0.080294
vt 0.990000 0.250000
vt 0.750000 0.500000
vt 0.796472 0.203528
vt 0.796472 0.203528
vt 0.750000 0.184279
vt 0.815721 0.250000
vt 0.875000 0.500000
vt 0.919706 0.419706
vt 0.815721 0.250000
vt 0.796472 0.296472
vt 0.796472 0.296472
vt 0.750000 0.315721
s 0
usemtl Material.003
f 25/25/10 26/26/10 29/29/10 28/28/10
f 26/26/11 25/25/11 27/27/11 55/68/11 53/66/11 54/67/11 56/69/11 57/70/11
f 27/27/12 25/25/12 28/28/12 30/30/12
f 28/28/13 29/29/13 32/35/13 31/31/13
f 30/30/14 28/28/14 31/31/14 34/39/14
f 33/36/15 31/32/15 32/34/15 68/85/15
f 36/43/16 34/40/16 31/33/16 33/37/16
f 52/65/17 30/30/17 34/39/17 35/42/17
f 37/46/18 35/41/18 34/40/18 36/43/18
f 38/47/19 41/50/19 37/45/19 36/44/19
f 40/49/20 39/48/20 36/44/20 33/38/20
f 43/53/21 44/54/21 42/51/21 37/45/21
f 42/52/22 46/57/22 35/41/22 37/46/22
f 47/59/23 48/60/23 45/56/23 42/51/23
f 45/55/24 49/62/24 46/57/24 42/52/24
f 51/64/25 50/63/25 46/58/25 49/61/25
f 50/63/26 52/65/26 35/42/26 46/58/26
f 54/67/27 53/66/27 50/63/27 51/64/27
f 53/66/28 55/68/28 52/65/28 50/63/28
f 55/68/29 27/27/29 30/30/29 52/65/29
f 56/69/30 54/67/30 51/64/30 58/71/30
f 57/70/31 56/69/31 58/71/31 59/72/31
f 59/72/32 58/71/32 60/73/32 61/76/32
f 58/71/33 51/64/33 49/61/33 60/73/33
f 63/80/34 61/75/34 60/74/34 62/77/34
f 62/77/35 60/74/35 49/62/35 45/55/35
f 64/81/36 67/84/36 63/79/36 62/78/36
f 66/83/37 65/82/37 62/78/37 45/56/37
f 69/87/38 70/88/38 68/86/38 63/79/38
f 68/85/39 32/34/39 61/75/39 63/80/39
f 71/89/40 72/90/40 33/38/40 68/86/40
f 29/29/41 59/72/41 61/76/41 32/35/41
f 26/26/42 57/70/42 59/72/42 29/29/42

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B