diff --git a/abms.lua b/abms.lua index 3f8dded..fc259c4 100644 --- a/abms.lua +++ b/abms.lua @@ -60,6 +60,34 @@ local gravity_off = {gravity = 0.1} local gravity_on = {gravity = 1} local fortress_floor = {x = 30, y = 2, z = 30} 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) local time = minetest.get_gametime() @@ -74,6 +102,10 @@ minetest.register_globalstep(function(dtime) out:close() 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 local is_fortress = fun_caves.is_fortress for _, mob in pairs(minetest.luaentities) do diff --git a/nodes.lua b/nodes.lua index 7961cce..aa18029 100644 --- a/nodes.lua +++ b/nodes.lua @@ -8,6 +8,9 @@ function minetest.is_protected(pos, name) if node and get_item_group(node.name, "fortress") ~= 0 then return true 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) end diff --git a/sounds/fireworks.ogg b/sounds/fireworks.ogg new file mode 100644 index 0000000..bbf119f Binary files /dev/null and b/sounds/fireworks.ogg differ diff --git a/textures/fun_caves_firework_1.png b/textures/fun_caves_firework_1.png new file mode 100644 index 0000000..22840e0 Binary files /dev/null and b/textures/fun_caves_firework_1.png differ diff --git a/textures/fun_caves_firework_2.png b/textures/fun_caves_firework_2.png new file mode 100644 index 0000000..96acb87 Binary files /dev/null and b/textures/fun_caves_firework_2.png differ diff --git a/textures/image_credits.txt b/textures/image_credits.txt index 0e02af1..0a508e6 100644 --- a/textures/image_credits.txt +++ b/textures/image_credits.txt @@ -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 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. +Firework 2: William Crochot (cc-by-sa 4): https://en.wikipedia.org/wiki/File:Feu_d'artifice_-_333.jpg diff --git a/village.lua b/village.lua index 0a449aa..c75979b 100644 --- a/village.lua +++ b/village.lua @@ -4,79 +4,81 @@ newnode.groups.soil = 0 minetest.register_node("fun_caves:hut_floor", newnode) -local drops = { - {name = "default:axe_stone", chance = 3, min = 1, max = 1}, - {name = "default:hoe_stone", chance = 3, min = 1, max = 1}, - {name = "default:sword_stone", chance = 3, min = 1, max = 1}, - {name = "default:apple", 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 mobs and mobs.mod == "redo" then + local drops = { + {name = "default:axe_stone", chance = 3, min = 1, max = 1}, + {name = "default:hoe_stone", chance = 3, min = 1, max = 1}, + {name = "default:sword_stone", chance = 3, min = 1, max = 1}, + {name = "default:apple", 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 - drops[#drops+1] = {name = "mobs:leather", chance = 4, min = 1, max = 2} + if minetest.registered_items['mobs:leather'] then + 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 -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 door = {x = ({2,7})[math.random(2)], z = ({2,7})[math.random(2)]}