Merge branch 'unstable'

master
AntumDeluge 2017-05-29 03:06:19 -07:00
commit 06b228cc45
36 changed files with 101 additions and 46 deletions

View File

@ -60,7 +60,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
* mobiles/aggressive/ * mobiles/aggressive/
* [mobs_goblins][] ([CC-BY-SA / CC-BY / CC0][lic.mobs_goblins]) -- version: [a346f85 Git][ver.mobs_goblins] *2015-09-12* ([patched][patch.mobs_goblins]) * [mobs_goblins][] ([CC-BY-SA / CC-BY / CC0][lic.mobs_goblins]) -- version: [a346f85 Git][ver.mobs_goblins] *2015-09-12* ([patched][patch.mobs_goblins])
* [mobs_monster][] ([MIT][lic.mobs_monster]) -- version: [f6d0e01 Git][ver.mobs_monster] *2017-04-27* * [mobs_monster][] ([MIT][lic.mobs_monster]) -- version: [f6d0e01 Git][ver.mobs_monster] *2017-04-27*
* [sneeker][] ([WTFPL][lic.wtfpl] / [CC0][lic.cc0]) -- version: [9d7c566 Git][ver.sneeker] *2017-05-28* * [sneeker][] ([WTFPL][lic.wtfpl] / [CC0][lic.cc0]) -- version: [b69cc98 Git][ver.sneeker] *2017-05-29*
* [spidermob][] ([LGPL][lic.lgpl2.1] / [CC BY-SA][lic.ccbysa3.0] / [MIT][lic.mit] / [WTFPL][lic.spidermob] / [Unlicense][lic.unlicense]) -- version [c72d2ff Git][ver.spidermob] *2016-08-14* ([patched][patch.spidermob]) * [spidermob][] ([LGPL][lic.lgpl2.1] / [CC BY-SA][lic.ccbysa3.0] / [MIT][lic.mit] / [WTFPL][lic.spidermob] / [Unlicense][lic.unlicense]) -- version [c72d2ff Git][ver.spidermob] *2016-08-14* ([patched][patch.spidermob])
* mobiles/engine/ * mobiles/engine/
* mobiles/general/ * mobiles/general/
@ -342,7 +342,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
[lic.mobf]: mods/modpacks/mobf_core/License.txt [lic.mobf]: mods/modpacks/mobf_core/License.txt
[lic.mobs_goblins]: mods/mobiles/aggressive/mobs_goblins/README.md [lic.mobs_goblins]: mods/mobiles/aggressive/mobs_goblins/README.md
[lic.mobs_monster]: mods/mobiles/aggressive/mobs_monster/license.txt [lic.mobs_monster]: mods/mobiles/aggressive/mobs_monster/license.txt
[lic.mobs_redo]: mods/mobiles/general/mobs_redo/license.txt [lic.mobs_redo]: mods/mobiles/engine/mobs_redo/license.txt
[lic.moreblocks]: mods/buildings/moreblocks/LICENSE.md [lic.moreblocks]: mods/buildings/moreblocks/LICENSE.md
[lic.moreores]: mods/materials/moreores/LICENSE.md [lic.moreores]: mods/materials/moreores/LICENSE.md
[lic.mydoors]: mods/modpacks/mydoors/README.md [lic.mydoors]: mods/modpacks/mydoors/README.md
@ -459,7 +459,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
[ver.rainbow_ore]: https://github.com/FsxShader2012/rainbow_ore/tree/6e77693 [ver.rainbow_ore]: https://github.com/FsxShader2012/rainbow_ore/tree/6e77693
[ver.signs_lib]: https://github.com/minetest-mods/signs_lib/tree/2c36937 [ver.signs_lib]: https://github.com/minetest-mods/signs_lib/tree/2c36937
[ver.simple_protection]: https://github.com/SmallJoker/simple_protection/tree/23c024f [ver.simple_protection]: https://github.com/SmallJoker/simple_protection/tree/23c024f
[ver.sneeker]: https://github.com/AntumDeluge/mtmod-sneeker/tree/9d7c566 [ver.sneeker]: https://github.com/AntumDeluge/mtmod-sneeker/tree/b69cc98
[ver.snowdrift]: https://github.com/paramat/snowdrift/tree/fcb0537 [ver.snowdrift]: https://github.com/paramat/snowdrift/tree/fcb0537
[ver.spawneggs]: https://github.com/thefamilygrog66/spawneggs/tree/4650370 [ver.spawneggs]: https://github.com/thefamilygrog66/spawneggs/tree/4650370
[ver.spectator_mode]: https://github.com/minetest-mods/spectator_mode/tree/7d68bec [ver.spectator_mode]: https://github.com/minetest-mods/spectator_mode/tree/7d68bec

View File

@ -1769,19 +1769,24 @@ sneeker.debug = true
# Sets maximum number of spawns that can exist in world. # Sets maximum number of spawns that can exist in world.
# type: int # type: int
# default: 50 # default: 25
#sneeker.spawn_cap = 50 #sneeker.spawn_cap = 25
# Sets possibility for sneeker mob spawn. # Sets possibility for sneeker mob spawn.
# type: int # type: int
# default: 18000 # default: 2
#sneeker.spawn_chance = 18000 #sneeker.spawn_chance = 2
# Sets frequency of sneeker mob spawn chance. Default 1200 is # Sets frequency of sneeker mob spawn chance. Default 1200 is
# equivalent to 40 minutes (60 * 40). # equivalent to 40 minutes (60 * 40).
# type: int # type: int
# default: 2400 # default: 2400
#sneeker.spawn_interval = 2400 #sneeker.spawn_interval = 120
# Sets the maximum light that a node can have for spawn to occur.
# type: int
# default: 7
#sneeker.spawn_maxlight = 7

View File

@ -1,14 +1,30 @@
-- Functions for sneeker mod -- Functions for sneeker mod
local log_mods = minetest.setting_getbool('log_mods')
-- Displays a message in log output -- Displays a message in log output
function sneeker.log(message) function sneeker.log(message)
minetest.log('action', '[' .. sneeker.modname .. '] ' .. message) if log_mods then
minetest.log('action', '[' .. sneeker.modname .. '] ' .. message)
end
end end
-- Displays a message in log output only if 'sneeker.debug' is set to 'true' -- Displays a message in log output only if 'sneeker.debug' is set to 'true'
function sneeker.log_debug(message) function sneeker.log_debug(message)
if sneeker.debug then if sneeker.debug then
sneeker.log('[DEBUG] ' .. message) sneeker.log('DEBUG: ' .. message)
end end
end end
-- Spawns a sneeker entity
function sneeker.spawn(pos)
minetest.add_entity(pos, sneeker.mob_name)
sneeker.log_debug('Spawned entity "' .. sneeker.mob_name .. '" at ' .. tostring(pos.x) .. ',' .. tostring(pos.y))
end
-- Retrieves pos coordinates in string value
function sneeker.get_pos_string(pos)
return 'x=' .. tostring(pos.x) .. ', y=' .. tostring(pos.y) .. ', z=' .. tostring(pos.z)
end

View File

@ -5,18 +5,19 @@ sneeker = {}
sneeker.modname = minetest.get_current_modname() sneeker.modname = minetest.get_current_modname()
sneeker.modpath = minetest.get_modpath(sneeker.modname) sneeker.modpath = minetest.get_modpath(sneeker.modname)
local log_mods = minetest.setting_getbool('log_mods') if minetest.setting_getbool('log_mods') then
if log_mods then
minetest.log('action', 'Loading mod "' .. sneeker.modname .. '" ...') minetest.log('action', 'Loading mod "' .. sneeker.modname .. '" ...')
end end
dofile(sneeker.modpath .. '/settings.lua') dofile(sneeker.modpath .. '/settings.lua')
dofile(sneeker.modpath .. '/functions.lua') dofile(sneeker.modpath .. '/functions.lua')
if log_mods then sneeker.log_debug('Debugging is on')
sneeker.log('Spawn cap: ' .. tostring(sneeker.spawn_cap))
end sneeker.mob_name = sneeker.modname .. ':' .. sneeker.modname
sneeker.spawnegg_name = sneeker.modname .. ':spawnegg'
sneeker.log('Spawn cap: ' .. tostring(sneeker.spawn_cap))
local scripts = { local scripts = {
'tnt_function', 'tnt_function',
@ -342,18 +343,18 @@ def.get_staticdata = function(self)
}) })
end end
minetest.register_entity('sneeker:sneeker',def) minetest.register_entity(sneeker.mob_name, def)
if minetest.get_modpath('spawneggs') and minetest.get_modpath('tnt') then if minetest.get_modpath('spawneggs') and minetest.get_modpath('tnt') then
minetest.register_craftitem('sneeker:spawnegg',{ minetest.register_craftitem(sneeker.spawnegg_name, {
description = 'Sneeker Spawn Egg', description = 'Sneeker Spawn Egg',
inventory_image = 'sneeker_spawnegg.png', inventory_image = 'sneeker_spawnegg.png',
stack_max = 64, stack_max = 64,
on_place = function(itemstack,placer,pointed_thing) on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type == 'node' then if pointed_thing.type == 'node' then
local pos = pointed_thing.above local pos = pointed_thing.above
pos.y = pos.y+1 pos.y = pos.y+1
minetest.add_entity(pos,'sneeker:sneeker') minetest.add_entity(pos, sneeker.mob_name)
if not minetest.setting_getbool('creative_mode') then if not minetest.setting_getbool('creative_mode') then
itemstack:take_item() itemstack:take_item()
end end
@ -363,12 +364,12 @@ if minetest.get_modpath('spawneggs') and minetest.get_modpath('tnt') then
}) })
minetest.register_craft({ minetest.register_craft({
output = 'sneeker:spawnegg', output = sneeker.spawnegg_name,
type = 'shapeless', type = 'shapeless',
recipe = { recipe = {
'spawneggs:egg', 'tnt:tnt', 'spawneggs:egg', 'tnt:tnt',
}, },
}) })
minetest.register_alias('spawneggs:sneeker', 'sneeker:spawnegg') minetest.register_alias('spawneggs:sneeker', sneeker.spawnegg_name)
end end

View File

@ -2,4 +2,9 @@
sneeker.debug = minetest.setting_get('sneeker.debug') or false sneeker.debug = minetest.setting_get('sneeker.debug') or false
sneeker.spawn_cap = minetest.setting_get('sneeker.spawn_cap') or 50
-- Maximum number of spawns active at one time
sneeker.spawn_cap = minetest.setting_get('sneeker.spawn_cap') or 25
-- Maximum light of node for spawn
sneeker.spawn_maxlight = minetest.setting_get('sneeker.spawn_maxlight') or 7

View File

@ -2,11 +2,14 @@
sneeker.debug (Log debug output) bool false sneeker.debug (Log debug output) bool false
# Sets maximum number of spawns that can exist in world. # Sets maximum number of spawns that can exist in world.
sneeker.spawn_cap (Maximum spawns) int 50 sneeker.spawn_cap (Maximum spawns) int 25
# Sets possibility for spawn. # Sets possibility for spawn.
sneeker.spawn_chance (Spawn chance) int 18000 sneeker.spawn_chance (Spawn chance) int 2
# Sets frequency of spawn chance. # Sets frequency of spawn chance.
# Default 1200 is equivalent to 20 minutes (60 * 40). # Default 120 is equivalent to 2 minutes (60 * 2).
sneeker.spawn_interval (Spawn interval) int 2400 sneeker.spawn_interval (Spawn interval) int 120
# Sets the maximum light that a node can have for spawn to occur.
sneeker.spawn_maxlight (Max light for spawn) int 7

View File

@ -5,16 +5,16 @@ local time_min = 60
local time_hr = time_min * 60 local time_hr = time_min * 60
local time_day = time_hr * 24 local time_day = time_hr * 24
local spawn_chance = minetest.setting_get('sneeker.spawn_chance') or 18000 local spawn_chance = minetest.setting_get('sneeker.spawn_chance') or 2 -- 50% chance of spawn
local spawn_interval = minetest.setting_get('sneeker.spawn_interval') or time_min * 40 -- Default interval is 40 minutes local spawn_interval = minetest.setting_get('sneeker.spawn_interval') or time_min * 2 -- Default interval is 2 minutes
if minetest.setting_getbool('log_mods') then local spawn_chance_percent = tostring(math.floor(1 / spawn_chance * 100)) .. '%'
sneeker.log('Spawn chance: ' .. tostring(spawn_chance) .. ' (1/' .. tostring(spawn_chance) .. ')')
sneeker.log('Spawn interval: ' .. tostring(spawn_interval) .. ' (' .. tostring(spawn_interval/60) .. ' minutes)') sneeker.log('Spawn chance: ' .. spawn_chance_percent)
end sneeker.log('Spawn interval: ' .. tostring(spawn_interval) .. ' (' .. tostring(spawn_interval/60) .. ' minute(s))')
minetest.register_abm({ minetest.register_abm({
nodenames = {'default:dirt_with_grass','default:stone'}, nodenames = {'default:dirt_with_grass', 'default:stone'},
neighbors = {'air'}, neighbors = {'air'},
interval = spawn_interval, interval = spawn_interval,
chance = spawn_chance, chance = spawn_chance,
@ -22,19 +22,25 @@ minetest.register_abm({
if active_object_count_wider > 5 then if active_object_count_wider > 5 then
return return
end end
-- Check light value of node
pos.y = pos.y+1 pos.y = pos.y+1
if not minetest.get_node_light(pos) then local node_light = minetest.get_node_light(pos)
return
end -- Debugging spawning
if minetest.get_node_light(pos) > 5 then sneeker.log_debug('Node light level at ' .. sneeker.get_pos_string(pos) .. ': ' .. tostring(node_light))
return
end if not node_light or node_light > sneeker.spawn_maxlight or node_light < -1 then
if minetest.get_node_light(pos) < -1 then sneeker.log_debug('Node not dark enough for spawn')
return return
end end
-- Spawn range
if pos.y > 31000 then if pos.y > 31000 then
return return
end end
-- Node must be touching air
if minetest.get_node(pos).name ~= 'air' then if minetest.get_node(pos).name ~= 'air' then
return return
end end
@ -42,6 +48,22 @@ minetest.register_abm({
if minetest.get_node(pos).name ~= 'air' then if minetest.get_node(pos).name ~= 'air' then
return return
end end
minetest.add_entity(pos,'sneeker:sneeker')
-- Get total count of sneekers in world
local count = 0
for I in pairs(minetest.luaentities) do
if minetest.luaentities[I].name == sneeker.mob_name then
count = count + 1
end
end
sneeker.log_debug('Current active spawns: ' .. tostring(count) .. '/' .. tostring(sneeker.spawn_cap))
if count >= sneeker.spawn_cap then
sneeker.log_debug('Max spawns reached')
return
end
sneeker.spawn(pos)
end end
}) })

View File

Before

Width:  |  Height:  |  Size: 108 B

After

Width:  |  Height:  |  Size: 108 B

View File

Before

Width:  |  Height:  |  Size: 267 B

After

Width:  |  Height:  |  Size: 267 B

View File

Before

Width:  |  Height:  |  Size: 115 B

After

Width:  |  Height:  |  Size: 115 B

View File

Before

Width:  |  Height:  |  Size: 235 B

After

Width:  |  Height:  |  Size: 235 B

View File

Before

Width:  |  Height:  |  Size: 196 B

After

Width:  |  Height:  |  Size: 196 B

View File

Before

Width:  |  Height:  |  Size: 176 B

After

Width:  |  Height:  |  Size: 176 B

View File

Before

Width:  |  Height:  |  Size: 411 B

After

Width:  |  Height:  |  Size: 411 B

View File

Before

Width:  |  Height:  |  Size: 426 B

After

Width:  |  Height:  |  Size: 426 B

View File

Before

Width:  |  Height:  |  Size: 247 B

After

Width:  |  Height:  |  Size: 247 B

View File

Before

Width:  |  Height:  |  Size: 195 B

After

Width:  |  Height:  |  Size: 195 B

View File

Before

Width:  |  Height:  |  Size: 164 B

After

Width:  |  Height:  |  Size: 164 B

View File

Before

Width:  |  Height:  |  Size: 166 B

After

Width:  |  Height:  |  Size: 166 B

View File

Before

Width:  |  Height:  |  Size: 224 B

After

Width:  |  Height:  |  Size: 224 B

View File

Before

Width:  |  Height:  |  Size: 202 B

After

Width:  |  Height:  |  Size: 202 B

View File

@ -104,14 +104,17 @@ airtanks_wear_in_creative (Air tanks wear out in creative mode) bool true
sneeker.debug (Log debug output) bool false sneeker.debug (Log debug output) bool false
# Sets maximum number of spawns that can exist in world. # Sets maximum number of spawns that can exist in world.
sneeker.spawn_cap (Maximum spawns) int 50 sneeker.spawn_cap (Maximum spawns) int 25
# Sets possibility for spawn. # Sets possibility for spawn.
sneeker.spawn_chance (Spawn chance) int 18000 sneeker.spawn_chance (Spawn chance) int 2
# Sets frequency of spawn chance. # Sets frequency of spawn chance.
# Default 1200 is equivalent to 20 minutes (60 * 40). # Default 120 is equivalent to 2 minutes (60 * 2).
sneeker.spawn_interval (Spawn interval) int 2400 sneeker.spawn_interval (Spawn interval) int 120
# Sets the maximum light that a node can have for spawn to occur.
sneeker.spawn_maxlight (Max node light for spawn) int 7
[*Player Visuals] [*Player Visuals]