mod rewrite
This commit is contained in:
parent
9c3f56c66b
commit
a8fae6153a
@ -2,13 +2,13 @@
|
||||
![Umbra's screenshot](screenshot.png)
|
||||
**_Adds a shadow-looking Non Playing Character._**
|
||||
|
||||
**Version:** 0.1.1
|
||||
**Version:** 0.1.2
|
||||
**Source code's license:** [EUPL v1.2][1] or later
|
||||
**Texture license:** [CC BY-SA v4.0 International][2] or later
|
||||
|
||||
**Dependencies:** default (found in [Minetest Game][3]), mobs ([Mobs Redo][4])
|
||||
|
||||
__Advanced options:__
|
||||
__Advanced options:__
|
||||
Settings -> All Settings -> Mods -> mobs_umbra
|
||||
|
||||
|
||||
|
15
changelog.md
15
changelog.md
@ -9,6 +9,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
|
||||
|
||||
|
||||
|
||||
## [0.1.2] - 2020-07-02
|
||||
### Changed
|
||||
|
||||
- Code rewritten from scratch and split into different files.
|
||||
|
||||
### Added
|
||||
|
||||
- Options to tweak mob's spawning options, see Settings -> All Settings -> mobs_umbra
|
||||
|
||||
### Removed
|
||||
|
||||
- Support for Minetest Game v0.4.x
|
||||
|
||||
|
||||
|
||||
## [0.1.1] - 2020-05-02
|
||||
### Changed
|
||||
|
||||
|
56
core/functions.lua
Normal file
56
core/functions.lua
Normal file
@ -0,0 +1,56 @@
|
||||
--[[
|
||||
Mobs Umbra - Adds a shadow-looking Non Playing Character.
|
||||
Copyright © 2019, 2020 Hamlet and contributors.
|
||||
|
||||
Licensed under the EUPL, Version 1.2 or – as soon they will be
|
||||
approved by the European Commission – subsequent versions of the
|
||||
EUPL (the "Licence");
|
||||
You may not use this work except in compliance with the Licence.
|
||||
You may obtain a copy of the Licence at:
|
||||
|
||||
https://joinup.ec.europa.eu/software/page/eupl
|
||||
https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32017D0863
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the Licence is distributed on an
|
||||
"AS IS" basis,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied.
|
||||
See the Licence for the specific language governing permissions
|
||||
and limitations under the Licence.
|
||||
|
||||
--]]
|
||||
|
||||
|
||||
--
|
||||
-- Procedures
|
||||
--
|
||||
|
||||
-- Check for free space and place a new node
|
||||
mobs_umbra.pr_PlaceNode = function(a_v_position)
|
||||
|
||||
local s_oldNodeName = minetest.get_node(a_v_position).name
|
||||
|
||||
if (s_oldNodeName == 'air') then
|
||||
minetest.set_node(a_v_position, {name = 'mobs_umbra:obscure_node'})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- Used to create a cube of nodes around the target
|
||||
mobs_umbra.pr_DarkCube = function(a_v_position, a_i_offset)
|
||||
local v_coordinates = {y = 0.0, x = 0.0, z = 0.0}
|
||||
|
||||
for i_value = -a_i_offset, a_i_offset do
|
||||
v_coordinates.x = (a_v_position.x + i_value)
|
||||
|
||||
for i_value = -a_i_offset, a_i_offset do
|
||||
v_coordinates.z = (a_v_position.z + i_value)
|
||||
|
||||
for i_value = -a_i_offset, a_i_offset do
|
||||
v_coordinates.y = (a_v_position.y + i_value)
|
||||
mobs_umbra.pr_PlaceNode(v_coordinates)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
98
core/mob.lua
Normal file
98
core/mob.lua
Normal file
@ -0,0 +1,98 @@
|
||||
--[[
|
||||
Mobs Umbra - Adds a shadow-looking Non Playing Character.
|
||||
Copyright © 2019, 2020 Hamlet and contributors.
|
||||
|
||||
Licensed under the EUPL, Version 1.2 or – as soon they will be
|
||||
approved by the European Commission – subsequent versions of the
|
||||
EUPL (the "Licence");
|
||||
You may not use this work except in compliance with the Licence.
|
||||
You may obtain a copy of the Licence at:
|
||||
|
||||
https://joinup.ec.europa.eu/software/page/eupl
|
||||
https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32017D0863
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the Licence is distributed on an
|
||||
"AS IS" basis,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied.
|
||||
See the Licence for the specific language governing permissions
|
||||
and limitations under the Licence.
|
||||
|
||||
--]]
|
||||
|
||||
|
||||
--
|
||||
-- Mobile entity
|
||||
--
|
||||
|
||||
mobs:register_mob('mobs_umbra:umbra', {
|
||||
nametag = 'Umbra',
|
||||
type = 'npc',
|
||||
hp_min = minetest.PLAYER_MAX_HP_DEFAULT,
|
||||
hp_max = minetest.PLAYER_MAX_HP_DEFAULT,
|
||||
armor = 100, -- Same as player
|
||||
walk_velocity = 4, -- Same as player
|
||||
run_velocity = 5,
|
||||
stand_chance = 50, -- 50%
|
||||
walk_chance = 50, -- 50%
|
||||
jump = true, -- Same as player
|
||||
jump_height = 6,
|
||||
pushable = false, -- Same as player
|
||||
view_range = 16, -- A map-chunk
|
||||
damage = 1, -- Same as player (bare hands)
|
||||
knock_back = false, -- Same as player
|
||||
fear_height = 0, -- Disabled
|
||||
fall_damage = false,
|
||||
water_damage = 0, -- Disabled
|
||||
lava_damage = 20, -- Lava = super light source.
|
||||
light_damage_min = (minetest.LIGHT_MAX / 2),
|
||||
light_damage_max = minetest.LIGHT_MAX,
|
||||
suffocation = 0, -- Disabled
|
||||
floats = 0, -- Disabled
|
||||
reach = 4, -- Same as player
|
||||
attack_chance = 25, -- 25%
|
||||
attack_monsters = true,
|
||||
attack_npcs = true,
|
||||
attack_players = true,
|
||||
group_attack = true,
|
||||
attack_type = 'dogshoot',
|
||||
arrow = 'mobs_umbra:sagitta_obscura',
|
||||
pathfinding = 1, -- Enabled when in melee range
|
||||
dogshoot_switch = 1,
|
||||
dogshoot_count_max = 9,
|
||||
dogshoot_count2_max = 5,
|
||||
shoot_interval = 3,
|
||||
shoot_offset = 1,
|
||||
makes_footstep_sound = 0, -- Disabled
|
||||
drops = {
|
||||
{name = 'default:gold_lump', chance = 75, min = 1, max = 5}
|
||||
},
|
||||
visual = 'mesh',
|
||||
visual_size = {x = 1.0, y = 1.0, z = 0.01},
|
||||
collisionbox = {-0.4, 0.0, -0.4, 0.4, 1.7, 0.4},
|
||||
selectionbox = {-0.4, 0.0, -0.4, 0.4, 1.7, 0.4},
|
||||
textures = {'character.png^[colorize:black:255'},
|
||||
mesh = 'character.b3d',
|
||||
animation = {
|
||||
stand_start = 0,
|
||||
stand_end = 79,
|
||||
stand_speed = 30,
|
||||
|
||||
walk_start = 168,
|
||||
walk_end = 187,
|
||||
walk_speed = 30,
|
||||
|
||||
run_start = 168,
|
||||
run_end = 187,
|
||||
run_speed = 30,
|
||||
|
||||
punch_start = 189,
|
||||
punch_end = 198,
|
||||
punch_speed = 30,
|
||||
|
||||
die_start = 162,
|
||||
die_end = 166,
|
||||
die_speed = 0.8
|
||||
}
|
||||
})
|
59
core/node.lua
Normal file
59
core/node.lua
Normal file
@ -0,0 +1,59 @@
|
||||
--[[
|
||||
Mobs Umbra - Adds a shadow-looking Non Playing Character.
|
||||
Copyright © 2019, 2020 Hamlet and contributors.
|
||||
|
||||
Licensed under the EUPL, Version 1.2 or – as soon they will be
|
||||
approved by the European Commission – subsequent versions of the
|
||||
EUPL (the "Licence");
|
||||
You may not use this work except in compliance with the Licence.
|
||||
You may obtain a copy of the Licence at:
|
||||
|
||||
https://joinup.ec.europa.eu/software/page/eupl
|
||||
https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32017D0863
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the Licence is distributed on an
|
||||
"AS IS" basis,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied.
|
||||
See the Licence for the specific language governing permissions
|
||||
and limitations under the Licence.
|
||||
|
||||
--]]
|
||||
|
||||
|
||||
--
|
||||
-- Node definition and registration
|
||||
--
|
||||
|
||||
minetest.register_node('mobs_umbra:obscure_node', {
|
||||
description = "Umbra's Obscure Node",
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
drawtype = 'normal',
|
||||
sunlight_propagates = false,
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
climbable = false,
|
||||
buildable_to = true,
|
||||
floodable = false,
|
||||
color = 'black',
|
||||
post_effect_color = 'black',
|
||||
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(mobs_umbra.darkNodeTimeout)
|
||||
end,
|
||||
|
||||
on_timer = function(pos, elapsed)
|
||||
minetest.set_node(pos, {name = 'air'})
|
||||
|
||||
return true
|
||||
end
|
||||
})
|
||||
|
||||
if (mobs_umbra.darkCubeDamages == true) then
|
||||
print("Dark cube damage enabled: " .. mobs_umbra.darkCubeDPS)
|
||||
minetest.override_item('mobs_umbra:obscure_node', {
|
||||
damage_per_second = mobs_umbra.darkCubeDPS,
|
||||
})
|
||||
end
|
97
core/projectile.lua
Normal file
97
core/projectile.lua
Normal file
@ -0,0 +1,97 @@
|
||||
--[[
|
||||
Mobs Umbra - Adds a shadow-looking Non Playing Character.
|
||||
Copyright © 2019, 2020 Hamlet and contributors.
|
||||
|
||||
Licensed under the EUPL, Version 1.2 or – as soon they will be
|
||||
approved by the European Commission – subsequent versions of the
|
||||
EUPL (the "Licence");
|
||||
You may not use this work except in compliance with the Licence.
|
||||
You may obtain a copy of the Licence at:
|
||||
|
||||
https://joinup.ec.europa.eu/software/page/eupl
|
||||
https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32017D0863
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the Licence is distributed on an
|
||||
"AS IS" basis,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied.
|
||||
See the Licence for the specific language governing permissions
|
||||
and limitations under the Licence.
|
||||
|
||||
--]]
|
||||
|
||||
|
||||
--
|
||||
-- Mobile arrow
|
||||
--
|
||||
|
||||
mobs:register_arrow('mobs_umbra:sagitta_obscura', {
|
||||
|
||||
visual = 'sprite',
|
||||
visual_size = {x = 0.5, y = 0.5},
|
||||
textures = {'mobs_umbra_projectile.png'},
|
||||
velocity = 35, -- Nodes per second
|
||||
|
||||
|
||||
hit_player = function(self, player)
|
||||
|
||||
--[[
|
||||
Minetest v5.2.0 lua_api.txt at line 1853
|
||||
|
||||
object:punch(puncher, time_from_last_punch, tool_capabilities,
|
||||
direction)
|
||||
--]]
|
||||
|
||||
local v_position = self.object:get_pos()
|
||||
|
||||
player:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups = {fleshy = 2}
|
||||
},
|
||||
nil
|
||||
)
|
||||
|
||||
mobs_umbra.pr_DarkCube(v_position, mobs_umbra.darkCubeOffset)
|
||||
end,
|
||||
|
||||
|
||||
hit_mob = function(self, player)
|
||||
|
||||
local v_position = self.object:get_pos()
|
||||
|
||||
-- See "hit player" for the explanation.
|
||||
player:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups = {fleshy = 2}
|
||||
},
|
||||
nil
|
||||
)
|
||||
|
||||
mobs_umbra.pr_DarkCube(v_position, mobs_umbra.darkCubeOffset)
|
||||
end,
|
||||
|
||||
|
||||
hit_object = function(self, player)
|
||||
|
||||
local v_position = self.object:get_pos()
|
||||
|
||||
-- See "hit player" for the explanation.
|
||||
player:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups = {fleshy = 2}
|
||||
},
|
||||
nil
|
||||
)
|
||||
|
||||
mobs_umbra.pr_DarkCube(v_position, mobs_umbra.darkCubeOffset)
|
||||
end,
|
||||
|
||||
|
||||
hit_node = function(self, pos, node)
|
||||
|
||||
local v_position = self.object:get_pos()
|
||||
|
||||
mobs_umbra.pr_DarkCube(v_position, mobs_umbra.darkCubeOffset)
|
||||
end
|
||||
})
|
58
core/spawning.lua
Normal file
58
core/spawning.lua
Normal file
@ -0,0 +1,58 @@
|
||||
--[[
|
||||
Mobs Umbra - Adds a shadow-looking Non Playing Character.
|
||||
Copyright © 2019, 2020 Hamlet and contributors.
|
||||
|
||||
Licensed under the EUPL, Version 1.2 or – as soon they will be
|
||||
approved by the European Commission – subsequent versions of the
|
||||
EUPL (the "Licence");
|
||||
You may not use this work except in compliance with the Licence.
|
||||
You may obtain a copy of the Licence at:
|
||||
|
||||
https://joinup.ec.europa.eu/software/page/eupl
|
||||
https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32017D0863
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the Licence is distributed on an
|
||||
"AS IS" basis,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied.
|
||||
See the Licence for the specific language governing permissions
|
||||
and limitations under the Licence.
|
||||
|
||||
--]]
|
||||
|
||||
|
||||
--
|
||||
-- Mobile spawner
|
||||
--
|
||||
|
||||
mobs:spawn({
|
||||
name = 'mobs_umbra:umbra',
|
||||
nodes = {
|
||||
'group:cracky',
|
||||
'group:stone',
|
||||
'group:crumbly',
|
||||
'group:sand',
|
||||
'group:snowy',
|
||||
},
|
||||
neighbors = {'air'},
|
||||
min_light = 0,
|
||||
max_light = 5,
|
||||
interval = mobs_umbra.spawnInterval,
|
||||
chance = mobs_umbra.spawnChance,
|
||||
active_object_count = mobs_umbra.AOC,
|
||||
min_height = mobs_umbra.minHeight,
|
||||
max_height = mobs_umbra.maxHeight
|
||||
})
|
||||
|
||||
|
||||
-- Spawn Egg
|
||||
|
||||
mobs:register_egg('mobs_umbra:umbra', 'Umbra', 'mobs_umbra_projectile.png')
|
||||
|
||||
|
||||
--
|
||||
-- Alias
|
||||
--
|
||||
|
||||
mobs:alias_mob('mobs:umbra', 'mobs_umbra:umbra')
|
@ -1 +0,0 @@
|
||||
default, mobs
|
@ -1 +0,0 @@
|
||||
Adds a shadow-looking Non Playing Character.
|
305
init.lua
305
init.lua
@ -23,279 +23,92 @@
|
||||
|
||||
|
||||
--
|
||||
-- Variables
|
||||
-- Global mod's namespace
|
||||
--
|
||||
|
||||
-- Multiplier used for damage calculation
|
||||
local mob_difficulty = tonumber(minetest.settings:get("mob_difficulty"))
|
||||
if (mob_difficulty == nil) then
|
||||
mob_difficulty = 1
|
||||
end
|
||||
mobs_umbra = {}
|
||||
|
||||
|
||||
--
|
||||
-- Constants
|
||||
--
|
||||
|
||||
-- Spawner frequency, stated in seconds.
|
||||
mobs_umbra.spawnInterval =
|
||||
tonumber(minetest.settings:get('mobs_umbra_spawn_interval')) or 60
|
||||
|
||||
-- Spawning chance; 1 = always, 2 = 50%, etc.
|
||||
mobs_umbra.spawnChance =
|
||||
tonumber(minetest.settings:get('mobs_umbra_spawn_chance')) or 7500
|
||||
|
||||
-- Number of umbras per active mapchunk.
|
||||
mobs_umbra.AOC = tonumber(minetest.settings:get('mobs_umbra_aoc')) or 1
|
||||
|
||||
-- Min spawn height, stated in nodes.
|
||||
mobs_umbra.minHeight =
|
||||
tonumber(minetest.settings:get('mobs_umbra_min_height')) or -30912
|
||||
|
||||
-- Max spawn height, stated in nodes.
|
||||
mobs_umbra.maxHeight =
|
||||
tonumber(minetest.settings:get('mobs_umbra_max_height')) or -300
|
||||
|
||||
-- Offset used to determine the cube of darkness' volume
|
||||
local dark_cube_offset = tonumber(minetest.settings:get("mobs_umbra_cube_offset"))
|
||||
if (dark_cube_offset == nil) then
|
||||
dark_cube_offset = 2
|
||||
end
|
||||
mobs_umbra.darkCubeOffset =
|
||||
tonumber(minetest.settings:get('mobs_umbra_cube_offset')) or 2
|
||||
|
||||
-- Seconds until the cube of darkness vanishes
|
||||
local dark_node_timeout = tonumber(minetest.settings:get("mobs_umbra_darkness_timeout"))
|
||||
if (dark_node_timeout == nil) then
|
||||
dark_node_timeout = 20
|
||||
end
|
||||
mobs_umbra.darkNodeTimeout =
|
||||
tonumber(minetest.settings:get('mobs_umbra_darkness_timeout')) or 20
|
||||
|
||||
-- Whether if the cube of darkness should damage
|
||||
local dark_cube_damages = minetest.settings:get_bool("mobs_umbra_darkness_damage")
|
||||
if (dark_cube_damages == nil) then
|
||||
dark_cube_damages = false
|
||||
end
|
||||
mobs_umbra.darkCubeDamages =
|
||||
minetest.settings:get_bool('mobs_umbra_darkness_damage') or false
|
||||
|
||||
-- How much damage per second should be dealt by the cube of darkness
|
||||
local dark_cube_dps = tonumber(minetest.settings:get("mobs_umbra_darkness_dps"))
|
||||
if (dark_cube_dps == nil) then
|
||||
dark_cube_dps = 1
|
||||
end
|
||||
mobs_umbra.darkCubeDPS =
|
||||
tonumber(minetest.settings:get('mobs_umbra_darkness_dps')) or 1
|
||||
|
||||
|
||||
--
|
||||
-- Functions
|
||||
-- Procedures
|
||||
--
|
||||
|
||||
-- Check for free space and place a new node
|
||||
local PlaceNode = function(pos)
|
||||
local old_node_name = minetest.get_node(pos).name
|
||||
-- Minetest logger
|
||||
local pr_LogMessage = function()
|
||||
|
||||
if (old_node_name == "air") then
|
||||
minetest.set_node(pos, {name = "mobs_umbra:obscure_node"})
|
||||
end
|
||||
end
|
||||
-- Constant
|
||||
local s_LOG_LEVEL = minetest.settings:get('debug_log_level')
|
||||
|
||||
-- Create a cube of nodes around the target
|
||||
local DarkCube = function(pos, offset)
|
||||
local coordinates = {y = 0.0, x = 0.0, z = 0.0}
|
||||
|
||||
for value = -offset, offset do
|
||||
coordinates.x = (pos.x + value)
|
||||
|
||||
for value = -offset, offset do
|
||||
coordinates.z = (pos.z + value)
|
||||
|
||||
for value = -offset, offset do
|
||||
coordinates.y = (pos.y + value)
|
||||
PlaceNode(coordinates)
|
||||
end
|
||||
end
|
||||
-- Body
|
||||
if (s_LOG_LEVEL == nil)
|
||||
or (s_LOG_LEVEL == 'action')
|
||||
or (s_LOG_LEVEL == 'info')
|
||||
or (s_LOG_LEVEL == 'verbose')
|
||||
then
|
||||
minetest.log('action', '[Mod] Mobs Umbra [v0.1.2] loaded.')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Obscure node
|
||||
--
|
||||
-- Subfiles loader
|
||||
local pr_LoadSubFiles = function()
|
||||
|
||||
minetest.register_node("mobs_umbra:obscure_node", {
|
||||
description = "Umbra's Obscure Node",
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
drawtype = "normal",
|
||||
sunlight_propagates = false,
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
climbable = false,
|
||||
buildable_to = true,
|
||||
floodable = false,
|
||||
color = "black",
|
||||
post_effect_color = "black",
|
||||
-- Constant
|
||||
local s_MOD_PATH = minetest.get_modpath('mobs_umbra')
|
||||
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(dark_node_timeout)
|
||||
end,
|
||||
-- Body
|
||||
dofile(s_MOD_PATH .. '/core/functions.lua')
|
||||
dofile(s_MOD_PATH .. '/core/node.lua')
|
||||
dofile(s_MOD_PATH .. '/core/projectile.lua')
|
||||
dofile(s_MOD_PATH .. '/core/mob.lua')
|
||||
dofile(s_MOD_PATH .. '/core/spawning.lua')
|
||||
|
||||
on_timer = function(pos, elapsed)
|
||||
minetest.set_node(pos, {name = "air"})
|
||||
return true
|
||||
end
|
||||
})
|
||||
|
||||
if (dark_cube_damages == true) then
|
||||
minetest.override_item("mobs_umbra:obscure_node", {
|
||||
damage = dark_cube_dps
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Mobile entity
|
||||
-- Main body
|
||||
--
|
||||
|
||||
mobs:register_mob("mobs_umbra:umbra", {
|
||||
type = "npc",
|
||||
hp_min = 20,
|
||||
hp_max = 20,
|
||||
armor = 100,
|
||||
walk_velocity = 4,
|
||||
run_velocity = 5,
|
||||
stand_chance = 50,
|
||||
walk_chance = 50,
|
||||
jump = true,
|
||||
jump_height = 1.1,
|
||||
stepheight = 1.1,
|
||||
pushable = false,
|
||||
view_range = 14,
|
||||
damage = 1,
|
||||
knock_back = false,
|
||||
fall_damage = false,
|
||||
lava_damage = 20,
|
||||
light_damage = 2,
|
||||
light_damage_min = 7,
|
||||
light_damage_max = 15,
|
||||
suffocation = 0,
|
||||
floats = false,
|
||||
reach = 4,
|
||||
attack_chance = 50,
|
||||
attack_monsters = true,
|
||||
attack_animals = true,
|
||||
attack_players = true,
|
||||
group_attack = false,
|
||||
attack_type = "dogshoot",
|
||||
arrow = "mobs_umbra:sagitta_obscura",
|
||||
dogshoot_switch = 1,
|
||||
dogshoot_count_max = 9,
|
||||
dogshoot_count2_max = 5,
|
||||
shoot_interval = 3,
|
||||
shoot_offset = 1,
|
||||
blood_amount = 0,
|
||||
pathfinding = 1,
|
||||
makes_footstep_sound = false,
|
||||
drops = {
|
||||
{name = "default:gold_lump", chance = 75, min = 1, max = 5}
|
||||
},
|
||||
visual = "mesh",
|
||||
visual_size = {x = 1.0, y = 1.0, z = 0.01},
|
||||
collisionbox = {-0.4, 0.0, -0.4, 0.4, 1.7, 0.4},
|
||||
selectionbox = {-0.4, 0.0, -0.4, 0.4, 1.7, 0.4},
|
||||
textures = {"character.png^[colorize:black:255"},
|
||||
mesh = "character.b3d",
|
||||
animation = {
|
||||
stand_start = 0,
|
||||
stand_end = 79,
|
||||
stand_speed = 30,
|
||||
walk_start = 168,
|
||||
walk_end = 187,
|
||||
walk_speed = 30,
|
||||
run_start = 168,
|
||||
run_end = 187,
|
||||
run_speed = 30,
|
||||
punch_start = 189,
|
||||
punch_end = 198,
|
||||
punch_speed = 30,
|
||||
die_start = 162,
|
||||
die_end = 166,
|
||||
die_speed = 0.8
|
||||
},
|
||||
|
||||
on_spawn = function(self, pos)
|
||||
self.damage = math.random(1, 6)
|
||||
|
||||
self.object:set_properties({
|
||||
damage = self.damage
|
||||
})
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
--
|
||||
-- Mobile arrow
|
||||
--
|
||||
|
||||
mobs:register_arrow("mobs_umbra:sagitta_obscura", {
|
||||
visual = "sprite",
|
||||
visual_size = {x = 0.5, y = 0.5},
|
||||
textures = {"mobs_umbra_projectile.png"},
|
||||
velocity = 35,
|
||||
|
||||
hit_player = function(self, player)
|
||||
local damage = 2 * mob_difficulty
|
||||
local position = self.object:get_pos()
|
||||
local nodename = minetest.get_node(position).name
|
||||
|
||||
player:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups = {fleshy = damage},
|
||||
}, nil)
|
||||
|
||||
DarkCube(player:get_pos(), dark_cube_offset)
|
||||
self.object:remove()
|
||||
end,
|
||||
|
||||
hit_mob = function(self, player)
|
||||
local damage = 2 * mob_difficulty
|
||||
local position = self.object:get_pos()
|
||||
local nodename = minetest.get_node(position).name
|
||||
|
||||
player:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups = {fleshy = damage},
|
||||
}, nil)
|
||||
|
||||
DarkCube(player:get_pos(), dark_cube_offset)
|
||||
self.object:remove()
|
||||
end,
|
||||
|
||||
hit_node = function(self, pos, node)
|
||||
DarkCube(pos, dark_cube_offset)
|
||||
self.object:remove()
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
--
|
||||
-- Mobile spawner
|
||||
--
|
||||
|
||||
mobs:spawn({
|
||||
name = "mobs_umbra:umbra",
|
||||
nodes = {
|
||||
"group:cracky",
|
||||
"group:stone",
|
||||
"group:crumbly",
|
||||
"group:sand",
|
||||
"group:snowy",
|
||||
},
|
||||
neighbors = {"air"},
|
||||
min_light = 0,
|
||||
max_light = 5,
|
||||
interval = 60,
|
||||
chance = 7500,
|
||||
active_object_count = 1,
|
||||
min_height = -30912,
|
||||
max_height = -300
|
||||
})
|
||||
|
||||
|
||||
-- Spawn Egg
|
||||
|
||||
mobs:register_egg("mobs_umbra:umbra", "Umbra", "mobs_umbra_projectile.png")
|
||||
|
||||
|
||||
--
|
||||
-- Alias
|
||||
--
|
||||
|
||||
mobs:alias_mob("mobs:umbra", "mobs_umbra:umbra")
|
||||
|
||||
|
||||
--
|
||||
-- Minetest engine debug logging
|
||||
--
|
||||
|
||||
local log_level = minetest.settings:get("debug_log_level")
|
||||
|
||||
if (log_level == nil)
|
||||
or (log_level == "action")
|
||||
or (log_level == "info")
|
||||
or (log_level == "verbose")
|
||||
then
|
||||
log_level = nil
|
||||
minetest.log("action", "[Mod] Umbra [v0.1.1] loaded.")
|
||||
end
|
||||
pr_LoadSubFiles()
|
||||
pr_LogMessage()
|
||||
|
2
mod.conf
2
mod.conf
@ -1,3 +1,3 @@
|
||||
name = mobs_umbra
|
||||
description = Adds a shadow-looking Non Playing Character.
|
||||
depends = default, mobs
|
||||
depends = default, mobs, player_api
|
||||
|
@ -1,3 +1,38 @@
|
||||
# ENG: Spawner frequency, stated in seconds.
|
||||
# Default: 60
|
||||
#
|
||||
# ITA: Frequenza del generatore, espressa in secondi.
|
||||
# Predefinito: 60
|
||||
mobs_umbra_spawn_interval (Spawn interval) int 60
|
||||
|
||||
# ENG: Spawning chance; 1 = always, 2 = 50%, etc.
|
||||
# Default: 7500
|
||||
#
|
||||
# ITA: Probabilità di generazione; 1 = sempre, 2 = 50%, ecc.
|
||||
# Predefinito: 7500
|
||||
mobs_umbra_spawn_chance (Spawn chance) int 7500
|
||||
|
||||
# ENG: Number of umbras per active mapchunk.
|
||||
# Default: 1
|
||||
#
|
||||
# ITA: Numero di umbre per pezzo di mappa attivo.
|
||||
# Predefinito: 1
|
||||
mobs_umbra_aoc (Active Object Count) int 1
|
||||
|
||||
# ENG: Min spawn height, stated in nodes.
|
||||
# Default: -30912
|
||||
#
|
||||
# ITA: Altitudine minima di generazione, espressa in nodi.
|
||||
# Predefinito: -30912
|
||||
mobs_umbra_min_height (Min height) int -30912
|
||||
|
||||
# ENG: Max spawn height, stated in nodes.
|
||||
# Default: -300
|
||||
#
|
||||
# ITA: Altitudine massima di generazione, espressa in nodi.
|
||||
# Predefinito: -300
|
||||
mobs_umbra_max_height (Max height) int -300
|
||||
|
||||
# ENG: Offset stated in nodes from the target's position.
|
||||
# Default = 2, i.e. two nodes in front of the target, two
|
||||
# nodes behind it, etc. This will create a 5x5x5 cube of
|
||||
@ -17,9 +52,11 @@ mobs_umbra_cube_offset (Cube of darkness' offset) int 2
|
||||
mobs_umbra_darkness_timeout (Cube of darkness' timeout) int 20
|
||||
|
||||
# ENG: Whether if the cube of darkness should deal damage.
|
||||
# WARNING: It will damage umbras as well.
|
||||
# Default = False
|
||||
#
|
||||
# ITA: se il cubo di oscurità debba ferire o meno.
|
||||
# AVVISO: ferirà anche le umbre.
|
||||
# Predefinito = False
|
||||
mobs_umbra_darkness_damage (Damaging cube of darkness) bool false
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user