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/
* [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*
* [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])
* mobiles/engine/
* 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.mobs_goblins]: mods/mobiles/aggressive/mobs_goblins/README.md
[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.moreores]: mods/materials/moreores/LICENSE.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.signs_lib]: https://github.com/minetest-mods/signs_lib/tree/2c36937
[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.spawneggs]: https://github.com/thefamilygrog66/spawneggs/tree/4650370
[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.
# type: int
# default: 50
#sneeker.spawn_cap = 50
# default: 25
#sneeker.spawn_cap = 25
# Sets possibility for sneeker mob spawn.
# type: int
# default: 18000
#sneeker.spawn_chance = 18000
# default: 2
#sneeker.spawn_chance = 2
# Sets frequency of sneeker mob spawn chance. Default 1200 is
# equivalent to 40 minutes (60 * 40).
# type: int
# 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
local log_mods = minetest.setting_getbool('log_mods')
-- Displays a message in log output
function sneeker.log(message)
minetest.log('action', '[' .. sneeker.modname .. '] ' .. message)
if log_mods then
minetest.log('action', '[' .. sneeker.modname .. '] ' .. message)
end
end
-- Displays a message in log output only if 'sneeker.debug' is set to 'true'
function sneeker.log_debug(message)
if sneeker.debug then
sneeker.log('[DEBUG] ' .. message)
sneeker.log('DEBUG: ' .. message)
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.modpath = minetest.get_modpath(sneeker.modname)
local log_mods = minetest.setting_getbool('log_mods')
if log_mods then
if minetest.setting_getbool('log_mods') then
minetest.log('action', 'Loading mod "' .. sneeker.modname .. '" ...')
end
dofile(sneeker.modpath .. '/settings.lua')
dofile(sneeker.modpath .. '/functions.lua')
if log_mods then
sneeker.log('Spawn cap: ' .. tostring(sneeker.spawn_cap))
end
sneeker.log_debug('Debugging is on')
sneeker.mob_name = sneeker.modname .. ':' .. sneeker.modname
sneeker.spawnegg_name = sneeker.modname .. ':spawnegg'
sneeker.log('Spawn cap: ' .. tostring(sneeker.spawn_cap))
local scripts = {
'tnt_function',
@ -342,18 +343,18 @@ def.get_staticdata = function(self)
})
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
minetest.register_craftitem('sneeker:spawnegg',{
minetest.register_craftitem(sneeker.spawnegg_name, {
description = 'Sneeker Spawn Egg',
inventory_image = 'sneeker_spawnegg.png',
stack_max = 64,
on_place = function(itemstack,placer,pointed_thing)
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type == 'node' then
local pos = pointed_thing.above
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
itemstack:take_item()
end
@ -363,12 +364,12 @@ if minetest.get_modpath('spawneggs') and minetest.get_modpath('tnt') then
})
minetest.register_craft({
output = 'sneeker:spawnegg',
output = sneeker.spawnegg_name,
type = 'shapeless',
recipe = {
'spawneggs:egg', 'tnt:tnt',
},
})
minetest.register_alias('spawneggs:sneeker', 'sneeker:spawnegg')
minetest.register_alias('spawneggs:sneeker', sneeker.spawnegg_name)
end

View File

@ -2,4 +2,9 @@
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
# 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.
sneeker.spawn_chance (Spawn chance) int 18000
sneeker.spawn_chance (Spawn chance) int 2
# Sets frequency of spawn chance.
# Default 1200 is equivalent to 20 minutes (60 * 40).
sneeker.spawn_interval (Spawn interval) int 2400
# Default 120 is equivalent to 2 minutes (60 * 2).
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_day = time_hr * 24
local spawn_chance = minetest.setting_get('sneeker.spawn_chance') or 18000
local spawn_interval = minetest.setting_get('sneeker.spawn_interval') or time_min * 40 -- Default interval is 40 minutes
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 * 2 -- Default interval is 2 minutes
if minetest.setting_getbool('log_mods') then
sneeker.log('Spawn chance: ' .. tostring(spawn_chance) .. ' (1/' .. tostring(spawn_chance) .. ')')
sneeker.log('Spawn interval: ' .. tostring(spawn_interval) .. ' (' .. tostring(spawn_interval/60) .. ' minutes)')
end
local spawn_chance_percent = tostring(math.floor(1 / spawn_chance * 100)) .. '%'
sneeker.log('Spawn chance: ' .. spawn_chance_percent)
sneeker.log('Spawn interval: ' .. tostring(spawn_interval) .. ' (' .. tostring(spawn_interval/60) .. ' minute(s))')
minetest.register_abm({
nodenames = {'default:dirt_with_grass','default:stone'},
nodenames = {'default:dirt_with_grass', 'default:stone'},
neighbors = {'air'},
interval = spawn_interval,
chance = spawn_chance,
@ -22,19 +22,25 @@ minetest.register_abm({
if active_object_count_wider > 5 then
return
end
-- Check light value of node
pos.y = pos.y+1
if not minetest.get_node_light(pos) then
return
end
if minetest.get_node_light(pos) > 5 then
return
end
if minetest.get_node_light(pos) < -1 then
local node_light = minetest.get_node_light(pos)
-- Debugging spawning
sneeker.log_debug('Node light level at ' .. sneeker.get_pos_string(pos) .. ': ' .. tostring(node_light))
if not node_light or node_light > sneeker.spawn_maxlight or node_light < -1 then
sneeker.log_debug('Node not dark enough for spawn')
return
end
-- Spawn range
if pos.y > 31000 then
return
end
-- Node must be touching air
if minetest.get_node(pos).name ~= 'air' then
return
end
@ -42,6 +48,22 @@ minetest.register_abm({
if minetest.get_node(pos).name ~= 'air' then
return
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
})

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
# 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.
sneeker.spawn_chance (Spawn chance) int 18000
sneeker.spawn_chance (Spawn chance) int 2
# Sets frequency of spawn chance.
# Default 1200 is equivalent to 20 minutes (60 * 40).
sneeker.spawn_interval (Spawn interval) int 2400
# Default 120 is equivalent to 2 minutes (60 * 2).
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]