mirror of
https://github.com/FaceDeer/dfcaverns.git
synced 2025-06-28 14:36:20 +02:00
add something nasty to the underworld
This commit is contained in:
24
hunter_statue/LICENSE.txt
Normal file
24
hunter_statue/LICENSE.txt
Normal file
@ -0,0 +1,24 @@
|
||||
Sounds and textures are under various licenses, see the license.txt file in the /sounds and /textures directories for details.
|
||||
|
||||
License for Code
|
||||
----------------
|
||||
|
||||
Copyright (C) 2020 FaceDeer
|
||||
|
||||
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.
|
156
hunter_statue/init.lua
Normal file
156
hunter_statue/init.lua
Normal file
@ -0,0 +1,156 @@
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
hunter_statue = {}
|
||||
|
||||
local statue_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 95/64, 0.5},
|
||||
},
|
||||
}
|
||||
|
||||
local fourtyfivedegrees = math.pi/4
|
||||
local sixtydegrees = math.pi/3
|
||||
|
||||
local default_sounds
|
||||
if default and default.node_sound_stone_defaults then
|
||||
default_sounds = default.node_sound_stone_defaults()
|
||||
end
|
||||
|
||||
local test_array = {
|
||||
{x=0,y=0,z=0},
|
||||
{x=0,y=-1,z=0},
|
||||
{x=0,y=1,z=0},
|
||||
{x=0,y=-2,z=0},
|
||||
{x=0,y=2,z=0},
|
||||
}
|
||||
|
||||
--statue_def = {
|
||||
-- description = name of statue type
|
||||
-- tiles = {}
|
||||
-- drop = ""
|
||||
-- sounds =
|
||||
-- groups = {}
|
||||
-- interval = 1
|
||||
-- chance = 1
|
||||
-- damage = 8
|
||||
-- knockback = 16
|
||||
-- tnt_vulnerable = false
|
||||
-- tnt_debris =
|
||||
-- other_overrides =
|
||||
--}
|
||||
|
||||
hunter_statue.register_hunter_statue = function(node_name, statue_def)
|
||||
|
||||
local def = {
|
||||
description = statue_def.description or S("Hunter Statue"),
|
||||
-- _doc_items_longdesc = long_description,
|
||||
-- _doc_items_usagehelp = usage_help,
|
||||
drawtype = "mesh",
|
||||
mesh = "hunter_statue.obj",
|
||||
tiles = statue_def.tiles or {},
|
||||
paramtype2 = "facedir",
|
||||
drop = statue_def.drop or "",
|
||||
collision_box = statue_box,
|
||||
selection_box = statue_box,
|
||||
groups = statue_def.groups or {falling_node = 1},
|
||||
sounds = statue_def.sounds or default_sounds,
|
||||
}
|
||||
|
||||
if statue_def.tnt_vulnerable then
|
||||
def.on_blast = function(pos, intensity)
|
||||
if intensity > 3.0 then
|
||||
minetest.set_node(pos, {name= statue_def.tnt_debris or "air"})
|
||||
minetest.check_for_falling(pos)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if statue_def.other_overrides then
|
||||
for k, v in pairs(statue_def.other_overrides) do
|
||||
def[k] = v
|
||||
end
|
||||
end
|
||||
|
||||
local knockback = statue_def.knockback or 16
|
||||
local damage = statue_def.damage or 8
|
||||
|
||||
minetest.register_node(node_name, def)
|
||||
|
||||
minetest.register_abm({
|
||||
label = node_name .. " ABM",
|
||||
nodenames = {node_name},
|
||||
interval = statue_def.interval or 1.0,
|
||||
chance = statue_def.chance or 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local players = minetest.get_connected_players()
|
||||
local nearest_distance = 50
|
||||
local nearest_player = nil
|
||||
local nearest_pos = nil
|
||||
for _, player in pairs(players) do
|
||||
local player_pos = player:get_pos()
|
||||
local player_distance = vector.distance(pos, player_pos)
|
||||
-- ignore far-away players
|
||||
if player_distance < 50 then
|
||||
local look_dir = player:get_look_dir()
|
||||
local statue_dir = vector.direction(player_pos, pos)
|
||||
local angle = vector.angle(look_dir, statue_dir)
|
||||
if angle < sixtydegrees then
|
||||
-- raycast test?
|
||||
-- a player is looking, do nothing
|
||||
return
|
||||
elseif player_distance < nearest_distance then
|
||||
nearest_distance = player_distance
|
||||
nearest_player = player
|
||||
nearest_pos = player_pos
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if nearest_player then
|
||||
if nearest_distance < 2 then
|
||||
local armour_multiplier = 1
|
||||
local fleshy_armour = nearest_player:get_armor_groups().fleshy
|
||||
if fleshy_armour then
|
||||
armour_multiplier = fleshy_armour/100
|
||||
end
|
||||
nearest_player:add_player_velocity(vector.multiply(vector.direction(pos, nearest_pos), knockback))
|
||||
nearest_player:set_hp(math.max(nearest_player:get_hp() - damage*armour_multiplier, 0))
|
||||
minetest.sound_play({name="hunter_statue_thud"}, {pos = nearest_pos})
|
||||
return
|
||||
end
|
||||
local player_dir = vector.direction(pos, nearest_pos)
|
||||
local new_facedir = minetest.dir_to_facedir(player_dir)
|
||||
local new_pos = vector.round(vector.add(pos, player_dir))
|
||||
for _, add_pos in ipairs(test_array) do
|
||||
local test_base = vector.add(new_pos, add_pos)
|
||||
local test_base_node = minetest.get_node(test_base)
|
||||
local test_base_node_def = minetest.registered_nodes[test_base_node.name]
|
||||
if test_base_node_def and test_base_node_def.buildable_to then
|
||||
local test_above = vector.add(test_base, {x=0, y=1, z=0})
|
||||
local test_above_node = minetest.get_node(test_above)
|
||||
local test_above_node_def = minetest.registered_nodes[test_above_node.name]
|
||||
if test_above_node_def and test_above_node_def.buildable_to then
|
||||
local test_below = vector.add(test_base, {x=0, y=-1, z=0})
|
||||
local test_below_node = minetest.get_node(test_below)
|
||||
local test_below_node_def = minetest.registered_nodes[test_below_node.name]
|
||||
if test_below_node_def and test_below_node_def.walkable then
|
||||
minetest.set_node(pos, {name="air"}) -- old location
|
||||
minetest.set_node(test_above, {name="air"}) -- some kind of filler node?
|
||||
node.param2 = new_facedir
|
||||
minetest.set_node(test_base, node)
|
||||
minetest.sound_play({name="hunter_statue_brick_step"}, {pos = pos})
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if node.param2 ~= new_facedir then
|
||||
node.param2 = new_facedir
|
||||
minetest.set_node(pos, node)
|
||||
minetest.sound_play({name="hunter_statue_turn_grind"}, {pos = pos})
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
6
hunter_statue/locale/template.txt
Normal file
6
hunter_statue/locale/template.txt
Normal file
@ -0,0 +1,6 @@
|
||||
# textdomain: hunter_statue
|
||||
|
||||
|
||||
### init.lua ###
|
||||
|
||||
Hunter Statue=
|
2
hunter_statue/mod.conf
Normal file
2
hunter_statue/mod.conf
Normal file
@ -0,0 +1,2 @@
|
||||
name=hunter_statue
|
||||
optional_depends = default
|
204
hunter_statue/models/hunter_statue.obj
Normal file
204
hunter_statue/models/hunter_statue.obj
Normal file
@ -0,0 +1,204 @@
|
||||
# Blender v2.83.1 OBJ File: 'statue.blend'
|
||||
# www.blender.org
|
||||
mtllib hunter_statue.mtl
|
||||
o Reaper_Cube.004
|
||||
v -0.321956 -0.499999 -0.232636
|
||||
v -0.321956 0.000000 -0.232636
|
||||
v 0.321956 -0.499999 -0.232636
|
||||
v 0.321956 0.000000 -0.232636
|
||||
v -0.321956 -0.499999 0.515897
|
||||
v -0.321956 0.000000 0.515897
|
||||
v 0.321956 -0.499999 0.515897
|
||||
v 0.321956 0.000000 0.515897
|
||||
v -0.510628 0.000000 -0.599906
|
||||
v -0.510628 0.450000 -0.599906
|
||||
v 0.510628 0.000000 -0.599906
|
||||
v 0.510628 0.450000 -0.599906
|
||||
v -0.510628 0.000000 0.192351
|
||||
v -0.510628 0.450000 0.192351
|
||||
v 0.510628 0.000000 0.192351
|
||||
v 0.510628 0.450000 0.192351
|
||||
v -0.614139 0.450000 -0.868622
|
||||
v -0.614139 1.355958 -0.868622
|
||||
v 0.614139 0.450000 -0.868622
|
||||
v 0.614139 1.355958 -0.868622
|
||||
v -0.614139 0.450000 -0.050000
|
||||
v -0.614139 1.355958 -0.050000
|
||||
v 0.614139 0.450000 -0.050000
|
||||
v 0.614139 1.355958 -0.050000
|
||||
v -0.319882 0.820354 -0.050000
|
||||
v -0.319882 1.499348 -0.050000
|
||||
v 0.319882 0.820354 -0.050000
|
||||
v 0.319882 1.499348 -0.050000
|
||||
v -0.319882 0.820354 0.720721
|
||||
v -0.319882 1.499348 0.720721
|
||||
v 0.319882 0.820354 0.720721
|
||||
v 0.319882 1.499348 0.720721
|
||||
v -0.176403 1.356000 -0.478804
|
||||
v -0.176403 1.600000 -0.478804
|
||||
v 0.176403 1.356000 -0.478804
|
||||
v 0.176403 1.600000 -0.478804
|
||||
v -0.176403 1.356000 0.313453
|
||||
v -0.176403 1.600000 0.313453
|
||||
v 0.176403 1.356000 0.313453
|
||||
v 0.176403 1.600000 0.313453
|
||||
v 0.070475 0.572531 0.557791
|
||||
v 0.095793 0.829035 0.587892
|
||||
v 0.219244 0.829035 0.587892
|
||||
v 0.095793 0.829035 0.689536
|
||||
v 0.219244 0.829035 0.689536
|
||||
v -0.070475 0.572531 0.557791
|
||||
v -0.095793 0.829035 0.587892
|
||||
v -0.219244 0.829035 0.587892
|
||||
v -0.095793 0.829035 0.689536
|
||||
v -0.219244 0.829035 0.689536
|
||||
vt 0.000000 0.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 0.000000 0.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 0.000000 0.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 0.000000 0.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 0.000000 0.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 0.000000 0.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 0.000000 0.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 0.000000 0.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 0.000000 0.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 0.000000 0.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 0.000000 0.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 0.000000 0.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 0.000000 0.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 0.000000 0.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 0.000000 0.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 0.000000 0.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 0.000000 0.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 0.000000 0.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 0.000000 0.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 0.000000 0.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 0.000000 0.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 0.000000 0.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 1.000000 1.000000
|
||||
vn -0.0000 0.0000 -1.0000
|
||||
vn 1.0000 0.0000 -0.0000
|
||||
vn -0.0000 0.0000 1.0000
|
||||
vn -1.0000 0.0000 0.0000
|
||||
vn 0.0000 -1.0000 -0.0000
|
||||
vn 0.0000 1.0000 0.0000
|
||||
vn 0.0000 0.1166 -0.9932
|
||||
vn 0.8650 -0.5017 0.0000
|
||||
vn 0.0000 -0.4569 0.8895
|
||||
vn -0.9952 0.0982 0.0000
|
||||
vn -0.0000 0.1165 -0.9932
|
||||
vn -0.8650 -0.5017 0.0000
|
||||
vn 0.9952 0.0982 0.0000
|
||||
g Reaper_Cube.004_None
|
||||
usemtl None
|
||||
s off
|
||||
f 1/1/1 2/2/1 4/3/1 3/4/1
|
||||
f 3/5/2 4/6/2 8/7/2 7/8/2
|
||||
f 7/8/3 8/7/3 6/9/3 5/10/3
|
||||
f 5/11/4 6/12/4 2/2/4 1/1/4
|
||||
f 3/13/5 7/14/5 5/11/5 1/1/5
|
||||
f 8/7/6 4/6/6 2/15/6 6/16/6
|
||||
f 9/17/1 10/18/1 12/19/1 11/20/1
|
||||
f 11/21/2 12/22/2 16/23/2 15/24/2
|
||||
f 15/24/3 16/23/3 14/25/3 13/26/3
|
||||
f 13/27/4 14/28/4 10/18/4 9/17/4
|
||||
f 11/29/5 15/30/5 13/27/5 9/17/5
|
||||
f 16/23/6 12/22/6 10/31/6 14/32/6
|
||||
f 17/33/1 18/34/1 20/35/1 19/36/1
|
||||
f 19/37/2 20/38/2 24/39/2 23/40/2
|
||||
f 23/40/3 24/39/3 22/41/3 21/42/3
|
||||
f 21/43/4 22/44/4 18/34/4 17/33/4
|
||||
f 19/45/5 23/46/5 21/43/5 17/33/5
|
||||
f 24/39/6 20/38/6 18/47/6 22/48/6
|
||||
f 25/49/1 26/50/1 28/51/1 27/52/1
|
||||
f 27/53/2 28/54/2 32/55/2 31/56/2
|
||||
f 31/56/3 32/55/3 30/57/3 29/58/3
|
||||
f 29/59/4 30/60/4 26/50/4 25/49/4
|
||||
f 27/61/5 31/62/5 29/59/5 25/49/5
|
||||
f 32/55/6 28/54/6 26/63/6 30/64/6
|
||||
f 33/65/1 34/66/1 36/67/1 35/68/1
|
||||
f 35/69/2 36/70/2 40/71/2 39/72/2
|
||||
f 39/72/3 40/71/3 38/73/3 37/74/3
|
||||
f 37/75/4 38/76/4 34/66/4 33/65/4
|
||||
f 35/77/5 39/78/5 37/75/5 33/65/5
|
||||
f 40/71/6 36/70/6 34/79/6 38/80/6
|
||||
f 41/81/7 42/82/7 43/83/7
|
||||
f 41/81/8 43/84/8 45/85/8
|
||||
f 41/86/9 45/85/9 44/87/9
|
||||
f 41/86/10 44/88/10 42/82/10
|
||||
f 46/89/11 48/90/11 47/91/11
|
||||
f 46/89/12 50/92/12 48/93/12
|
||||
f 46/94/9 49/95/9 50/92/9
|
||||
f 46/94/13 47/91/13 49/96/13
|
BIN
hunter_statue/sounds/hunter_statue_brick_step.1.ogg
Normal file
BIN
hunter_statue/sounds/hunter_statue_brick_step.1.ogg
Normal file
Binary file not shown.
BIN
hunter_statue/sounds/hunter_statue_brick_step.2.ogg
Normal file
BIN
hunter_statue/sounds/hunter_statue_brick_step.2.ogg
Normal file
Binary file not shown.
BIN
hunter_statue/sounds/hunter_statue_brick_step.3.ogg
Normal file
BIN
hunter_statue/sounds/hunter_statue_brick_step.3.ogg
Normal file
Binary file not shown.
BIN
hunter_statue/sounds/hunter_statue_brick_step.4.ogg
Normal file
BIN
hunter_statue/sounds/hunter_statue_brick_step.4.ogg
Normal file
Binary file not shown.
BIN
hunter_statue/sounds/hunter_statue_brick_step.5.ogg
Normal file
BIN
hunter_statue/sounds/hunter_statue_brick_step.5.ogg
Normal file
Binary file not shown.
BIN
hunter_statue/sounds/hunter_statue_brick_step.6.ogg
Normal file
BIN
hunter_statue/sounds/hunter_statue_brick_step.6.ogg
Normal file
Binary file not shown.
BIN
hunter_statue/sounds/hunter_statue_thud.1.ogg
Normal file
BIN
hunter_statue/sounds/hunter_statue_thud.1.ogg
Normal file
Binary file not shown.
BIN
hunter_statue/sounds/hunter_statue_thud.4.ogg
Normal file
BIN
hunter_statue/sounds/hunter_statue_thud.4.ogg
Normal file
Binary file not shown.
BIN
hunter_statue/sounds/hunter_statue_turn_grind.1.ogg
Normal file
BIN
hunter_statue/sounds/hunter_statue_turn_grind.1.ogg
Normal file
Binary file not shown.
BIN
hunter_statue/sounds/hunter_statue_turn_grind.2.ogg
Normal file
BIN
hunter_statue/sounds/hunter_statue_turn_grind.2.ogg
Normal file
Binary file not shown.
BIN
hunter_statue/sounds/hunter_statue_turn_grind.3.ogg
Normal file
BIN
hunter_statue/sounds/hunter_statue_turn_grind.3.ogg
Normal file
Binary file not shown.
3
hunter_statue/sounds/license.txt
Normal file
3
hunter_statue/sounds/license.txt
Normal file
@ -0,0 +1,3 @@
|
||||
hunter_statue_brick_step and hunter_statue_turn_grind are all from https://freesound.org/people/nebulousflynn/sounds/234360/ by nebulousflynn under Creative Commons BY 3.0
|
||||
|
||||
hunter_statue_thud are from https://freesound.org/people/yummy9987/sounds/494930/ under the CC0 license
|
Reference in New Issue
Block a user