Protect translocators. Fix mobs requirement error in villages.

The translocator protection DOES NOT WORK against mobs explosions.
This is not a fun_caves issue.
This commit is contained in:
Duane 2016-07-03 23:20:53 -05:00
parent 26622dd1dd
commit 0fd901dcca
7 changed files with 108 additions and 70 deletions

View file

@ -60,6 +60,34 @@ local gravity_off = {gravity = 0.1}
local gravity_on = {gravity = 1} local gravity_on = {gravity = 1}
local fortress_floor = {x = 30, y = 2, z = 30} local fortress_floor = {x = 30, y = 2, z = 30}
local fortress_group = {'group:fortress'} local fortress_group = {'group:fortress'}
local firework_active = false
local function firework()
local t = minetest.get_timeofday()
if not firework_active and (t < 0.25 or t > 0.75) then
firework_active = true
local ps = {}
local players = minetest.get_connected_players()
for i = 1, #players do
local pp = players[i]:getpos()
if pp and pp.y > 0 then
local sky = {}
sky.bgcolor, sky.type, sky.textures = players[i]:get_sky()
ps[#ps+1] = { p = players[i], sky = sky }
--players[i]:set_sky(0xffffff, "plain", {})
players[i]:set_sky('#000000', 'skybox', {'fun_caves_firework_'..math.random(2)..'.png', 'fun_caves_blank.png', 'fun_caves_blank.png', 'fun_caves_blank.png', 'fun_caves_blank.png', 'fun_caves_blank.png'})
end
end
minetest.sound_play("fireworks", {gain = 1, pos = pp, max_hear_distance = 2})
minetest.after(4, function()
for i = 1, #ps do
ps[i].p:set_sky(ps[i].sky.bgcolor, ps[i].sky.type, ps[i].sky.textures)
end
firework_active = false
end)
end
end
minetest.register_globalstep(function(dtime) minetest.register_globalstep(function(dtime)
local time = minetest.get_gametime() local time = minetest.get_gametime()
@ -74,6 +102,10 @@ minetest.register_globalstep(function(dtime)
out:close() out:close()
end end
if fun_caves.date and fun_caves.date[2] == 7 and fun_caves.date[3] == 3 and math.random(30) == 1 then
firework()
end
-- Promote mobs based on spawn position -- Promote mobs based on spawn position
local is_fortress = fun_caves.is_fortress local is_fortress = fun_caves.is_fortress
for _, mob in pairs(minetest.luaentities) do for _, mob in pairs(minetest.luaentities) do

View file

@ -8,6 +8,9 @@ function minetest.is_protected(pos, name)
if node and get_item_group(node.name, "fortress") ~= 0 then if node and get_item_group(node.name, "fortress") ~= 0 then
return true return true
end end
if node and node.name == 'fun_caves:translocator' and (name == '' or not minetest.get_player_by_name(name)) then
return true
end
return old_is_protected(pos, name) return old_is_protected(pos, name)
end end

BIN
sounds/fireworks.ogg Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 426 KiB

View file

@ -10,3 +10,4 @@ Original DNA: Zephyris (cc-by-sa 3), https://en.wikipedia.org/wiki/File:DNA_Stru
Original moonstone: Didier Descouens (cc-by-sa 4), https://en.wikipedia.org/wiki/File:Pierrelune.jpg Original moonstone: Didier Descouens (cc-by-sa 4), https://en.wikipedia.org/wiki/File:Pierrelune.jpg
Wallhammer images by the eminent DonBatman (DWYWPL), https://forum.minetest.net/viewtopic.php?f=11&t=13484&hilit=masonry+hammer Wallhammer images by the eminent DonBatman (DWYWPL), https://forum.minetest.net/viewtopic.php?f=11&t=13484&hilit=masonry+hammer
The pyramid and translocator textures are copied from the default sandstone and steel block, respectively. The pyramid and translocator textures are copied from the default sandstone and steel block, respectively.
Firework 2: William Crochot (cc-by-sa 4): https://en.wikipedia.org/wiki/File:Feu_d'artifice_-_333.jpg

View file

@ -4,79 +4,81 @@ newnode.groups.soil = 0
minetest.register_node("fun_caves:hut_floor", newnode) minetest.register_node("fun_caves:hut_floor", newnode)
local drops = { if mobs and mobs.mod == "redo" then
{name = "default:axe_stone", chance = 3, min = 1, max = 1}, local drops = {
{name = "default:hoe_stone", chance = 3, min = 1, max = 1}, {name = "default:axe_stone", chance = 3, min = 1, max = 1},
{name = "default:sword_stone", chance = 3, min = 1, max = 1}, {name = "default:hoe_stone", chance = 3, min = 1, max = 1},
{name = "default:apple", chance = 2, min = 1, max = 3}, {name = "default:sword_stone", chance = 3, min = 1, max = 1},
{name = "farming:bread", chance = 3, min = 1, max = 3}, {name = "default:apple", chance = 2, min = 1, max = 3},
{name = "default:cobble", chance = 2, min = 1, max = 3}, {name = "farming:bread", chance = 3, min = 1, max = 3},
} {name = "default:cobble", chance = 2, min = 1, max = 3},
}
if minetest.registered_items['mobs:leather'] then if minetest.registered_items['mobs:leather'] then
drops[#drops+1] = {name = "mobs:leather", chance = 4, min = 1, max = 2} drops[#drops+1] = {name = "mobs:leather", chance = 4, min = 1, max = 2}
end
mobs:register_mob("fun_caves:savage", {
description = "Primitive Savage",
type = "monster",
passive = false,
damage = 1,
attack_type = "dogfight",
attacks_monsters = true,
hp_min = 5,
hp_max = 20,
armor = 100,
fear_height = 4,
collisionbox = {-0.35,-1,-0.35, 0.35,0.9,0.35},
visual = "mesh",
mesh = "character.b3d",
drawtype = "front",
textures = {
{"fun_caves_savage_1.png"},
},
makes_footstep_sound = true,
--sounds = {
-- random = "goblins_goblin_ambient",
-- warcry = "goblins_goblin_attack",
-- attack = "goblins_goblin_attack",
-- damage = "goblins_goblin_damage",
-- death = "goblins_goblin_death",
-- distance = 15,
--},
walk_velocity = 2,
run_velocity = 3,
jump = true,
drops = drops,
water_damage = 1,
lava_damage = 2,
light_damage = 0,
--lifetimer = 360,
view_range = 20,
owner = "",
animation = {
stand_start = 0,
stand_end = 79,
sit_start = 81,
sit_end = 160,
sleep_start = 162,
sleep_end = 166,
walk_start = 168,
walk_end = 187,
mine_start = 189,
mine_end = 198,
walkmine_start = 200,
walkmine_end = 219,
},
animation_speed = 30,
on_rightclick = nil,
do_custom = nil,
})
--mobs:register_egg("fun_caves:savage", "Primitive Savage", "farming_straw.png", 1)
mobs:register_spawn("fun_caves:savage", {'fun_caves:hut_floor'}, 100, 0, 20, 3, 2000)
end end
mobs:register_mob("fun_caves:savage", {
description = "Primitive Savage",
type = "monster",
passive = false,
damage = 1,
attack_type = "dogfight",
attacks_monsters = true,
hp_min = 5,
hp_max = 20,
armor = 100,
fear_height = 4,
collisionbox = {-0.35,-1,-0.35, 0.35,0.9,0.35},
visual = "mesh",
mesh = "character.b3d",
drawtype = "front",
textures = {
{"fun_caves_savage_1.png"},
},
makes_footstep_sound = true,
--sounds = {
-- random = "goblins_goblin_ambient",
-- warcry = "goblins_goblin_attack",
-- attack = "goblins_goblin_attack",
-- damage = "goblins_goblin_damage",
-- death = "goblins_goblin_death",
-- distance = 15,
--},
walk_velocity = 2,
run_velocity = 3,
jump = true,
drops = drops,
water_damage = 1,
lava_damage = 2,
light_damage = 0,
--lifetimer = 360,
view_range = 20,
owner = "",
animation = {
stand_start = 0,
stand_end = 79,
sit_start = 81,
sit_end = 160,
sleep_start = 162,
sleep_end = 166,
walk_start = 168,
walk_end = 187,
mine_start = 189,
mine_end = 198,
walkmine_start = 200,
walkmine_end = 219,
},
animation_speed = 30,
on_rightclick = nil,
do_custom = nil,
})
--mobs:register_egg("fun_caves:savage", "Primitive Savage", "farming_straw.png", 1)
mobs:register_spawn("fun_caves:savage", {'fun_caves:hut_floor'}, 100, 0, 20, 3, 2000)
local function build_hut(data, area, node, pos, turf) local function build_hut(data, area, node, pos, turf)
local door = {x = ({2,7})[math.random(2)], z = ({2,7})[math.random(2)]} local door = {x = ({2,7})[math.random(2)], z = ({2,7})[math.random(2)]}