diff --git a/minetest.conf b/minetest.conf index 7781b94..bae03f3 100644 --- a/minetest.conf +++ b/minetest.conf @@ -18,3 +18,4 @@ weather_allow_abm = true enable_moreplants = true twilight = false 3d_leaves = false +mob_show_health = false \ No newline at end of file diff --git a/mods/3d_armor/textures/3d_armor_boots_steel.png b/mods/3d_armor/textures/3d_armor_boots_steel.png index 01bec64..e1f829f 100644 Binary files a/mods/3d_armor/textures/3d_armor_boots_steel.png and b/mods/3d_armor/textures/3d_armor_boots_steel.png differ diff --git a/mods/3d_armor/textures/3d_armor_boots_steel_preview.png b/mods/3d_armor/textures/3d_armor_boots_steel_preview.png index f24f17e..e0d927a 100644 Binary files a/mods/3d_armor/textures/3d_armor_boots_steel_preview.png and b/mods/3d_armor/textures/3d_armor_boots_steel_preview.png differ diff --git a/mods/3d_armor/textures/3d_armor_chestplate_steel.png b/mods/3d_armor/textures/3d_armor_chestplate_steel.png index 717ae84..138d5cf 100644 Binary files a/mods/3d_armor/textures/3d_armor_chestplate_steel.png and b/mods/3d_armor/textures/3d_armor_chestplate_steel.png differ diff --git a/mods/3d_armor/textures/3d_armor_chestplate_steel_preview.png b/mods/3d_armor/textures/3d_armor_chestplate_steel_preview.png index 0f31392..5fba04c 100644 Binary files a/mods/3d_armor/textures/3d_armor_chestplate_steel_preview.png and b/mods/3d_armor/textures/3d_armor_chestplate_steel_preview.png differ diff --git a/mods/3d_armor/textures/3d_armor_helmet_steel.png b/mods/3d_armor/textures/3d_armor_helmet_steel.png index 8301bf1..2b790c9 100644 Binary files a/mods/3d_armor/textures/3d_armor_helmet_steel.png and b/mods/3d_armor/textures/3d_armor_helmet_steel.png differ diff --git a/mods/3d_armor/textures/3d_armor_helmet_steel_preview.png b/mods/3d_armor/textures/3d_armor_helmet_steel_preview.png index a88ee19..3c0c439 100644 Binary files a/mods/3d_armor/textures/3d_armor_helmet_steel_preview.png and b/mods/3d_armor/textures/3d_armor_helmet_steel_preview.png differ diff --git a/mods/3d_armor/textures/3d_armor_leggings_steel.png b/mods/3d_armor/textures/3d_armor_leggings_steel.png index 5570eb7..1338820 100644 Binary files a/mods/3d_armor/textures/3d_armor_leggings_steel.png and b/mods/3d_armor/textures/3d_armor_leggings_steel.png differ diff --git a/mods/3d_armor/textures/3d_armor_leggings_steel_preview.png b/mods/3d_armor/textures/3d_armor_leggings_steel_preview.png index 0fc4100..73649e1 100644 Binary files a/mods/3d_armor/textures/3d_armor_leggings_steel_preview.png and b/mods/3d_armor/textures/3d_armor_leggings_steel_preview.png differ diff --git a/mods/bows/arrow.lua b/mods/bows/arrow.lua index 31a3b13..b6686bc 100644 --- a/mods/bows/arrow.lua +++ b/mods/bows/arrow.lua @@ -102,12 +102,31 @@ minetest.register_entity("bows:arrow",{ bows.arrow_remove(self) end local pos = self.object:getpos() - local objs = minetest.get_objects_inside_radius(pos, 1.3) + local objs = minetest.get_objects_inside_radius(pos, 2) + for _, obj in ipairs(objs) do + if obj:is_player() then + local pos2 = self.object:getpos() + local pos1 = obj:getpos() + if pos1 ~= nil and pos2 ~= nil then + --pos1.y = pos1.y+1 + local vec = {x=pos1.x-pos2.x, y=pos1.y-pos2.y, z=pos1.z-pos2.z} + vec.x = vec.x/0.15 + vec.y = vec.y/0.15 + vec.z = vec.z/0.15 + self.object:setvelocity(vec) + end + end + end + local objs = minetest.get_objects_inside_radius(pos, 0.3) for _, obj in ipairs(objs) do if obj:is_player() then local pname = obj:get_player_name() local inv = minetest.get_inventory({type="player", name=pname}); + if math.random(1,7) == 1 then local remov = inv:add_item("main", self.name) + else + local remov = inv:add_item("main", "default:stick") + end bows.arrow_remove(self) minetest.sound_play("item_drop_pickup", {pos = pos, gain = 0.3, max_hear_distance = 16}) end diff --git a/mods/default/textures/default_acacia_wood.png b/mods/default/textures/default_acacia_wood.png index 93a0538..d1edeb6 100644 Binary files a/mods/default/textures/default_acacia_wood.png and b/mods/default/textures/default_acacia_wood.png differ diff --git a/mods/default/textures/default_apple.png b/mods/default/textures/default_apple.png index b2fea41..f93c01c 100644 Binary files a/mods/default/textures/default_apple.png and b/mods/default/textures/default_apple.png differ diff --git a/mods/default/textures/default_book.png b/mods/default/textures/default_book.png index 893bf55..1225ea2 100644 Binary files a/mods/default/textures/default_book.png and b/mods/default/textures/default_book.png differ diff --git a/mods/default/textures/default_book_written.png b/mods/default/textures/default_book_written.png index fb0fcfc..70b339f 100644 Binary files a/mods/default/textures/default_book_written.png and b/mods/default/textures/default_book_written.png differ diff --git a/mods/default/textures/default_clay_brick.png b/mods/default/textures/default_clay_brick.png index cfde79b..52276d1 100644 Binary files a/mods/default/textures/default_clay_brick.png and b/mods/default/textures/default_clay_brick.png differ diff --git a/mods/default/textures/default_copper_lump.png b/mods/default/textures/default_copper_lump.png index 998c592..b31733f 100644 Binary files a/mods/default/textures/default_copper_lump.png and b/mods/default/textures/default_copper_lump.png differ diff --git a/mods/default/textures/default_diamond.png b/mods/default/textures/default_diamond.png index 324c323..cca2d31 100644 Binary files a/mods/default/textures/default_diamond.png and b/mods/default/textures/default_diamond.png differ diff --git a/mods/default/textures/default_diamond_block.png b/mods/default/textures/default_diamond_block.png index d6030f7..9b99113 100644 Binary files a/mods/default/textures/default_diamond_block.png and b/mods/default/textures/default_diamond_block.png differ diff --git a/mods/default/textures/default_gold_lump.png b/mods/default/textures/default_gold_lump.png index d5a1be7..4089537 100644 Binary files a/mods/default/textures/default_gold_lump.png and b/mods/default/textures/default_gold_lump.png differ diff --git a/mods/default/textures/default_gravel.png b/mods/default/textures/default_gravel.png index 4bfe715..e2e23ff 100644 Binary files a/mods/default/textures/default_gravel.png and b/mods/default/textures/default_gravel.png differ diff --git a/mods/default/textures/default_iron_lump.png b/mods/default/textures/default_iron_lump.png index db61a94..db552f3 100644 Binary files a/mods/default/textures/default_iron_lump.png and b/mods/default/textures/default_iron_lump.png differ diff --git a/mods/default/textures/default_iron_lump_old.png b/mods/default/textures/default_iron_lump_old.png new file mode 100644 index 0000000..16ad022 Binary files /dev/null and b/mods/default/textures/default_iron_lump_old.png differ diff --git a/mods/default/textures/default_lava_flowing_animated.png b/mods/default/textures/default_lava_flowing_animated.png index 9d86ba6..46cdc58 100644 Binary files a/mods/default/textures/default_lava_flowing_animated.png and b/mods/default/textures/default_lava_flowing_animated.png differ diff --git a/mods/default/textures/default_lava_source_animated.png b/mods/default/textures/default_lava_source_animated.png index fa68239..fb96873 100644 Binary files a/mods/default/textures/default_lava_source_animated.png and b/mods/default/textures/default_lava_source_animated.png differ diff --git a/mods/default/textures/default_mese_crystal.png b/mods/default/textures/default_mese_crystal.png index ceb2543..5fffb1b 100644 Binary files a/mods/default/textures/default_mese_crystal.png and b/mods/default/textures/default_mese_crystal.png differ diff --git a/mods/default/textures/default_mineral_coal.png b/mods/default/textures/default_mineral_coal.png index 6d1386b..dfd1846 100644 Binary files a/mods/default/textures/default_mineral_coal.png and b/mods/default/textures/default_mineral_coal.png differ diff --git a/mods/default/textures/default_mineral_copper.png b/mods/default/textures/default_mineral_copper.png index c4c518e..b1c0527 100644 Binary files a/mods/default/textures/default_mineral_copper.png and b/mods/default/textures/default_mineral_copper.png differ diff --git a/mods/default/textures/default_mineral_diamond.png b/mods/default/textures/default_mineral_diamond.png index 39c0f83..f76b571 100644 Binary files a/mods/default/textures/default_mineral_diamond.png and b/mods/default/textures/default_mineral_diamond.png differ diff --git a/mods/default/textures/default_mineral_gold.png b/mods/default/textures/default_mineral_gold.png index 2220add..e06abd9 100644 Binary files a/mods/default/textures/default_mineral_gold.png and b/mods/default/textures/default_mineral_gold.png differ diff --git a/mods/default/textures/default_mineral_iron.png b/mods/default/textures/default_mineral_iron.png index bfec8b1..3430732 100644 Binary files a/mods/default/textures/default_mineral_iron.png and b/mods/default/textures/default_mineral_iron.png differ diff --git a/mods/default/textures/default_mineral_mese.png b/mods/default/textures/default_mineral_mese.png index 6952670..3024321 100644 Binary files a/mods/default/textures/default_mineral_mese.png and b/mods/default/textures/default_mineral_mese.png differ diff --git a/mods/default/textures/default_stone.png b/mods/default/textures/default_stone.png index 439be68..4dd366b 100644 Binary files a/mods/default/textures/default_stone.png and b/mods/default/textures/default_stone.png differ diff --git a/mods/default/textures/default_tool_bronzeshovel.png b/mods/default/textures/default_tool_bronzeshovel.png index 53f79e6..7cb7e3f 100644 Binary files a/mods/default/textures/default_tool_bronzeshovel.png and b/mods/default/textures/default_tool_bronzeshovel.png differ diff --git a/mods/default/textures/default_tool_diamondshovel.png b/mods/default/textures/default_tool_diamondshovel.png index 71a3722..c84adf3 100644 Binary files a/mods/default/textures/default_tool_diamondshovel.png and b/mods/default/textures/default_tool_diamondshovel.png differ diff --git a/mods/default/textures/default_tool_meseshovel.png b/mods/default/textures/default_tool_meseshovel.png index f0d6090..6651614 100644 Binary files a/mods/default/textures/default_tool_meseshovel.png and b/mods/default/textures/default_tool_meseshovel.png differ diff --git a/mods/default/textures/default_tool_steelshovel.png b/mods/default/textures/default_tool_steelshovel.png index a34b9fa..bf65c55 100644 Binary files a/mods/default/textures/default_tool_steelshovel.png and b/mods/default/textures/default_tool_steelshovel.png differ diff --git a/mods/default/textures/default_tool_stoneshovel.png b/mods/default/textures/default_tool_stoneshovel.png index ccb1075..f75d3f5 100644 Binary files a/mods/default/textures/default_tool_stoneshovel.png and b/mods/default/textures/default_tool_stoneshovel.png differ diff --git a/mods/default/textures/default_tool_woodshovel.png b/mods/default/textures/default_tool_woodshovel.png index 3d6b12b..ce103db 100644 Binary files a/mods/default/textures/default_tool_woodshovel.png and b/mods/default/textures/default_tool_woodshovel.png differ diff --git a/mods/default/textures/default_water_source_animated.png b/mods/default/textures/default_water_source_animated.png index b598406..1154560 100644 Binary files a/mods/default/textures/default_water_source_animated.png and b/mods/default/textures/default_water_source_animated.png differ diff --git a/mods/experience/init.lua b/mods/experience/init.lua index d973eb2..203a5f9 100644 --- a/mods/experience/init.lua +++ b/mods/experience/init.lua @@ -8,7 +8,7 @@ level1 = 50 level1_drop = "bucket:bucket_empty 1" level2 = 100 -level2_drop = "default:steelblock 5" +level2_drop = "default:steel_sword 1" level3 = 150 level3_drop = "default:goldblock 1" @@ -32,7 +32,19 @@ level9 = 450 level9_drop = "default:mese 1" level10 = 500 -level10_drop = "default:sword_mese 1" +level10_drop = "hyruletools:dungeon_spawner 1" + +level11 = 650 +level11_drop = "default:sword_mese 1" + +level11 = 80 +level11_drop = "hyruletools:dungeon_spawner2 1" + +level12 = 900 +level12_drop = "default:sword_mese 1" + +level13 = 1000 +level13_drop = "hyruletools:crest 1" diff --git a/mods/farming/textures/farming_baked_potato.png b/mods/farming/textures/farming_baked_potato.png index 425c4ae..3e5ef16 100644 Binary files a/mods/farming/textures/farming_baked_potato.png and b/mods/farming/textures/farming_baked_potato.png differ diff --git a/mods/farming/textures/farming_bread.png b/mods/farming/textures/farming_bread.png index bd00e3e..657dd14 100644 Binary files a/mods/farming/textures/farming_bread.png and b/mods/farming/textures/farming_bread.png differ diff --git a/mods/farming/textures/farming_carrot.png b/mods/farming/textures/farming_carrot.png index bb4cd7b..93b47bb 100644 Binary files a/mods/farming/textures/farming_carrot.png and b/mods/farming/textures/farming_carrot.png differ diff --git a/mods/farming/textures/farming_carrot_1.png b/mods/farming/textures/farming_carrot_1.png index 7161d37..fd9aca1 100644 Binary files a/mods/farming/textures/farming_carrot_1.png and b/mods/farming/textures/farming_carrot_1.png differ diff --git a/mods/farming/textures/farming_carrot_2.png b/mods/farming/textures/farming_carrot_2.png index 332b7d1..160ff64 100644 Binary files a/mods/farming/textures/farming_carrot_2.png and b/mods/farming/textures/farming_carrot_2.png differ diff --git a/mods/farming/textures/farming_carrot_3.png b/mods/farming/textures/farming_carrot_3.png index 27e4981..a3d3d4f 100644 Binary files a/mods/farming/textures/farming_carrot_3.png and b/mods/farming/textures/farming_carrot_3.png differ diff --git a/mods/farming/textures/farming_carrot_4.png b/mods/farming/textures/farming_carrot_4.png index 95c84f4..d8e8611 100644 Binary files a/mods/farming/textures/farming_carrot_4.png and b/mods/farming/textures/farming_carrot_4.png differ diff --git a/mods/farming/textures/farming_carrot_5.png b/mods/farming/textures/farming_carrot_5.png index 95c84f4..d593cc2 100644 Binary files a/mods/farming/textures/farming_carrot_5.png and b/mods/farming/textures/farming_carrot_5.png differ diff --git a/mods/farming/textures/farming_carrot_6.png b/mods/farming/textures/farming_carrot_6.png index 6579ced..6dd5aa8 100644 Binary files a/mods/farming/textures/farming_carrot_6.png and b/mods/farming/textures/farming_carrot_6.png differ diff --git a/mods/farming/textures/farming_carrot_7.png b/mods/farming/textures/farming_carrot_7.png index 6579ced..2e6e20d 100644 Binary files a/mods/farming/textures/farming_carrot_7.png and b/mods/farming/textures/farming_carrot_7.png differ diff --git a/mods/farming/textures/farming_carrot_8.png b/mods/farming/textures/farming_carrot_8.png index 6579ced..4629ca6 100644 Binary files a/mods/farming/textures/farming_carrot_8.png and b/mods/farming/textures/farming_carrot_8.png differ diff --git a/mods/farming/textures/farming_carrot_gold.png b/mods/farming/textures/farming_carrot_gold.png index 9fba4e8..d83cb62 100644 Binary files a/mods/farming/textures/farming_carrot_gold.png and b/mods/farming/textures/farming_carrot_gold.png differ diff --git a/mods/farming/textures/farming_cookie.png b/mods/farming/textures/farming_cookie.png index e80be35..e82f4d0 100644 Binary files a/mods/farming/textures/farming_cookie.png and b/mods/farming/textures/farming_cookie.png differ diff --git a/mods/farming/textures/farming_potato.png b/mods/farming/textures/farming_potato.png index 6e91d6a..78d9396 100644 Binary files a/mods/farming/textures/farming_potato.png and b/mods/farming/textures/farming_potato.png differ diff --git a/mods/farming/textures/farming_wheat.png b/mods/farming/textures/farming_wheat.png index 1e0ad3b..0453b4b 100644 Binary files a/mods/farming/textures/farming_wheat.png and b/mods/farming/textures/farming_wheat.png differ diff --git a/mods/hyrule_mapgen/init.lua b/mods/hyrule_mapgen/init.lua index e74d8dc..8698667 100644 --- a/mods/hyrule_mapgen/init.lua +++ b/mods/hyrule_mapgen/init.lua @@ -141,7 +141,7 @@ minetest.register_lbm({ nodenames = {"moreplants:tallgrass", "moreplants:bulrush"}, run_at_every_load = true, action = function(pos, node, active_object_count, active_object_count_wider) - if math.random(1,3) == 3 then + if math.random(1,6) == 3 then minetest.env:add_entity({x=pos.x,y=pos.y+0.5,z=pos.z}, "hyrule_mapgen:dragonfly") end end @@ -240,22 +240,22 @@ minetest.register_abm({ interval = 5, chance = 5, action = function(pos, node) - minetest.add_particlespawner({ - amount = 10, - time = 4, - minpos = {x=pos.x-0.5, y=pos.y+0.3, z=pos.z-0.5}, - maxpos = {x=pos.x+0.5, y=pos.y+0.5, z=pos.z+0.5}, - minvel = {x=-0, y=0.5, z=-0}, - maxvel = {x=0, y=0.5, z=0}, - minacc = {x=0, y=0.5, z=0}, - maxacc = {x=0, y=0.5, z=0}, - minexptime = 0.5, - maxexptime = 2, - minsize = 1, - maxsize = 2, + for i=1,10 do + minetest.after(i*0.4, function() + minetest.add_particle({ + pos = {x=pos.x+math.random(-5,5)/10, y=pos.y+0.3, z=pos.z+math.random(-5,5)/10}, + velocity = {x=0, y=0.5, z=0}, + acceleration = {x=0, y=0.5, z=0}, + expirationtime = math.random(5,20)/10, + size = math.random(1,2), collisiondetection = false, - texture = "mobs_fairy_spark.png" + collisionremoval = false, + vertical = false, + texture = "mobs_fairy_spark.png", + glow = 9 }) + end) + end end }) @@ -315,12 +315,12 @@ minetest.register_entity("hyrule_mapgen:dragonfly", { visual_size = {x=0.3, y=0.3}, on_activate = function(self) num = math.random(1,4) - --self.object:set_properties({textures = {"hyrule_mapgen_butterfly"..num..".png",},}) + self.object:set_properties({textures = {"hyrule_mapgen_dragonfly"..num..".png",},}) self.object:set_animation({x=1, y=10}, 40, 0) self.object:setyaw(math.pi+num) - --minetest.after(10, function() - --self.object:remove() - --end) + minetest.after(60, function() + self.object:remove() + end) if math.random(1,100) == 1 then self.object:remove() end @@ -340,6 +340,40 @@ minetest.register_entity("hyrule_mapgen:dragonfly", { --overrides +local dirt_treasure = { + {"hyruletools:green_rupee", 10}, + {"fishing:bait_worm", 10}, + {"hyruletools:blue_rupee", 20}, + {"hyruletools:red_rupee", 40}, +} + +local shovels = { + {"default:shovel_steel"}, + {"default:shovel_wood"}, + {"default:shovel_bronze"}, + {"default:shovel_diamond"}, + {"default:shovel_mese"}, + {"default:shovel_stone"}, + } + +for _, row in ipairs(shovels) do +minetest.override_item(row[1], { + on_place = function(itemstack, placer, pointed_thing) + if minetest.get_node(pointed_thing.under).name == "default:dirt" or minetest.get_node(pointed_thing.under).name == "default:dirt_with_grass" or minetest.get_node(pointed_thing.under).name == "default:dirt_with_grass2" or minetest.get_node(pointed_thing.under).name == "default:dirt_with_grass3" then + minetest.set_node(pointed_thing.under, {name="hyrule_mapgen:packed_dirt"}) + for _, row in ipairs(dirt_treasure) do + local item = row[1] + local chance = row[2] + local pos = pointed_thing.under + if math.random(1, chance) == 1 then + minetest.add_item({x=pos.x, y=pos.y+1.2,z=pos.z}, item) + end + end + end + end, +}) +end + minetest.override_item("flowers:waterlily", { drawtype = "mesh", tiles = {"waterlily.png"}, @@ -500,6 +534,24 @@ minetest.override_item("default:furnace", { }, }) +minetest.override_item("default:furnace_active", { + drawtype = "nodebox", + paramtype = "light", + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.3125, 0.5}, -- NodeBox1 + {-0.4375, 0.375, -0.5, 0.4375, 0.4375, 0.5}, -- NodeBox2 + {-0.375, 0.4375, -0.5, 0.375, 0.5, 0.5}, -- NodeBox3 + {-0.5, 0.3125, -0.5, 0.5, 0.375, 0.5}, -- NodeBox4 + {-0.5, -0.5, -0.5, -0.3125, 0.3125, 0.5}, -- NodeBox5 + {0.3125, -0.5, -0.5, 0.5, 0.375, 0.5}, -- NodeBox6 + {-0.5, -0.0625, -0.5, 0.5, 0.0625, 0.5}, -- NodeBox7 + {-0.5, -0.5, -0.375, 0.5, 0.3125, 0.5}, -- NodeBox8 + } + }, +}) + minetest.override_item("default:chest_locked", { paramtype = "light", drawtype = "nodebox", @@ -594,6 +646,124 @@ minetest.override_item("default:stone_with_gold", { --new nodes +minetest.register_node("hyrule_mapgen:chillshroom", { + description = "Chillshroom", + tiles = {"hyrule_mapgen_chillshroom.png"}, + drawtype = "plantlike", + paramtype = "light", + selection_box = { + type = "fixed", + fixed = { + {-0.1, -0.5, -0.1, 0.1, -0.1, 0.1} + } + }, + groups = {fleshy=1, oddly_breakable_by_hand=1, dig_immediate=3}, + sounds = default.node_sound_leaves_defaults(), + drop = "hyrule_mapgen:chillshroom 3", + walkable = false, + on_use = minetest.item_eat(1) +}) + +minetest.register_node("hyrule_mapgen:chillshroom_2", { + description = "Chillshroom (ceiling)", + tiles = {"hyrule_mapgen_chillshroom.png^[transformFY"}, + drawtype = "plantlike", + paramtype = "light", + selection_box = { + type = "fixed", + fixed = { + {-0.1, 0.1, -0.1, 0.1, 0.5, 0.1} + } + }, + groups = {fleshy=1, oddly_breakable_by_hand=1, dig_immediate=3}, + sounds = default.node_sound_leaves_defaults(), + drop = "hyrule_mapgen:chillshroom 3", + walkable = false, + on_use = minetest.item_eat(1) +}) + +minetest.register_node("hyrule_mapgen:sunshroom", { + description = "Sunshroom", + tiles = {"hyrule_mapgen_sunshroom.png"}, + drawtype = "plantlike", + paramtype = "light", + selection_box = { + type = "fixed", + fixed = { + {-0.1, -0.5, -0.1, 0.1, -0.1, 0.1} + } + }, + groups = {fleshy=1, oddly_breakable_by_hand=1, dig_immediate=3, flammable=1}, + sounds = default.node_sound_leaves_defaults(), + drop = "hyrule_mapgen:sunshroom 3", + walkable = false, + on_use = minetest.item_eat(1) +}) + +minetest.register_node("hyrule_mapgen:zapshroom", { + description = "Zapshroom", + tiles = {"hyrule_mapgen_zapshroom.png"}, + drawtype = "plantlike", + paramtype = "light", + selection_box = { + type = "fixed", + fixed = { + {-0.1, -0.5, -0.1, 0.1, -0.1, 0.1} + } + }, + groups = {fleshy=1, oddly_breakable_by_hand=1, dig_immediate=3}, + sounds = default.node_sound_leaves_defaults(), + drop = "hyrule_mapgen:zapshroom 3", + walkable = false, + on_use = minetest.item_eat(1) +}) + +minetest.register_node("hyrule_mapgen:rushroom", { + description = "Rushroom", + tiles = {"hyrule_mapgen_rushroom.png"}, + drawtype = "plantlike", + paramtype = "light", + selection_box = { + type = "fixed", + fixed = { + {-0.1, -0.5, -0.1, 0.1, -0.1, 0.1} + } + }, + groups = {fleshy=1, oddly_breakable_by_hand=1, dig_immediate=3}, + sounds = default.node_sound_leaves_defaults(), + drop = "hyrule_mapgen:rushroom 3", + walkable = false, + on_use = minetest.item_eat(1) +}) + +minetest.register_node("hyrule_mapgen:berry_bush", { + description = "Wildberry Bush", + tiles = {"hyrule_mapgen_wildberry_bush.png"}, + drawtype = "plantlike", + paramtype = "light", + selection_box = { + type = "fixed", + fixed = { + {-0.1, -0.5, -0.1, 0.1, 0, 0.1} + } + }, + groups = {snappy=1, oddly_breakable_by_hand=1, dig_immediate=3}, + sounds = default.node_sound_leaves_defaults(), + walkable = false, + on_rightclick = function(pos, node) + minetest.add_item(pos, "hyrule_mapgen:wildberry") + minetest.add_item(pos, "hyrule_mapgen:wildberry") + minetest.add_item(pos, "hyrule_mapgen:wildberry") + minetest.remove_node(pos) + end, +}) + +minetest.register_craftitem("hyrule_mapgen:wildberry", { + description = "Wild Berry", + inventory_image = "hyrule_mapgen_wildberry.png", + on_use = minetest.item_eat(1) +}) + minetest.register_node("hyrule_mapgen:logpile", { description = "Log Pile", tiles = { @@ -622,6 +792,14 @@ minetest.register_node("hyrule_mapgen:logpile", { drop = "default:tree 3", }) +minetest.register_craft( { + output = "hyrule_mapgen:logpile 1", + recipe = { + { "", "default:tree", "" }, + { "default:tree", "", "default:tree" } + } +}) + minetest.register_node("hyrule_mapgen:bigmush", { description = "Big Mushroom", drawtype = "plantlike", @@ -773,6 +951,28 @@ minetest.register_node("hyrule_mapgen:dungeon_seed", { drop = "default:stone" }) +minetest.register_node("hyrule_mapgen:moldorm_stone", { + description = "Moldorm Stone", + tiles = {"hyrule_mapgen_moldorm_stone.png"}, + groups = {}, + sounds = default.node_sound_stone_defaults(), + on_rightclick = function(pos, node, clicker, itemstack) + minetest.env:add_entity({x=pos.x, y=pos.y+1, z=pos.z}, "mobs_loz:great_moldorm") + minetest.remove_node(pos) + end, +}) + +minetest.register_node("hyrule_mapgen:octorock_stone", { + description = "Octorock Stone", + tiles = {"hyrule_mapgen_octorock_stone.png"}, + groups = {}, + sounds = default.node_sound_stone_defaults(), + on_rightclick = function(pos, node, clicker, itemstack) + minetest.env:add_entity({x=pos.x, y=pos.y+1, z=pos.z}, "mobs_loz:octorock_boss") + minetest.remove_node(pos) + end, +}) + minetest.register_node("hyrule_mapgen:ice_brick", { description = "Ice Brick", tiles = {"hyrule_mapgen_ice_brick.png"}, @@ -910,7 +1110,7 @@ minetest.register_node("hyrule_mapgen:beamos", { minetest.register_abm({ nodenames = {"hyrule_mapgen:beamos"}, - interval = 1, + interval = 0.8, chance = 1, action = function(pos, node) local x = 0 @@ -925,33 +1125,20 @@ minetest.register_abm({ x = 1 end --minetest.chat_send_all(node.param2) - local numbers = { - {1}, - {2}, - {3}, - {4}, - } - for _, number in ipairs(numbers) do - local num = number[1] - local objs = minetest.get_objects_inside_radius({x=pos.x+x*num, y=pos.y, z=pos.z+z*num}, 1) + for num=1,5 do + local objs = minetest.get_objects_inside_radius({x=pos.x+x*num, y=pos.y-0.5, z=pos.z+z*num}, 1) for _, obj in ipairs(objs) do if obj:is_player() then local name = obj:get_player_name() minetest.sound_play("Laser", {to_player=obj, gain=0.5}) local ent = minetest.env:add_entity(pos, "hyrule_mapgen:laser") - ent:setvelocity({x=7*x, y=0, z=7*z}) - minetest.after(0.1, function() + ent:setvelocity({x=12*x, y=0, z=12*z}) + for i=1,5 do + minetest.after(i/10, function() local ent = minetest.env:add_entity(pos, "hyrule_mapgen:laser") - ent:setvelocity({x=7*x, y=0, z=7*z}) - end) - minetest.after(0.2, function() - local ent = minetest.env:add_entity(pos, "hyrule_mapgen:laser") - ent:setvelocity({x=7*x, y=0, z=7*z}) - end) - minetest.after(0.3, function() - local ent = minetest.env:add_entity(pos, "hyrule_mapgen:laser") - ent:setvelocity({x=7*x, y=0, z=7*z}) + ent:setvelocity({x=12*x, y=0, z=12*z}) end) + end end end end @@ -1002,18 +1189,18 @@ minetest.register_node("hyrule_mapgen:sinkingsand", { chest_items = { - {"clawshot:clawshot", 20}, - {"hyruletools:eye", 20}, - {"hyruletools:boomerang", 20}, - {"hyruletools:flame_rod", 50}, - {"hyruletools:wand", 50}, - {"hyruletools:medallion", 50}, - {"hyruletools:medallion2", 50}, - {"hyruletools:medallion3", 50}, - {"hyruletools:green_rupee 5", 10}, - {"hyruletools:blue_rupee 2", 10}, - {"hyruletools:red_rupee", 10}, - {"hyruletools:nyan_rupee", 50}, + {"clawshot:clawshot", 5}, + {"hyruletools:eye", 5}, + {"hyruletools:boomerang", 5}, + {"hyruletools:flame_rod", 10}, + {"hyruletools:wand", 10}, + {"hyruletools:medallion", 10}, + {"hyruletools:medallion2", 10}, + {"hyruletools:medallion3", 10}, + {"hyruletools:ice_rod 1", 5}, + {"hyruletools:blue_rupee 20", 5}, + {"hyruletools:red_rupee 10", 5}, + {"hyruletools:nyan_rupee", 5}, } minetest.register_node("hyrule_mapgen:chest", { @@ -1042,7 +1229,8 @@ minetest.register_node("hyrule_mapgen:chest", { local rarity = row[2] if math.random(1,rarity) == 1 then meta:set_string("item", item) - else + return + else meta:set_string("item", "hyruletools:green_rupee 20") end end @@ -1387,23 +1575,22 @@ minetest.register_abm({ interval = 1, chance = 2, action = function(pos, node) - minetest.add_particlespawner({ - amount = 30, - time = 4, - minpos = {x=pos.x-0.2, y=pos.y, z=pos.z-0.2}, - maxpos = {x=pos.x+0.2, y=pos.y+1, z=pos.z+0.2}, - minvel = {x=-0.1, y=1, z=-0.1}, - maxvel = {x=0.1, y=2, z=0.1}, - minacc = {x=0, y=-0.5, z=0}, - maxacc = {x=0, y=-1, z=0}, - minexptime = 1, - maxexptime = 2, - minsize = 3, - maxsize = 5, + for i=1,30 do + minetest.after(i*0.13, function() + minetest.add_particle({ + pos = {x=pos.x, y=pos.y+math.random(0,3)/10, z=pos.z}, + velocity = {x=math.random(-1,1)/10, y=math.random(1,2), z=math.random(-1,1)/10}, + acceleration = {x=math.random(-1,1)/10, y=math.random(-5,-10)/10, z=math.random(-1,1)/10}, + expirationtime = math.random(5,10)/10, + size = math.random(3,5), collisiondetection = false, + collisionremoval = false, + vertical = false, texture = "hyrule_mapgen_fire.png", - glow = 14 + glow = 9 }) + end) + end end }) @@ -1814,6 +2001,15 @@ minetest.register_node("hyrule_mapgen:floorbrick", { groups = {cracky=1} }) +stairs.register_stair_and_slab( + "floortile", + "hyrule_mapgen:floortile", + {cracky = 3, cools_lava = 1}, + {"hyrule_mapgen_floortile.png"}, + "Floor Tile Stair", + "Floor Tile Slab", + default.node_sound_stone_defaults() +) minetest.register_node("hyrule_mapgen:carpet", { description = "Carpet Block", @@ -1955,22 +2151,22 @@ minetest.register_abm({ interval = 1, chance = 1, action = function(pos, node) - local part = minetest.add_particlespawner( - 5, --amount - 1, --time - {x=pos.x-0.1, y=pos.y, z=pos.z-0.1}, --minpos - {x=pos.x+0.1, y=pos.y+0.2, z=pos.z+0.1}, --maxpos - {x=-0, y=0.5, z=-0}, --minvel - {x=0, y=1, z=0}, --maxvel - {x=0,y=0.5,z=0}, --minacc - {x=0.5,y=0.5,z=0.5}, --maxacc - 0.2, --minexptime - 0.5, --maxexptime - 4, --minsize - 8, --maxsize - false, --collisiondetection - "hyrule_mapgen_flame.png" --texture - ) + for i=1,5 do + minetest.after(i*0.2, function() + minetest.add_particle({ + pos = {x=pos.x+math.random(-2,2)/10, y=pos.y, z=pos.z+math.random(-2,2)/10}, + velocity = {x=0, y=math.random(5,10)/10, z=0}, + acceleration = {x=math.random(0,5)/10, y=0.5, z=math.random(0,5)/10}, + expirationtime = math.random(2,5)/10, + size = math.random(4,8), + collisiondetection = false, + collisionremoval = false, + vertical = false, + texture = "hyruletools_flame.png", + glow = 9 + }) + end) + end end }) @@ -2108,6 +2304,16 @@ minetest.register_node("hyrule_mapgen:dungeon_brick", { groups = {cracky=3}, }) +stairs.register_stair_and_slab( + "dungeon_brick", + "hyrule_mapgen:dungeon_brick", + {cracky = 3, cools_lava = 1}, + {"hyrule_mapgen_dungeon_brick.png"}, + "Retro Dungeon Stair", + "Retro Dungeon Slab", + default.node_sound_stone_defaults() +) + minetest.register_node("hyrule_mapgen:dungeon_barrier2", { description = "Retro Dungeon Barrier 2", tiles = { @@ -2132,6 +2338,16 @@ minetest.register_node("hyrule_mapgen:dungeon_brick2", { groups = {cracky=3}, }) +stairs.register_stair_and_slab( + "dungeon_brick2", + "hyrule_mapgen:dungeon_brick2", + {cracky = 3, cools_lava = 1}, + {"hyrule_mapgen_dungeon_brick2.png"}, + "Retro Dungeon Stair 2", + "Retro Dungeon Slab 2", + default.node_sound_stone_defaults() +) + minetest.register_node("hyrule_mapgen:dungeon_torch", { description = "Dungeon Torch", drawtype = "plantlike", @@ -2600,7 +2816,7 @@ minetest.register_craft({ minetest.register_node("hyrule_mapgen:boulder", { description = "Boulder", tiles = { - "default_stone.png", + "hyrule_mapgen_boulder.png", }, drawtype = "nodebox", paramtype = "light", @@ -2674,7 +2890,7 @@ minetest.register_node("hyrule_mapgen:magic_tree", { "hyrule_mapgen_magic_tree.png" }, paramtype = "facedir", - groups = {tree=1, choppy=2, flammable=2, oddly_breakable_by_hand = 1, not_in_creative_inventory=1}, + groups = {tree=1, choppy=2, flammable=2, oddly_breakable_by_hand = 1,}, on_place = minetest.rotate_node }) @@ -2684,7 +2900,7 @@ minetest.register_node("hyrule_mapgen:magic_leaves", { tiles = { "hyrule_mapgen_magic_leaves.png" }, - groups = {snappy=3, flammable=1, leafdecay=3, oddly_breakable_by_hand = 1, leaves=1, not_in_creative_inventory=1}, + groups = {snappy=3, flammable=1, leafdecay=3, oddly_breakable_by_hand = 1, leaves=1,}, paramtype = "light", walkable = false, }) @@ -2731,7 +2947,7 @@ minetest.register_node("hyrule_mapgen:palm_leaves", { "hyrule_mapgen_palm_leaf.png" }, inventory_image = "hyrule_mapgen_palm_leaf.png", - visual_scale = 3, + visual_scale = 6, wield_scale = {x=0.5, y=0.5, z=0.5}, groups = {snappy=3, flammable=1, leafdecay=3, oddly_breakable_by_hand = 1, leaves=1, not_in_creative_inventory=1}, paramtype = "light", @@ -2753,6 +2969,10 @@ minetest.register_node("hyrule_mapgen:coconut", { groups = {snappy=3, flammable=1, oddly_breakable_by_hand = 1, not_in_creative_inventory=1}, paramtype = "light", walkable = false, + selection_box = { + type = "fixed", + fixed = {-0.2, -0.3, -0.2, 0.2, 0.3, 0.2} + }, on_use = minetest.item_eat(2) }) @@ -2767,7 +2987,7 @@ minetest.register_node("hyrule_mapgen:wild_tree", { "hyrule_mapgen_wild_tree.png" }, paramtype = "facedir", - groups = {tree=1, choppy=2, oddly_breakable_by_hand = 1, flammable=2, not_in_creative_inventory=1}, + groups = {tree=1, choppy=2, oddly_breakable_by_hand = 1, flammable=2,}, on_place = minetest.rotate_node }) @@ -2779,7 +2999,7 @@ minetest.register_node("hyrule_mapgen:wild_leaves", { }, wield_image = "hyrule_mapgen_wild_leaves.png", inventory_image = "hyrule_mapgen_wild_leaves.png", - groups = {snappy=3, flammable=1, oddly_breakable_by_hand = 1, leafdecay=3, leaves=1, not_in_creative_inventory=1}, + groups = {snappy=3, flammable=1, oddly_breakable_by_hand = 1, leafdecay=3, leaves=1,}, paramtype = "light", walkable = false, }) diff --git a/mods/hyrule_mapgen/mapgen.lua b/mods/hyrule_mapgen/mapgen.lua index 067cbb3..01fc067 100644 --- a/mods/hyrule_mapgen/mapgen.lua +++ b/mods/hyrule_mapgen/mapgen.lua @@ -881,6 +881,52 @@ minetest.register_decoration({ y_min = 0, y_max = 50, }) +--berry bushes and mushrooms +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:snowblock", "default:dirt_with_snow"}, + sidelen = 26, + fill_ratio = 0.002, + biomes = {"taiga"}, + decoration = "hyrule_mapgen:berry_bush", + height = 1, +}) +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:snowblock", "default:dirt_with_snow"}, + sidelen = 26, + fill_ratio = 0.002, + biomes = {"taiga"}, + decoration = "hyrule_mapgen:chillshroom", + height = 1, +}) +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:desert_sand", "default:desert_stone"}, + sidelen = 26, + fill_ratio = 0.002, + biomes = {"desert"}, + decoration = "hyrule_mapgen:sunshroom", + height = 1, +}) +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass2"}, + sidelen = 26, + fill_ratio = 0.002, + biomes = {"lost_woods"}, + decoration = "hyrule_mapgen:zapshroom", + height = 1, +}) +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_dry_grass"}, + sidelen = 26, + fill_ratio = 0.002, + biomes = {"savanna"}, + decoration = "hyrule_mapgen:rushroom", + height = 1, +}) -- Jungle tree minetest.register_decoration({ @@ -1624,6 +1670,22 @@ minetest.register_on_generated(function(minp, maxp) end end) +minetest.register_on_generated(function(minp, maxp) + if maxp.y > -3 or maxp.y < -500 then + return + end + local stone = minetest.find_nodes_in_area(minp, maxp, + {"default:ice"}) + for n = 1, #stone do + if math.random(1, 50) == 1 then + local pos = {x = stone[n].x, y = stone[n].y, z = stone[n].z } + if minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "air" then + minetest.add_node({x=pos.x, y=pos.y-1, z=pos.z}, {name = "hyrule_mapgen:chillshroom_2"}) + end + end + end +end) + minetest.register_on_generated(function(minp, maxp) if maxp.y < -150 or maxp.y > 20 then return @@ -1715,6 +1777,7 @@ minetest.register_on_generated(function(minp, maxp) local pos = {x = grass[n].x, y = grass[n].y, z = grass[n].z } if minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "air" then minetest.place_schematic(pos, minetest.get_modpath("hyrule_mapgen").."/schematics/witch_hut.mts", 0, {}, true) + minetest.after(0.1, function() local obj = minetest.env:add_entity({x=pos.x+7, y=pos.y+7, z=pos.z+4}, "mobs_npc:npc_custom") local npc = obj:get_luaentity() npc.text = "I'll give you something nice if you find me a 'big mushroom'" @@ -1724,6 +1787,7 @@ minetest.register_on_generated(function(minp, maxp) npc.xdir = -1 npc.skin = "mobs_witch.png" npc.object:set_properties({textures = {"mobs_witch.png"}}) + end) end end end @@ -1740,6 +1804,7 @@ minetest.register_on_generated(function(minp, maxp) local pos = {x = grass[n].x, y = grass[n].y, z = grass[n].z } if minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "air" then minetest.place_schematic(pos, minetest.get_modpath("hyrule_mapgen").."/schematics/pine_village.mts", 0, {}, true) + minetest.after(0.1, function() local obj = minetest.env:add_entity({x=pos.x+4, y=pos.y+7, z=pos.z+5}, "mobs_npc:shopkeeper") local obj = minetest.env:add_entity({x=pos.x+6, y=pos.y+3, z=pos.z+18}, "mobs_npc:npc_custom") local npc = obj:get_luaentity() @@ -1757,6 +1822,7 @@ minetest.register_on_generated(function(minp, maxp) npc2.reward_item = "witchcraft:potion_herbal" npc2.skin = "mobs_witch.png" npc2.zdir = -1 + end) end end end @@ -1773,6 +1839,7 @@ minetest.register_on_generated(function(minp, maxp) local pos = {x = grass[n].x, y = grass[n].y, z = grass[n].z } if minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "air" then minetest.place_schematic(pos, minetest.get_modpath("hyrule_mapgen").."/schematics/savanna_village.mts", 0, {}, true) + minetest.after(0.1, function() local shopkeeper = minetest.env:add_entity({x=pos.x+6, y=pos.y+6, z=pos.z+2}, "mobs_npc:shopkeeper") local windmill = minetest.env:add_entity({x=pos.x+23, y=pos.y+13, z=pos.z+29}, "hyrule_mapgen:windmill") local obj = minetest.env:add_entity({x=pos.x+9, y=pos.y+9, z=pos.z+33}, "mobs_npc:npc_custom") @@ -1783,6 +1850,7 @@ minetest.register_on_generated(function(minp, maxp) npc.reward_item = "hyruletools:green_rupee" npc.item_count = 500 npc.zdir = -1 + end) end end end @@ -1797,6 +1865,7 @@ minetest.register_on_generated(function(minp, maxp) if minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "air" then minetest.place_schematic(pos, minetest.get_modpath("hyrule_mapgen").."/schematics/world"..num..".mts", 0, {}, true) if num == 1 then + minetest.after(0.1, function() local obj = minetest.env:add_entity({x=pos.x+5, y=pos.y+3, z=pos.z+4}, "mobs_npc:npc_custom") local npc = obj:get_luaentity() npc.text = "Deku Scrubs have been scaring my animals..." @@ -1806,15 +1875,18 @@ minetest.register_on_generated(function(minp, maxp) npc.skin = "mobs_farmer.png" npc.item_count = 10 npc.zdir = -1 + end) end if num == 5 then + minetest.after(0.1, function() local obj = minetest.env:add_entity({x=pos.x+3, y=pos.y+3, z=pos.z+3}, "mobs_npc:npc_custom") local npc = obj:get_luaentity() npc.skin = "mobs_npc_old.png" npc.text = "It's dangerous to travel in darkness" npc.item = "hyruletools:lantern" npc.xdir = 1 + end) end end end @@ -1858,7 +1930,7 @@ minetest.register_on_generated(function(minp, maxp) else local number = math.random(1,5) if math.random(1,5) == 1 then - minetest.place_schematic(pos, minetest.get_modpath("hyrule_mapgen").."/schematics/dungeon"..number..".mts", 0, {{["hyrule_mapgen:chest"] = "hyrule_mapgen:chest_key",}}, true) + minetest.place_schematic(pos, minetest.get_modpath("hyrule_mapgen").."/schematics/dungeon"..number..".mts", 0, {["hyrule_mapgen:chest"] = "hyrule_mapgen:chest_key",}, true) minetest.add_node({x=pos.x+math.random(1,12), y=pos.y+1, z=pos.z+math.random(1,12)}, {name = "mobs_loz:mimic_chest"}) else minetest.place_schematic(pos, minetest.get_modpath("hyrule_mapgen").."/schematics/dungeon"..number..".mts", 0, {}, true) diff --git a/mods/hyrule_mapgen/textures/default_stone.png b/mods/hyrule_mapgen/textures/default_stone.png index 439be68..2a44e39 100644 Binary files a/mods/hyrule_mapgen/textures/default_stone.png and b/mods/hyrule_mapgen/textures/default_stone.png differ diff --git a/mods/hyrule_mapgen/textures/hyrule_mapgen_boulder.png b/mods/hyrule_mapgen/textures/hyrule_mapgen_boulder.png new file mode 100644 index 0000000..0cb89dd Binary files /dev/null and b/mods/hyrule_mapgen/textures/hyrule_mapgen_boulder.png differ diff --git a/mods/hyrule_mapgen/textures/hyrule_mapgen_butterfly1.png b/mods/hyrule_mapgen/textures/hyrule_mapgen_butterfly1.png index fb03790..e64eb25 100644 Binary files a/mods/hyrule_mapgen/textures/hyrule_mapgen_butterfly1.png and b/mods/hyrule_mapgen/textures/hyrule_mapgen_butterfly1.png differ diff --git a/mods/hyrule_mapgen/textures/hyrule_mapgen_butterfly2.png b/mods/hyrule_mapgen/textures/hyrule_mapgen_butterfly2.png index feb88b8..2f3b93e 100644 Binary files a/mods/hyrule_mapgen/textures/hyrule_mapgen_butterfly2.png and b/mods/hyrule_mapgen/textures/hyrule_mapgen_butterfly2.png differ diff --git a/mods/hyrule_mapgen/textures/hyrule_mapgen_butterfly3.png b/mods/hyrule_mapgen/textures/hyrule_mapgen_butterfly3.png index 2d0db18..faf0aeb 100644 Binary files a/mods/hyrule_mapgen/textures/hyrule_mapgen_butterfly3.png and b/mods/hyrule_mapgen/textures/hyrule_mapgen_butterfly3.png differ diff --git a/mods/hyrule_mapgen/textures/hyrule_mapgen_chillshroom.png b/mods/hyrule_mapgen/textures/hyrule_mapgen_chillshroom.png new file mode 100644 index 0000000..3e7627f Binary files /dev/null and b/mods/hyrule_mapgen/textures/hyrule_mapgen_chillshroom.png differ diff --git a/mods/hyrule_mapgen/textures/hyrule_mapgen_coconut.png b/mods/hyrule_mapgen/textures/hyrule_mapgen_coconut.png index 473f0f4..02b5563 100644 Binary files a/mods/hyrule_mapgen/textures/hyrule_mapgen_coconut.png and b/mods/hyrule_mapgen/textures/hyrule_mapgen_coconut.png differ diff --git a/mods/hyrule_mapgen/textures/hyrule_mapgen_dragonfly1.png b/mods/hyrule_mapgen/textures/hyrule_mapgen_dragonfly1.png new file mode 100644 index 0000000..39113d6 Binary files /dev/null and b/mods/hyrule_mapgen/textures/hyrule_mapgen_dragonfly1.png differ diff --git a/mods/hyrule_mapgen/textures/hyrule_mapgen_dragonfly2.png b/mods/hyrule_mapgen/textures/hyrule_mapgen_dragonfly2.png new file mode 100644 index 0000000..f067b9d Binary files /dev/null and b/mods/hyrule_mapgen/textures/hyrule_mapgen_dragonfly2.png differ diff --git a/mods/hyrule_mapgen/textures/hyrule_mapgen_dragonfly3.png b/mods/hyrule_mapgen/textures/hyrule_mapgen_dragonfly3.png new file mode 100644 index 0000000..7f00464 Binary files /dev/null and b/mods/hyrule_mapgen/textures/hyrule_mapgen_dragonfly3.png differ diff --git a/mods/hyrule_mapgen/textures/hyrule_mapgen_dragonfly.png b/mods/hyrule_mapgen/textures/hyrule_mapgen_dragonfly4.png similarity index 100% rename from mods/hyrule_mapgen/textures/hyrule_mapgen_dragonfly.png rename to mods/hyrule_mapgen/textures/hyrule_mapgen_dragonfly4.png diff --git a/mods/hyrule_mapgen/textures/hyrule_mapgen_moldorm_stone.png b/mods/hyrule_mapgen/textures/hyrule_mapgen_moldorm_stone.png new file mode 100644 index 0000000..041a217 Binary files /dev/null and b/mods/hyrule_mapgen/textures/hyrule_mapgen_moldorm_stone.png differ diff --git a/mods/hyrule_mapgen/textures/hyrule_mapgen_octorock_stone.png b/mods/hyrule_mapgen/textures/hyrule_mapgen_octorock_stone.png new file mode 100644 index 0000000..071a613 Binary files /dev/null and b/mods/hyrule_mapgen/textures/hyrule_mapgen_octorock_stone.png differ diff --git a/mods/hyrule_mapgen/textures/hyrule_mapgen_rock2.png b/mods/hyrule_mapgen/textures/hyrule_mapgen_rock2.png new file mode 100644 index 0000000..cbc51fd Binary files /dev/null and b/mods/hyrule_mapgen/textures/hyrule_mapgen_rock2.png differ diff --git a/mods/hyrule_mapgen/textures/hyrule_mapgen_rushroom.png b/mods/hyrule_mapgen/textures/hyrule_mapgen_rushroom.png new file mode 100644 index 0000000..2863dc1 Binary files /dev/null and b/mods/hyrule_mapgen/textures/hyrule_mapgen_rushroom.png differ diff --git a/mods/hyrule_mapgen/textures/hyrule_mapgen_sunshroom.png b/mods/hyrule_mapgen/textures/hyrule_mapgen_sunshroom.png new file mode 100644 index 0000000..c02183f Binary files /dev/null and b/mods/hyrule_mapgen/textures/hyrule_mapgen_sunshroom.png differ diff --git a/mods/hyrule_mapgen/textures/hyrule_mapgen_wild_tree.png b/mods/hyrule_mapgen/textures/hyrule_mapgen_wild_tree.png index 3424819..0c1ea00 100644 Binary files a/mods/hyrule_mapgen/textures/hyrule_mapgen_wild_tree.png and b/mods/hyrule_mapgen/textures/hyrule_mapgen_wild_tree.png differ diff --git a/mods/hyrule_mapgen/textures/hyrule_mapgen_wild_tree_top.png b/mods/hyrule_mapgen/textures/hyrule_mapgen_wild_tree_top.png index 98daedc..3f42ac7 100644 Binary files a/mods/hyrule_mapgen/textures/hyrule_mapgen_wild_tree_top.png and b/mods/hyrule_mapgen/textures/hyrule_mapgen_wild_tree_top.png differ diff --git a/mods/hyrule_mapgen/textures/hyrule_mapgen_wildberry.png b/mods/hyrule_mapgen/textures/hyrule_mapgen_wildberry.png new file mode 100644 index 0000000..a5e2c52 Binary files /dev/null and b/mods/hyrule_mapgen/textures/hyrule_mapgen_wildberry.png differ diff --git a/mods/hyrule_mapgen/textures/hyrule_mapgen_wildberry_bush.png b/mods/hyrule_mapgen/textures/hyrule_mapgen_wildberry_bush.png new file mode 100644 index 0000000..9bb862d Binary files /dev/null and b/mods/hyrule_mapgen/textures/hyrule_mapgen_wildberry_bush.png differ diff --git a/mods/hyrule_mapgen/textures/hyrule_mapgen_zapshroom.png b/mods/hyrule_mapgen/textures/hyrule_mapgen_zapshroom.png new file mode 100644 index 0000000..083b3e4 Binary files /dev/null and b/mods/hyrule_mapgen/textures/hyrule_mapgen_zapshroom.png differ diff --git a/mods/noairblocks/depends.txt b/mods/hyrule_weather/depends.txt similarity index 100% rename from mods/noairblocks/depends.txt rename to mods/hyrule_weather/depends.txt diff --git a/mods/hyrule_weather/init.lua b/mods/hyrule_weather/init.lua new file mode 100644 index 0000000..aa59e1f --- /dev/null +++ b/mods/hyrule_weather/init.lua @@ -0,0 +1,208 @@ +if minetest.setting_get("enable_weather") then +local weathers = { + {"snow", "rain", "storm", "pollen", "dust", "insects", "none"}, +} + +local nodes = { + {{"default:snow", "default:snowblock"}, nil, nil, {"default:dirt"}, {"default:desert_sand"}, {"group:flower", "moreplants:tallgrass"}, nil} +} + +hyrule_weather = {} + +minetest.register_node("hyrule_weather:ice", { + description = "ice sheet", + tiles = { + "hyrule_weather_ice.png", + }, + use_texture_alpha = true, + drawtype = "nodebox", + paramtype = "light", + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}, -- NodeBox1 + } + }, + drop = "hyruletools:ice_fragment", + groups = {cracky=1, oddly_breakable_by_hand=1}, + sounds = default.node_sound_glass_defaults(), +}) + +local apply_weather = function(player, pos, weather_type) + if weather_type == nil then return end + --weather effects + if weather_type == "snow" then + if minetest.get_timeofday()*24000 >= 6000 and minetest.get_timeofday()*24000 <= 19000 then + player:set_sky({r=208, g=223, b=238}, "plain", nil, true) + end + for i=1,8 do + local water = minetest.find_node_near({x=pos.x+math.random(-7,7), y=pos.y+math.random(-4,4), z=pos.z+math.random(-7,7)}, 10, {"default:water_source", "default:river_water_source"}, true) + water.y = water.y+1 + if minetest.get_node(water).name == "air" then + minetest.set_node(water, {name="hyrule_weather:ice"}) + end + minetest.add_particle({ + pos = {x=pos.x+math.random(-10,10), y=pos.y+math.random(12,17), z=pos.z+math.random(-10,10)}, + velocity = {x=math.random(-5,5)/10, y=math.random(-4,-6), z=math.random(-5,5)/10}, + acceleration = {x=math.random(-1,1)/10, y=math.random(-5,-10)/10, z=math.random(-1,1)/10}, + expirationtime = 3, + size = math.random(3,5), + collisiondetection = true, + collision_removal = true, + vertical = false, + texture = "hyrule_weather_snow_"..math.random(1,2)..".png", + glow = 0 + }) + end + elseif weather_type == "rain" then + if minetest.get_timeofday()*24000 >= 6000 and minetest.get_timeofday()*24000 <= 19000 then + player:set_sky({r=177, g=177, b=177}, "plain", nil, true) + end + for i=1,12 do + minetest.add_particle({ + pos = {x=pos.x+math.random(-10,10), y=pos.y+math.random(12,17), z=pos.z+math.random(-10,10)}, + velocity = {x=0, y=math.random(-15,-20), z=0}, + acceleration = {x=0, y=-1, z=0}, + expirationtime = 2, + size = math.random(3,5), + collisiondetection = true, + collision_removal = true, + vertical = true, + texture = "hyrule_weather_rain_"..math.random(1,2)..".png", + glow = 0 + }) + end + elseif weather_type == "storm" then + if minetest.get_timeofday()*24000 >= 6000 and minetest.get_timeofday()*24000 <= 19000 then + player:set_sky({r=101, g=101, b=101}, "plain", nil, true) + end + for i=1,25 do + minetest.add_particle({ + pos = {x=pos.x+math.random(-10,10), y=pos.y+math.random(12,17), z=pos.z+math.random(-10,10)}, + velocity = {x=0, y=math.random(-25,-30), z=0}, + acceleration = {x=0, y=-1, z=0}, + expirationtime = 2, + size = math.random(3,5), + collisiondetection = true, + collision_removal = true, + vertical = true, + texture = "hyrule_weather_rain_3.png", + glow = 0 + }) + if math.random(1,2000) == 1 then + lightning.strike() + end + end + elseif weather_type == "pollen" then + if minetest.get_timeofday()*24000 >= 6000 and minetest.get_timeofday()*24000 <= 19000 then + player:set_sky({r=158, g=220, b=119}, "plain", nil, true) + end + for i=1,12 do + minetest.add_particle({ + pos = {x=pos.x+math.random(-5,5), y=pos.y+math.random(0,5), z=pos.z+math.random(-5,5)}, + velocity = {x = math.random(-2,2)/10, y = math.random(2,3)/10, z = math.random(-2,2)/10}, + acceleration = {x = math.random(-2,2)/10, y=0.2, z = math.random(-2,2)/10}, + expirationtime = 0.6, + size = math.random(12,15)/10, + collisiondetection = true, + collision_removal = true, + vertical = false, + texture = "hyrule_weather_pollen_"..math.random(1,2)..".png", + glow = 5 + }) + end + elseif weather_type == "dust" then + if minetest.get_timeofday()*24000 >= 6000 and minetest.get_timeofday()*24000 <= 19000 then + player:set_sky({r=215, g=156, b=91}, "plain", nil, true) + end + for i=1,12 do + minetest.add_particle({ + pos = {x=pos.x+math.random(-10,10), y=pos.y+math.random(1,3)/10, z=pos.z+math.random(-10,10)}, + velocity = {x=1, y=math.random(1,2), z=1}, + acceleration = {x=4, y=math.random(2,3)/10, z=4}, + expirationtime = 0.5, + size = math.random(3,5), + collisiondetection = true, + collision_removal = true, + vertical = false, + texture = "hyrule_weather_dust_1.png", + glow = 0 + }) + end + elseif weather_type == "insects" then + player:set_sky(nil, "regular", nil, true) + elseif weather_type == "none" then + player:set_sky(nil, "regular", nil, true) + return + end +end + +minetest.register_on_joinplayer(function() + if math.random(1,500) == 1 then + for _, row in ipairs(weathers) do + local num = math.random(1,7) + hyrule_weather.current = num + hyrule_weather.weather = row[num] + end + end +end) + +minetest.register_globalstep(function(dtime) + if math.random(1,4) ~= 4 or hyrule_weather.weather == "twilight" then return end + --select random weather (serverwide) + if math.random(1,5000) == 1 then + for _, row in ipairs(weathers) do + local num = math.random(1,7) + hyrule_weather.current = num + hyrule_weather.weather = row[num] + end + end + if minetest.get_day_count() <= 2 then + hyrule_weather.current = 3 + hyrule_weather.weather = "storm" + end + --player specific + for _, player in ipairs(minetest.get_connected_players()) do + local pos = player:getpos() + --check if weather should occur at current location + local display_weather = false + for _, row in ipairs(nodes) do + if row[hyrule_weather.current] ~= nil and minetest.find_node_near(pos, 5, row[hyrule_weather.current]) then + display_weather = true + elseif row[hyrule_weather.current] == nil then + display_weather = true + else + display_weather = false + end + end + --apply weather effect + if display_weather then + apply_weather(player, pos, hyrule_weather.weather) + else + apply_weather(player, pos, "none") + end + end +end) + + +minetest.register_privilege("weather", { + description = "Allows control of weather", + give_to_singleplayer = false +}) + +minetest.register_chatcommand("change_weather", { + params = "", + description = "Sets weather to the given type", + privs = {weather = true}, + func = function(name, param) + hyrule_weather.weather = param + for _, row in ipairs(weathers) do + for i=1,7 do + if row[i] == param then + hyrule_weather.current = i + end + end + end + end, +}) +end \ No newline at end of file diff --git a/mods/hyrule_weather/textures/hyrule_weather_dust_1.png b/mods/hyrule_weather/textures/hyrule_weather_dust_1.png new file mode 100644 index 0000000..c954312 Binary files /dev/null and b/mods/hyrule_weather/textures/hyrule_weather_dust_1.png differ diff --git a/mods/hyrule_weather/textures/hyrule_weather_ice.png b/mods/hyrule_weather/textures/hyrule_weather_ice.png new file mode 100644 index 0000000..484c214 Binary files /dev/null and b/mods/hyrule_weather/textures/hyrule_weather_ice.png differ diff --git a/mods/weather_pack/textures/dust_dust1.png b/mods/hyrule_weather/textures/hyrule_weather_pollen_1.png similarity index 100% rename from mods/weather_pack/textures/dust_dust1.png rename to mods/hyrule_weather/textures/hyrule_weather_pollen_1.png diff --git a/mods/weather_pack/textures/dust_dust2.png b/mods/hyrule_weather/textures/hyrule_weather_pollen_2.png similarity index 100% rename from mods/weather_pack/textures/dust_dust2.png rename to mods/hyrule_weather/textures/hyrule_weather_pollen_2.png diff --git a/mods/hyrule_weather/textures/hyrule_weather_rain_1.png b/mods/hyrule_weather/textures/hyrule_weather_rain_1.png new file mode 100644 index 0000000..ee44de0 Binary files /dev/null and b/mods/hyrule_weather/textures/hyrule_weather_rain_1.png differ diff --git a/mods/hyrule_weather/textures/hyrule_weather_rain_2.png b/mods/hyrule_weather/textures/hyrule_weather_rain_2.png new file mode 100644 index 0000000..a316117 Binary files /dev/null and b/mods/hyrule_weather/textures/hyrule_weather_rain_2.png differ diff --git a/mods/hyrule_weather/textures/hyrule_weather_rain_3.png b/mods/hyrule_weather/textures/hyrule_weather_rain_3.png new file mode 100644 index 0000000..91a8526 Binary files /dev/null and b/mods/hyrule_weather/textures/hyrule_weather_rain_3.png differ diff --git a/mods/hyrule_weather/textures/hyrule_weather_snow_1.png b/mods/hyrule_weather/textures/hyrule_weather_snow_1.png new file mode 100644 index 0000000..a79048d Binary files /dev/null and b/mods/hyrule_weather/textures/hyrule_weather_snow_1.png differ diff --git a/mods/hyrule_weather/textures/hyrule_weather_snow_2.png b/mods/hyrule_weather/textures/hyrule_weather_snow_2.png new file mode 100644 index 0000000..f7c6e48 Binary files /dev/null and b/mods/hyrule_weather/textures/hyrule_weather_snow_2.png differ diff --git a/mods/hyruletools/depends.txt b/mods/hyruletools/depends.txt index f941986..2a36612 100644 --- a/mods/hyruletools/depends.txt +++ b/mods/hyruletools/depends.txt @@ -1,4 +1,5 @@ default -weather_pack 3d_armor -playereffects \ No newline at end of file +playereffects +hyrule_weather +lightning \ No newline at end of file diff --git a/mods/hyruletools/init.lua b/mods/hyruletools/init.lua index 28d31c5..1c1ad20 100644 --- a/mods/hyruletools/init.lua +++ b/mods/hyruletools/init.lua @@ -11,6 +11,47 @@ local counter3 = nil minetest.register_globalstep(function() for _, player in ipairs(minetest.get_connected_players()) do + if player:get_wielded_item():get_name() == "hyruletools:climbing_gloves" then + local pos = player:getpos() + --player:get_wielded_item():add_wear(2000) + local climbable = minetest.find_node_near(pos, 1, {"default:stone", "default:obsidian", "default:sandstone", "default:ice", "default:desert_stone", "default:cobblestone", "default:desert_cobblestone"}) + if climbable and minetest.get_node(pos).name == "air" then + minetest.set_node(pos, {name="hyruletools:climbable"}) + end + for i=1,2 do + local remove_node = minetest.find_node_near(pos, 1, {"hyruletools:climbable"}) + if remove_node then + minetest.remove_node(remove_node) + end + end + --[[else + local remove_node = minetest.find_node_near(player:getpos(), 1, {"hyruletools:climbable"}) + if remove_node then + minetest.remove_node(remove_node) + end]] + elseif player:get_wielded_item():get_name() == "hyruletools:sword_complete" and player:get_player_control().LMB then + local dir = player:get_look_dir() + local playerpos = player:getpos() + local obj = minetest.env:add_entity({x=playerpos.x+dir.x,y=playerpos.y+1.5+dir.y,z=playerpos.z+0+dir.z}, "hyruletools:swdspark") + local vec = {x=dir.x*7,y=dir.y*7,z=dir.z*7} + obj:setvelocity(vec) + end + if player:get_wielded_item():get_name() == "hyruletools:lantern" then + local pos = player:getpos() + local item = player:get_wielded_item() + item:add_wear(2000) + pos.y = pos.y+1 + if minetest.get_node(pos).name == "air" then + minetest.set_node(pos, {name="hyruletools:light"}) + end + for i=1,2 do + local remove_node = minetest.find_node_near(pos, 1, {"hyruletools:light"}, false) + if remove_node then + minetest.remove_node(remove_node) + end + end + return item + end if player:get_player_name() ~= "singleplayer" then return end @@ -553,6 +594,203 @@ minetest.register_tool("hyruletools:magglv_s", { end, }) + +minetest.register_craftitem("hyruletools:dungeon_spawner", { + description = "Dungeon Spawner", + inventory_image = "hyruletools_dungeon_spawner.png", + on_use = function(itemstack, user, pointed_thing) + if pointed_thing == nil then return end + local node = minetest.get_node(pointed_thing.under).name + local pos = pointed_thing.under + pos.y = pos.y+1 + if node == "default:dirt_with_dry_grass" then + minetest.place_schematic(pos, minetest.get_modpath("hyruletools").."/schematics/moldorms_lair.mts", 0, {}, true) + end + itemstack:take_item() + return itemstack + end, +}) + +minetest.register_craftitem("hyruletools:dungeon_spawner2", { + description = "Advanced Dungeon Spawner", + inventory_image = "hyruletools_dungeon_spawner2.png", + on_use = function(itemstack, user, pointed_thing) + if pointed_thing == nil then return end + local node = minetest.get_node(pointed_thing.under).name + local pos = pointed_thing.under + pos.y = pos.y+1 + if node == "default:dirt_with_dry_grass" then + minetest.place_schematic(pos, minetest.get_modpath("hyruletools").."/schematics/moldorms_lair.mts", 0, {}, true) + end + itemstack:take_item() + return itemstack + end, +}) + +minetest.register_node("hyruletools:beaconb", { + description = "Beacon (red)", + drawtype = "glasslike", + tiles = {"hyruletools_beacon_boxb.png"}, + use_texture_alpha = true, + paramtype = "light", + light_source = 5, + groups = {cracky=1, oddly_breakable_by_hand=1}, + on_construct = function(pos, node, clicker, itemstack) + if minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "air" then + minetest.set_node({x=pos.x, y=pos.y+1, z=pos.z}, {name="hyruletools:beacon_lightb"}) + end + end, + on_destruct = function(pos, oldnode) + if minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "hyruletools:beacon_lightb" then + minetest.remove_node({x=pos.x, y=pos.y+1, z=pos.z}) + end + end, + sounds = default.node_sound_glass_defaults() +}) + +minetest.register_node("hyruletools:beacon_lightb", { + description = "Beacon Light", + tiles = {"hyruletools_beaconb.png"}, + use_texture_alpha = true, + drawtype = "nodebox", + paramtype = "light", + pointable = false, + node_box = { + type = "fixed", + fixed = { + {-0.3125, -0.5, -0.3125, 0.3125, 0.5, 0.3125}, -- NodeBox1 + } + }, + light_source = 12, + groups = {cracky=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1}, + walkable = false, + drop = "", + on_construct = function(pos, node) + if pos.y >= 41000 then return end + if minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "air" then + minetest.set_node({x=pos.x, y=pos.y+1, z=pos.z}, {name="hyruletools:beacon_lightb"}) + end + end, + on_destruct = function(pos, oldnode) + if minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "hyruletools:beacon_lightb" then + minetest.remove_node({x=pos.x, y=pos.y+1, z=pos.z}) + end + end, + sounds = default.node_sound_glass_defaults() +}) + +minetest.register_abm({ + nodenames = {"hyruletools:beaconb"}, + interval = 5, + chance = 1, + action = function(pos, node) + minetest.add_particle({ + pos = {x=pos.x, y=pos.y+0.1, z=pos.z}, + velocity = {x=0, y=0, z=0}, + acceleration = {x=0, y=0, z=0}, + expirationtime = 5, + size = 30, + collisiondetection = false, + collisionremoval = false, + vertical = false, + texture = "hyruletools_beacon_centerb.png", + animation = {type = "vertical_frames", aspect_w = 64, aspect_h = 64, length = 0.30}, + glow = 9 + }) + end +}) + +minetest.register_node("hyruletools:beacon", { + description = "Beacon (blue)", + drawtype = "glasslike", + tiles = {"hyruletools_beacon_box.png"}, + use_texture_alpha = true, + paramtype = "light", + light_source = 5, + groups = {cracky=1, oddly_breakable_by_hand=1}, + on_construct = function(pos, node, clicker, itemstack) + if minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "air" then + minetest.set_node({x=pos.x, y=pos.y+1, z=pos.z}, {name="hyruletools:beacon_light"}) + end + end, + on_destruct = function(pos, oldnode) + if minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "hyruletools:beacon_light" then + minetest.remove_node({x=pos.x, y=pos.y+1, z=pos.z}) + end + end, + sounds = default.node_sound_glass_defaults() +}) + +minetest.register_node("hyruletools:beacon_light", { + description = "Beacon Light", + tiles = {"hyruletools_beacon.png"}, + use_texture_alpha = true, + drawtype = "nodebox", + paramtype = "light", + pointable = false, + node_box = { + type = "fixed", + fixed = { + {-0.3125, -0.5, -0.3125, 0.3125, 0.5, 0.3125}, -- NodeBox1 + } + }, + light_source = 12, + groups = {cracky=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1}, + walkable = false, + drop = "", + on_construct = function(pos, node) + if pos.y >= 41000 then return end + if minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "air" then + minetest.set_node({x=pos.x, y=pos.y+1, z=pos.z}, {name="hyruletools:beacon_light"}) + end + end, + on_destruct = function(pos, oldnode) + if minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "hyruletools:beacon_light" then + minetest.remove_node({x=pos.x, y=pos.y+1, z=pos.z}) + end + end, + sounds = default.node_sound_glass_defaults() +}) + +minetest.register_abm({ + nodenames = {"hyruletools:beacon"}, + interval = 5, + chance = 1, + action = function(pos, node) + minetest.add_particle({ + pos = {x=pos.x, y=pos.y+0.1, z=pos.z}, + velocity = {x=0, y=0, z=0}, + acceleration = {x=0, y=0, z=0}, + expirationtime = 5, + size = 30, + collisiondetection = false, + collisionremoval = false, + vertical = false, + texture = "hyruletools_beacon_center.png", + animation = {type = "vertical_frames", aspect_w = 64, aspect_h = 64, length = 0.30}, + glow = 9 + }) + end +}) + +minetest.register_craft({ + output = 'hyruletools:beacon', + recipe = { + {'default:glass'}, + {'mobs_loz:soul'}, + {'hyruletools:blue_ore'}, + } +}) + +minetest.register_craft({ + output = 'hyruletools:beaconb', + recipe = { + {'default:glass'}, + {'mobs_loz:soul'}, + {'hyruletools:red_ore'}, + } +}) + minetest.register_tool("hyruletools:shield_classic", { description = "Classic Shield", inventory_image = "shields_inv_shield_classic.png", @@ -924,7 +1162,8 @@ minetest.register_craftitem("hyruletools:ocarina2", { local dir = placer:get_look_dir(); local player = placer:get_player_name() if minetest.setting_getbool("enable_weather") then - weather.state = "thunder" + hyrule_weather.weather = "storm" + hyrule_weather.current = 3 else minetest.chat_send_player(player, "weather not enabled!") end @@ -1075,7 +1314,81 @@ minetest.register_tool("hyruletools:lantern", { end }) +minetest.register_node("hyruletools:climbable", { + drawtype = "airlike", + groups = {not_in_creative_inventory=1}, + walkable = false, + climbable = true, + pointable = false, +}) +minetest.register_node("hyruletools:light", { + drawtype = "airlike", + groups = {not_in_creative_inventory=1}, + walkable = false, + pointable = false, + light_source = 10, +}) + +minetest.register_abm({ + nodenames = {"hyruletools:climbable", "hyruletools:light"}, + interval = 1, + chance = 1, + action = function(pos, node) + minetest.remove_node(pos) + end, +}) + +minetest.register_tool("hyruletools:climbing_gloves", { + description = "Climbing Gloves", + inventory_image = "hyruletools_climbing_gloves.png" +}) + +--[[minetest.register_node("hyruletools:climbable2", { + drawtype = "airlike", + groups = {not_in_creative_inventory=1}, + walkable = true, + pointable = false, +}) + +minetest.register_abm({ + nodenames = {"hyruletools:climbable2"}, + interval = 1, + chance = 1, + action = function(pos, node) + local objs = minetest.get_objects_inside_radius(pos, 1) + local destroy = true + for _,obj in ipairs(objs) do + if obj:is_player() then + destroy = false + return destroy + end + end + if destroy then + minetest.remove_node(pos) + end + end, +}) + +minetest.register_tool("hyruletools:climbing_gloves2", { + description = "Climbing Gloves 2", + inventory_image = "hyruletools_climbing_gloves.png", + range = 3, + on_use = function(itemstack, clicker, pointed_thing) + if not pointed_thing then return end + local pos = pointed_thing.above + local pos2 = clicker:getpos() + pos2.y = pos2.y-1 + if minetest.get_node(pos2).name == "hyruletools:climbable2" then + minetest.remove_node(pos2) + end + clicker:setpos(pos) + pos.y = pos.y-1 + minetest.set_node(pos, {name="hyruletools:climbable2"}) + itemstack:add_wear(1000) + return itemstack + end, +})]] minetest.register_tool("hyruletools:mirror", { description = "Magic Mirror (use at your own risk!)", @@ -1170,26 +1483,26 @@ minetest.register_tool("hyruletools:medallion", { if mana.subtract(player, 100) then local playerpos = placer:getpos(); --particles - minetest.add_particlespawner( - 12, --amount - 1.5, --time - {x=playerpos.x-0.2, y=playerpos.y+1, z=playerpos.z-0.2}, - {x=playerpos.x+0.2, y=playerpos.y+1, z=playerpos.z+0.2}, - {x=0, y=4, z=0}, --minvel - {x=0, y=4, z=0}, --maxvel - {x=0,y=1,z=0}, --minacc - {x=0,y=1,z=0}, --maxacc - 0.1, --minexptime - 0.2, --maxexptime - 30, --minsize - 30, --maxsize - false, --collisiondetection - "hyruletools_lightning.png" --texture - ) + for i=1,5 do + minetest.after(i*0.1, function() + minetest.add_particle({ + pos = {x=playerpos.x, y=playerpos.y+1, z=playerpos.z}, + velocity = {x=0, y=4, z=0}, + acceleration = {x=0, y=1, z=0}, + expirationtime = 0.5, + size = 30, + collisiondetection = false, + collisionremoval = false, + vertical = true, + texture = "hyruletools_lightning.png", + glow = 9 + }) + end) + end --objects minetest.after(1, function() - minetest.sound_play("thunder", {pos = playerpos, gain = 0.5, max_hear_distance = 2*64}) + minetest.sound_play("thunder", {pos = playerpos, gain = 0.4, max_hear_distance = 2*64}) local obj = minetest.env:add_entity({x=playerpos.x+1,y=playerpos.y+1,z=playerpos.z+1}, "hyruletools:spark") local vec = {x=6,y=0,z=6} obj:setvelocity(vec) @@ -1221,6 +1534,11 @@ minetest.register_tool("hyruletools:medallion", { local obj = minetest.env:add_entity({x=playerpos.x+1,y=playerpos.y+1,z=playerpos.z}, "hyruletools:spark") local vec = {x=6,y=0,z=0} obj:setvelocity(vec) + minetest.after(0.5, function() + for i=1,5 do + lightning.strike({x=playerpos.x+math.random(-6,6), y=playerpos.y, z=playerpos.z+math.random(-6,6)}) + end + end) end) end return itemstack @@ -1239,12 +1557,16 @@ minetest.register_craft({ minetest.register_entity("hyruletools:stone", { visual = "cube", - textures = {"default_stone.png", "default_stone.png", "default_stone.png", "default_stone.png", "default_stone.png", "default_stone.png"}, + textures = {"default_stone.png", "default_stone.png^[colorize:black:50", "default_stone.png^[colorize:black:10", "default_stone.png^[colorize:black:10", "default_stone.png^[colorize:black:20", "default_stone.png^[colorize:black:20"}, velocity = 15, collision_box = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, - physical = false, + physical = true, on_activate = function(self) minetest.after(5, function() + local pos = self.object:getpos() + if pos ~= nil and minetest.get_node(pos).name == "air" then + minetest.set_node(pos, {name="default:stone"}) + end self.object:remove() end) end, @@ -1256,7 +1578,7 @@ minetest.register_entity("hyruletools:stone", { if obj:get_luaentity().name ~= "hyruletools:stone" and obj:get_luaentity().name ~= "__builtin:item" then obj:punch(self.object, 1.0, { full_punch_interval=1.0, - damage_groups={fleshy=9}, + damage_groups={fleshy=12}, }, nil) self.object:remove() end @@ -1275,100 +1597,38 @@ minetest.register_tool("hyruletools:medallion2", { local playerpos = placer:getpos(); minetest.sound_play("earthquake", {pos = playerpos, gain = 0.5, max_hear_distance = 32}) --particles - minetest.add_particlespawner( - 24, --amount - 3, --time - {x=playerpos.x-4, y=playerpos.y+0.8, z=playerpos.z-4}, - {x=playerpos.x+4, y=playerpos.y+1, z=playerpos.z+4}, - {x=-1, y=1, z=-1}, --minvel - {x=1, y=4, z=1}, --maxvel - {x=0,y=1,z=0}, --minacc - {x=0,y=1,z=0}, --maxacc - 0.1, --minexptime - 0.2, --maxexptime - 10, --minsize - 10, --maxsize - false, --collisiondetection - "hyruletools_lightning2.png" --texture - ) + for i=1,24 do + minetest.after(i*0.1, function() + minetest.add_particle({ + pos = {x=playerpos.x+math.random(-4,4), y=playerpos.y+math.random(8,10)/10, z=playerpos.z+math.random(-4,4)}, + velocity = {x=math.random(-1,1), y=math.random(1,4), z=math.random(-1,1)}, + acceleration = {x=0, y=1, z=0}, + expirationtime = 0.5, + size = 10, + collisiondetection = false, + collisionremoval = false, + vertical = false, + texture = "hyruletools_lightning2.png", + animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 0.20}, + glow = 9 + }) + end) + end - minetest.after(1.5, function() - local obj = minetest.env:add_entity({x=playerpos.x+3,y=playerpos.y+5,z=playerpos.z+4}, "hyruletools:stone") + for i=1,20 do + minetest.after(i*0.5, function() + local obj = minetest.env:add_entity({x=playerpos.x+math.random(-5,5),y=playerpos.y+5,z=playerpos.z+math.random(-5,5)}, "hyruletools:stone") local vec = {x=0,y=-13,z=0} obj:setvelocity(vec) - local obj = minetest.env:add_entity({x=playerpos.x-3,y=playerpos.y+6,z=playerpos.z+0}, "hyruletools:stone") + local obj = minetest.env:add_entity({x=playerpos.x+math.random(-5,5),y=playerpos.y+6,z=playerpos.z+math.random(-5,5)}, "hyruletools:stone") local vec = {x=0,y=-13,z=0} obj:setvelocity(vec) - local obj = minetest.env:add_entity({x=playerpos.x+3,y=playerpos.y+7,z=playerpos.z+3}, "hyruletools:stone") - local vec = {x=0,y=-13,z=0} - obj:setvelocity(vec) - minetest.after(0.5, function() - local obj = minetest.env:add_entity({x=playerpos.x+0,y=playerpos.y+5,z=playerpos.z-4}, "hyruletools:stone") - local vec = {x=0,y=-13,z=0} - obj:setvelocity(vec) - local obj = minetest.env:add_entity({x=playerpos.x+4,y=playerpos.y+6,z=playerpos.z+4}, "hyruletools:stone") - local vec = {x=0,y=-13,z=0} - obj:setvelocity(vec) - local obj = minetest.env:add_entity({x=playerpos.x+4,y=playerpos.y+7,z=playerpos.z+0}, "hyruletools:stone") - local vec = {x=0,y=-13,z=0} - obj:setvelocity(vec) - minetest.after(0.5, function() - local obj = minetest.env:add_entity({x=playerpos.x+3,y=playerpos.y+5,z=playerpos.z+0}, "hyruletools:stone") - local vec = {x=0,y=-13,z=0} - obj:setvelocity(vec) - local obj = minetest.env:add_entity({x=playerpos.x+0,y=playerpos.y+6,z=playerpos.z+3}, "hyruletools:stone") - local vec = {x=0,y=-13,z=0} - obj:setvelocity(vec) - local obj = minetest.env:add_entity({x=playerpos.x-3,y=playerpos.y+7,z=playerpos.z+0}, "hyruletools:stone") - local vec = {x=0,y=-13,z=0} - obj:setvelocity(vec) - minetest.after(0.5, function() - local obj = minetest.env:add_entity({x=playerpos.x+0,y=playerpos.y+5,z=playerpos.z+3}, "hyruletools:stone") - local vec = {x=0,y=-13,z=0} - obj:setvelocity(vec) - local obj = minetest.env:add_entity({x=playerpos.x+4,y=playerpos.y+6,z=playerpos.z-3}, "hyruletools:stone") - local vec = {x=0,y=-13,z=0} - obj:setvelocity(vec) - local obj = minetest.env:add_entity({x=playerpos.x+4,y=playerpos.y+7,z=playerpos.z+0}, "hyruletools:stone") - local vec = {x=0,y=-13,z=0} - obj:setvelocity(vec) - minetest.after(0.5, function() - local obj = minetest.env:add_entity({x=playerpos.x+0,y=playerpos.y+5,z=playerpos.z+4}, "hyruletools:stone") - local vec = {x=0,y=-13,z=0} - obj:setvelocity(vec) - local obj = minetest.env:add_entity({x=playerpos.x-4,y=playerpos.y+6,z=playerpos.z-4}, "hyruletools:stone") - local vec = {x=0,y=-13,z=0} - obj:setvelocity(vec) - local obj = minetest.env:add_entity({x=playerpos.x-3,y=playerpos.y+7,z=playerpos.z+0}, "hyruletools:stone") - local vec = {x=0,y=-13,z=0} - obj:setvelocity(vec) - minetest.after(0.5, function() - local obj = minetest.env:add_entity({x=playerpos.x+2,y=playerpos.y+5,z=playerpos.z+4}, "hyruletools:stone") - local vec = {x=0,y=-13,z=0} - obj:setvelocity(vec) - local obj = minetest.env:add_entity({x=playerpos.x+4,y=playerpos.y+6,z=playerpos.z}, "hyruletools:stone") - local vec = {x=0,y=-13,z=0} - obj:setvelocity(vec) - local obj = minetest.env:add_entity({x=playerpos.x-3,y=playerpos.y+7,z=playerpos.z+3}, "hyruletools:stone") - local vec = {x=0,y=-13,z=0} - obj:setvelocity(vec) - minetest.after(0.5, function() - local obj = minetest.env:add_entity({x=playerpos.x+3,y=playerpos.y+5,z=playerpos.z-4}, "hyruletools:stone") - local vec = {x=0,y=-13,z=0} - obj:setvelocity(vec) - local obj = minetest.env:add_entity({x=playerpos.x,y=playerpos.y+6,z=playerpos.z+3}, "hyruletools:stone") - local vec = {x=0,y=-13,z=0} - obj:setvelocity(vec) - local obj = minetest.env:add_entity({x=playerpos.x-4,y=playerpos.y+7,z=playerpos.z+4}, "hyruletools:stone") + local obj = minetest.env:add_entity({x=playerpos.x+math.random(-5,5),y=playerpos.y+7,z=playerpos.z+math.random(-5,5)}, "hyruletools:stone") local vec = {x=0,y=-13,z=0} obj:setvelocity(vec) end) - end) - end) - end) - end) - end) - end) + end + end return itemstack end, @@ -1393,91 +1653,83 @@ minetest.register_tool("hyruletools:medallion3", { minetest.sound_play("flamearrow", {pos=playerpos, gain=0.7, max_hear_distance=15}) --particles - minetest.add_particlespawner( - 12, --amount - 1, --time - {x=playerpos.x, y=playerpos.y+1, z=playerpos.z-3}, - {x=playerpos.x, y=playerpos.y+1, z=playerpos.z-3}, - {x=0, y=4, z=0}, --minvel - {x=0, y=4, z=0}, --maxvel - {x=0,y=1,z=0}, --minacc - {x=0,y=1,z=0}, --maxacc - 1, --minexptime - 1, --maxexptime - 10, --minsize - 10, --maxsize - false, --collisiondetection - "hyruletools_firestack.png" --texture - ) - minetest.add_particlespawner( - 12, --amount - 1, --time - {x=playerpos.x, y=playerpos.y+1, z=playerpos.z+3}, - {x=playerpos.x, y=playerpos.y+1, z=playerpos.z+3}, - {x=0, y=4, z=0}, --minvel - {x=0, y=4, z=0}, --maxvel - {x=0,y=1,z=0}, --minacc - {x=0,y=1,z=0}, --maxacc - 1, --minexptime - 1, --maxexptime - 10, --minsize - 10, --maxsize - false, --collisiondetection - "hyruletools_firestack.png" --texture - ) - - minetest.add_particlespawner( - 12, --amount - 1, --time - {x=playerpos.x-3, y=playerpos.y+1, z=playerpos.z}, - {x=playerpos.x-3, y=playerpos.y+1, z=playerpos.z}, - {x=0, y=4, z=0}, --minvel - {x=0, y=4, z=0}, --maxvel - {x=0,y=1,z=0}, --minacc - {x=0,y=1,z=0}, --maxacc - 1, --minexptime - 1, --maxexptime - 10, --minsize - 10, --maxsize - false, --collisiondetection - "hyruletools_firestack.png" --texture - ) - - minetest.add_particlespawner( - 12, --amount - 1, --time - {x=playerpos.x+3, y=playerpos.y+1, z=playerpos.z}, - {x=playerpos.x+3, y=playerpos.y+1, z=playerpos.z}, - {x=0, y=4, z=0}, --minvel - {x=0, y=4, z=0}, --maxvel - {x=0,y=1,z=0}, --minacc - {x=0,y=1,z=0}, --maxacc - 1, --minexptime - 1, --maxexptime - 10, --minsize - 10, --maxsize - false, --collisiondetection - "hyruletools_firestack.png" --texture - ) + for i=1,12 do + minetest.after(i*0.1, function() + minetest.add_particle({ + pos = {x=playerpos.x, y=playerpos.y+1, z=playerpos.z-3}, + velocity = {x=0, y=4, z=0}, + acceleration = {x=0, y=1, z=0}, + expirationtime = 1, + size = 10, + collisiondetection = false, + collisionremoval = false, + vertical = true, + texture = "hyruletools_firestack.png", + animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 1.00}, + glow = 9 + }) + minetest.add_particle({ + pos = {x=playerpos.x, y=playerpos.y+1, z=playerpos.z+3}, + velocity = {x=0, y=4, z=0}, + acceleration = {x=0, y=1, z=0}, + expirationtime = 1, + size = 10, + collisiondetection = false, + collisionremoval = false, + vertical = true, + texture = "hyruletools_firestack.png", + animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 1.00}, + glow = 9 + }) + minetest.add_particle({ + pos = {x=playerpos.x-3, y=playerpos.y+1, z=playerpos.z}, + velocity = {x=0, y=4, z=0}, + acceleration = {x=0, y=1, z=0}, + expirationtime = 1, + size = 10, + collisiondetection = false, + collisionremoval = false, + vertical = true, + texture = "hyruletools_firestack.png", + animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 1.00}, + glow = 9 + }) + minetest.add_particle({ + pos = {x=playerpos.x+3, y=playerpos.y+1, z=playerpos.z}, + velocity = {x=0, y=4, z=0}, + acceleration = {x=0, y=1, z=0}, + expirationtime = 1, + size = 10, + collisiondetection = false, + collisionremoval = false, + vertical = true, + texture = "hyruletools_firestack.png", + animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 1.00}, + glow = 9 + }) + end) + end minetest.after(1, function() - minetest.add_particlespawner( - 64, --amount - 3, --time - {x=playerpos.x-4, y=playerpos.y+1, z=playerpos.z-4}, - {x=playerpos.x+4, y=playerpos.y+1.5, z=playerpos.z+4}, - {x=0, y=4, z=0}, --minvel - {x=0, y=8, z=0}, --maxvel - {x=0,y=1,z=0}, --minacc - {x=0,y=1,z=0}, --maxacc - 0.1, --minexptime - 0.2, --maxexptime - 5, --minsize - 10, --maxsize - false, --collisiondetection - "hyruletools_bombeffect.png" --texture - ) + + for i=1,30 do + minetest.after(i*0.1, function() + minetest.add_particle({ + pos = {x=playerpos.x+math.random(-4,4), y=playerpos.y+1, z=playerpos.z+math.random(-4,4)}, + velocity = {x=0, y=4, z=0}, + acceleration = {x=0, y=math.random(1,8), z=0}, + expirationtime = 0.3, + size = math.random(5,9), + collisiondetection = false, + collisionremoval = false, + vertical = true, + texture = "hyruletools_bombeffect.png", + animation = {type = "vertical_frames", aspect_w = 20, aspect_h = 20, length = 0.50}, + glow = 9 + }) + end) + end tnt.boom({x=playerpos.x, y=playerpos.y+1, z=playerpos.z+4}, {damage_radius=3,radius=1,ignore_protection=false, disable_playerdamage=true}) minetest.after(0.2, function() @@ -1511,22 +1763,22 @@ minetest.register_tool("hyruletools:pendant1", { on_use = function(itemstack, placer, pointed_thing) local dir = placer:get_look_dir(); local playerpos = placer:getpos(); - minetest.add_particlespawner( - 5, --amount - 0.1, --time - {x=playerpos.x-1, y=playerpos.y, z=playerpos.z-1}, --minpos - {x=playerpos.x+1, y=playerpos.y, z=playerpos.z+1}, --maxpos - {x=-0, y=-0, z=-0}, --minvel - {x=0, y=0, z=0}, --maxvel - {x=-0.5,y=4,z=-0.5}, --minacc - {x=0.5,y=4,z=0.5}, --maxacc - 0.5, --minexptime - 1, --maxexptime - 8, --minsize - 10, --maxsize - false, --collisiondetection - "hyruletools_powder2.png" --texture - ) + for i=1,5 do + minetest.after(i*0.02, function() + minetest.add_particle({ + pos = {x=playerpos.x+math.random(-1,1), y=playerpos.y, z=playerpos.z+math.random(-1,1)}, + velocity = {x=0, y=0, z=0}, + acceleration = {x=math.random(-5,5)/10, y=4, z=math.random(-5,5)/10}, + expirationtime = math.random(5,10)/10, + size = math.random(8,10), + collisiondetection = false, + collisionremoval = false, + vertical = false, + texture = "hyruletools_powder2.png", + glow = 9 + }) + end) + end end, light_source = 12, }) @@ -1537,22 +1789,22 @@ minetest.register_tool("hyruletools:pendant2", { on_use = function(itemstack, placer, pointed_thing) local dir = placer:get_look_dir(); local playerpos = placer:getpos(); - minetest.add_particlespawner( - 5, --amount - 0.1, --time - {x=playerpos.x-1, y=playerpos.y, z=playerpos.z-1}, --minpos - {x=playerpos.x+1, y=playerpos.y, z=playerpos.z+1}, --maxpos - {x=-0, y=-0, z=-0}, --minvel - {x=0, y=0, z=0}, --maxvel - {x=-0.5,y=4,z=-0.5}, --minacc - {x=0.5,y=4,z=0.5}, --maxacc - 0.5, --minexptime - 1, --maxexptime - 8, --minsize - 10, --maxsize - false, --collisiondetection - "hyruletools_powder3.png" --texture - ) + for i=1,5 do + minetest.after(i*0.02, function() + minetest.add_particle({ + pos = {x=playerpos.x+math.random(-1,1), y=playerpos.y, z=playerpos.z+math.random(-1,1)}, + velocity = {x=0, y=0, z=0}, + acceleration = {x=math.random(-5,5)/10, y=4, z=math.random(-5,5)/10}, + expirationtime = math.random(5,10)/10, + size = math.random(8,10), + collisiondetection = false, + collisionremoval = false, + vertical = false, + texture = "hyruletools_powder3.png", + glow = 9 + }) + end) + end end, light_source = 12, }) @@ -1563,22 +1815,22 @@ minetest.register_tool("hyruletools:pendant3", { on_use = function(itemstack, placer, pointed_thing) local dir = placer:get_look_dir(); local playerpos = placer:getpos(); - minetest.add_particlespawner( - 5, --amount - 0.1, --time - {x=playerpos.x-1, y=playerpos.y, z=playerpos.z-1}, --minpos - {x=playerpos.x+1, y=playerpos.y, z=playerpos.z+1}, --maxpos - {x=-0, y=-0, z=-0}, --minvel - {x=0, y=0, z=0}, --maxvel - {x=-0.5,y=4,z=-0.5}, --minacc - {x=0.5,y=4,z=0.5}, --maxacc - 0.5, --minexptime - 1, --maxexptime - 8, --minsize - 10, --maxsize - false, --collisiondetection - "hyruletools_powder4.png" --texture - ) + for i=1,5 do + minetest.after(i*0.02, function() + minetest.add_particle({ + pos = {x=playerpos.x+math.random(-1,1), y=playerpos.y, z=playerpos.z+math.random(-1,1)}, + velocity = {x=0, y=0, z=0}, + acceleration = {x=math.random(-5,5)/10, y=4, z=math.random(-5,5)/10}, + expirationtime = math.random(5,10)/10, + size = math.random(8,10), + collisiondetection = false, + collisionremoval = false, + vertical = false, + texture = "hyruletools_powder4.png", + glow = 9 + }) + end) + end end, light_source = 12, }) @@ -1586,7 +1838,7 @@ minetest.register_tool("hyruletools:pendant3", { --mobs redo arrow code, see mobs license minetest.register_entity("hyruletools:swdspark", { - textures = {"hyruletools_swdbeam.png"}, + textures = {"hyrule_mapgen_trans.png"}, velocity = 15, damage = 2, collisionbox = {0, 0, 0, 0, 0, 0}, @@ -1609,29 +1861,25 @@ minetest.register_entity("hyruletools:swdspark", { end local apos = self.object:getpos() local velo = self.object:getvelocity() - local part = minetest.add_particlespawner( - 1, --amount - 0.3, --time - {x=apos.x-0, y=apos.y-0, z=apos.z-0}, --minpos - {x=apos.x+0, y=apos.y+0, z=apos.z+0}, --maxpos - {x=-velo.x/2, y=-velo.y/2, z=-velo.z/2}, --minvel - {x=-velo.x/2, y=-velo.y/2, z=-velo.z/2}, --maxvel - {x=0,y=-0,z=0}, --minacc - {x=0,y=0,z=0}, --maxacc - 0.1, --minexptime - 0.2, --maxexptime - 8, --minsize - 8, --maxsize - false, --collisiondetection - "hyruletools_swdbeam.png" --texture - ) + minetest.add_particle({ + pos = {x=apos.x, y=apos.y, z=apos.z}, + velocity = {x=-velo.x/2, y=-velo.y/2, z=-velo.z/2}, + acceleration = {x=0, y=0, z=0}, + expirationtime = 0.1, + size = 8, + collisiondetection = false, + collisionremoval = false, + vertical = false, + texture = "hyruletools_swdbeam_trail.png", + glow = 9 + }) end, }) --master sword, an edit of Mese sword(see liscence for default) minetest.register_tool("hyruletools:sword", { description = "Master Sword", - inventory_image = "mastersword_sword.png", + inventory_image = "hyruletools_mastersword_incomplete.png", wield_scale = {x = 1.5, y = 1.5, z = 1}, tool_capabilities = { full_punch_interval = 0.7, @@ -1644,8 +1892,8 @@ minetest.register_tool("hyruletools:sword", { on_use = function(itemstack, placer, pointed_thing) local name = placer:get_player_name() if mana.subtract(name, 5) then - local dir = placer:get_look_dir(); - local playerpos = placer:getpos(); + local dir = placer:get_look_dir() + local playerpos = placer:getpos() local obj = minetest.env:add_entity({x=playerpos.x+dir.x,y=playerpos.y+1.5+dir.y,z=playerpos.z+0+dir.z}, "hyruletools:swdspark") local vec = {x=dir.x*6,y=dir.y*6,z=dir.z*6} obj:setvelocity(vec) @@ -1654,6 +1902,27 @@ minetest.register_tool("hyruletools:sword", { end, }) +minetest.register_craftitem("hyruletools:crest", { + description = "Hylian Crest", + inventory_image = "hyruletools_crest.png", + wield_scale = {x = 1.5, y = 1.5, z = 1}, +}) + +minetest.register_tool("hyruletools:sword_complete", { + description = "True Master Sword", + inventory_image = "mastersword_sword.png", + wield_scale = {x = 1.5, y = 1.5, z = 1}, + tool_capabilities = { + full_punch_interval = 0.7, + max_drop_level=1, + groupcaps={ + snappy={times={[1]=2.0, [2]=1.00, [3]=0.35}, uses=30, maxlevel=3}, + }, + damage_groups = {fleshy=5}, + }, + range = 5, +}) + --mobs redo arrow code, see mobs license minetest.register_entity("hyruletools:swdspark_light", { @@ -1679,22 +1948,23 @@ minetest.register_entity("hyruletools:swdspark_light", { end end local apos = self.object:getpos() - local part = minetest.add_particlespawner( - 1, --amount - 0.3, --time - {x=apos.x-0.3, y=apos.y-0.3, z=apos.z-0.3}, --minpos - {x=apos.x+0.3, y=apos.y+0.3, z=apos.z+0.3}, --maxpos - {x=-0, y=-0, z=-0}, --minvel - {x=0, y=0, z=0}, --maxvel - {x=0,y=-0.5,z=0}, --minacc - {x=0.5,y=0.5,z=0.5}, --maxacc - 0.5, --minexptime - 1, --maxexptime - 1, --minsize - 2, --maxsize - false, --collisiondetection - "hyruletools_swdbeam_trail_light.png" --texture - ) + local velo = self.object:getvelocity() + for i=1,5 do + minetest.after(i*0.1, function() + minetest.add_particle({ + pos = {x=apos.x, y=apos.y, z=apos.z}, + velocity = {x=-velo.x/2, y=-velo.y/2, z=-velo.z/2}, + acceleration = {x=0, y=0, z=0}, + expirationtime = 0.1, + size = 8, + collisiondetection = false, + collisionremoval = false, + vertical = false, + texture = "hyruletools_swdbeam_light.png", + glow = 9 + }) + end) + end end, }) @@ -1793,6 +2063,14 @@ minetest.register_craft({ } }) +minetest.register_craft({ + output = 'hyruletools:sword_complete', + recipe = { + {'hyruletools:crest'}, + {'hyruletools:sword'}, + } +}) + minetest.register_craftitem("hyruletools:seed_satchel", { description = "Seed Bag(empty)", inventory_image = "hyruletools_seedbag.png" @@ -1984,7 +2262,8 @@ minetest.register_craftitem("hyruletools:seed_gale", { on_use = function(item, user, pointed_thing) local player = user:get_player_name() if minetest.setting_getbool("enable_weather") then - weather.state = "dust" + hyrule_weather.weather = "pollen" + hyrule_weather.current = 4 else minetest.chat_send_player(player, "weather not enabled!") end @@ -2175,22 +2454,22 @@ minetest.register_entity("hyruletools:sboomer", { end end local apos = self.object:getpos() - local part = minetest.add_particlespawner( - 1, --amount - 0.3, --time - {x=apos.x-0.3, y=apos.y-0.3, z=apos.z-0.3}, --minpos - {x=apos.x+0.3, y=apos.y+0.3, z=apos.z+0.3}, --maxpos - {x=-0, y=-0, z=-0}, --minvel - {x=0, y=0, z=0}, --maxvel - {x=0,y=-0.5,z=0}, --minacc - {x=0.5,y=0.5,z=0.5}, --maxacc - 0.5, --minexptime - 1, --maxexptime - 0.5, --minsize - 1, --maxsize - false, --collisiondetection - "hyruletools_star.png" --texture - ) + for i=1,3 do + minetest.after(i*0.1, function() + minetest.add_particle({ + pos = {x=apos.x, y=apos.y, z=apos.z}, + velocity = {x=0, y=0, z=0}, + acceleration = {x=0, y=math.random(-5,5)/10, z=0}, + expirationtime = math.random(5,10)/10, + size = math.random(5,10)/10, + collisiondetection = false, + collisionremoval = false, + vertical = false, + texture = "hyruletools_star.png", + glow = 9 + }) + end) + end end, }) @@ -3539,6 +3818,29 @@ minetest.register_craft({ } }) +minetest.register_tool("hyruletools:obsidian_sword", { + description = "Dark Sword", + inventory_image = "hyruletools_obsidian_sword.png", + wield_scale = {x = 1.5, y = 1.5, z = 1}, + tool_capabilities = { + full_punch_interval = 0.7, + max_drop_level=1, + groupcaps={ + snappy={times={[1]=2.0, [2]=1.00, [3]=0.35}, uses=20, maxlevel=4}, + }, + damage_groups = {fleshy=5}, + } +}) + +minetest.register_craft({ + output = 'hyruletools:obsidian_sword', + recipe = { + {'default:obsidian_shard'}, + {'default:obsidian_shard'}, + {'default:stick'}, + } +}) + --letters from default books Originally by celeron55, Perttu Ahola (LGPL 2.1) --Various Minetest developers and contributors (LGPL 2.1) diff --git a/mods/hyruletools/schematics/moldorms_lair.mts b/mods/hyruletools/schematics/moldorms_lair.mts new file mode 100644 index 0000000..ffd2ea3 Binary files /dev/null and b/mods/hyruletools/schematics/moldorms_lair.mts differ diff --git a/mods/hyruletools/textures/hyruletools_beacon.png b/mods/hyruletools/textures/hyruletools_beacon.png new file mode 100644 index 0000000..1285759 Binary files /dev/null and b/mods/hyruletools/textures/hyruletools_beacon.png differ diff --git a/mods/hyruletools/textures/hyruletools_beacon_box.png b/mods/hyruletools/textures/hyruletools_beacon_box.png new file mode 100644 index 0000000..e849747 Binary files /dev/null and b/mods/hyruletools/textures/hyruletools_beacon_box.png differ diff --git a/mods/hyruletools/textures/hyruletools_beacon_boxb.png b/mods/hyruletools/textures/hyruletools_beacon_boxb.png new file mode 100644 index 0000000..59a20d6 Binary files /dev/null and b/mods/hyruletools/textures/hyruletools_beacon_boxb.png differ diff --git a/mods/hyruletools/textures/hyruletools_beacon_center.png b/mods/hyruletools/textures/hyruletools_beacon_center.png new file mode 100644 index 0000000..fc12618 Binary files /dev/null and b/mods/hyruletools/textures/hyruletools_beacon_center.png differ diff --git a/mods/hyruletools/textures/hyruletools_beacon_centerb.png b/mods/hyruletools/textures/hyruletools_beacon_centerb.png new file mode 100644 index 0000000..823953a Binary files /dev/null and b/mods/hyruletools/textures/hyruletools_beacon_centerb.png differ diff --git a/mods/hyruletools/textures/hyruletools_beaconb.png b/mods/hyruletools/textures/hyruletools_beaconb.png new file mode 100644 index 0000000..e82d610 Binary files /dev/null and b/mods/hyruletools/textures/hyruletools_beaconb.png differ diff --git a/mods/hyruletools/textures/hyruletools_bombeffect.png b/mods/hyruletools/textures/hyruletools_bombeffect.png index e2cfe3d..41ad48e 100644 Binary files a/mods/hyruletools/textures/hyruletools_bombeffect.png and b/mods/hyruletools/textures/hyruletools_bombeffect.png differ diff --git a/mods/hyruletools/textures/hyruletools_climbing_gloves.png b/mods/hyruletools/textures/hyruletools_climbing_gloves.png new file mode 100644 index 0000000..e3ecf6a Binary files /dev/null and b/mods/hyruletools/textures/hyruletools_climbing_gloves.png differ diff --git a/mods/hyruletools/textures/hyruletools_crest.png b/mods/hyruletools/textures/hyruletools_crest.png new file mode 100644 index 0000000..ffc8aae Binary files /dev/null and b/mods/hyruletools/textures/hyruletools_crest.png differ diff --git a/mods/hyruletools/textures/hyruletools_crest_block.png b/mods/hyruletools/textures/hyruletools_crest_block.png new file mode 100644 index 0000000..df4dbe2 Binary files /dev/null and b/mods/hyruletools/textures/hyruletools_crest_block.png differ diff --git a/mods/hyruletools/textures/hyruletools_crest_block2.png b/mods/hyruletools/textures/hyruletools_crest_block2.png new file mode 100644 index 0000000..c8383cb Binary files /dev/null and b/mods/hyruletools/textures/hyruletools_crest_block2.png differ diff --git a/mods/hyruletools/textures/hyruletools_dungeon_spawner.png b/mods/hyruletools/textures/hyruletools_dungeon_spawner.png new file mode 100644 index 0000000..4fc9b7c Binary files /dev/null and b/mods/hyruletools/textures/hyruletools_dungeon_spawner.png differ diff --git a/mods/hyruletools/textures/hyruletools_dungeon_spawner2.png b/mods/hyruletools/textures/hyruletools_dungeon_spawner2.png new file mode 100644 index 0000000..92e1f5c Binary files /dev/null and b/mods/hyruletools/textures/hyruletools_dungeon_spawner2.png differ diff --git a/mods/hyruletools/textures/hyruletools_firestack.png b/mods/hyruletools/textures/hyruletools_firestack.png index eb36fce..793e402 100644 Binary files a/mods/hyruletools/textures/hyruletools_firestack.png and b/mods/hyruletools/textures/hyruletools_firestack.png differ diff --git a/mods/hyruletools/textures/hyruletools_goddess_longsword.png b/mods/hyruletools/textures/hyruletools_goddess_longsword.png new file mode 100644 index 0000000..86cefb6 Binary files /dev/null and b/mods/hyruletools/textures/hyruletools_goddess_longsword.png differ diff --git a/mods/hyruletools/textures/hyruletools_goddess_sword.png b/mods/hyruletools/textures/hyruletools_goddess_sword.png new file mode 100644 index 0000000..206e177 Binary files /dev/null and b/mods/hyruletools/textures/hyruletools_goddess_sword.png differ diff --git a/mods/hyruletools/textures/hyruletools_goddess_white_sword.png b/mods/hyruletools/textures/hyruletools_goddess_white_sword.png new file mode 100644 index 0000000..aeadbdd Binary files /dev/null and b/mods/hyruletools/textures/hyruletools_goddess_white_sword.png differ diff --git a/mods/hyruletools/textures/hyruletools_goron_tunic.png b/mods/hyruletools/textures/hyruletools_goron_tunic.png index 324ac5a..6482cc4 100644 Binary files a/mods/hyruletools/textures/hyruletools_goron_tunic.png and b/mods/hyruletools/textures/hyruletools_goron_tunic.png differ diff --git a/mods/hyruletools/textures/hyruletools_lantern.png b/mods/hyruletools/textures/hyruletools_lantern.png index b485a49..f462628 100644 Binary files a/mods/hyruletools/textures/hyruletools_lantern.png and b/mods/hyruletools/textures/hyruletools_lantern.png differ diff --git a/mods/hyruletools/textures/hyruletools_lightning2.png b/mods/hyruletools/textures/hyruletools_lightning2.png index b17186f..44388af 100644 Binary files a/mods/hyruletools/textures/hyruletools_lightning2.png and b/mods/hyruletools/textures/hyruletools_lightning2.png differ diff --git a/mods/hyruletools/textures/hyruletools_mastersword_incomplete.png b/mods/hyruletools/textures/hyruletools_mastersword_incomplete.png new file mode 100644 index 0000000..2ddacc6 Binary files /dev/null and b/mods/hyruletools/textures/hyruletools_mastersword_incomplete.png differ diff --git a/mods/hyruletools/textures/hyruletools_obsidian_sword.png b/mods/hyruletools/textures/hyruletools_obsidian_sword.png new file mode 100644 index 0000000..2febb8c Binary files /dev/null and b/mods/hyruletools/textures/hyruletools_obsidian_sword.png differ diff --git a/mods/hyruletools/textures/hyruletools_swdbeam_light.png b/mods/hyruletools/textures/hyruletools_swdbeam_light.png index c789ca1..c4a532b 100644 Binary files a/mods/hyruletools/textures/hyruletools_swdbeam_light.png and b/mods/hyruletools/textures/hyruletools_swdbeam_light.png differ diff --git a/mods/hyruletools/textures/hyruletools_swdbeam_trail.png b/mods/hyruletools/textures/hyruletools_swdbeam_trail.png index 0d2641f..2541f55 100644 Binary files a/mods/hyruletools/textures/hyruletools_swdbeam_trail.png and b/mods/hyruletools/textures/hyruletools_swdbeam_trail.png differ diff --git a/mods/hyruletools/textures/hyruletools_sword.png b/mods/hyruletools/textures/hyruletools_sword.png index 5fbcd55..5f96512 100644 Binary files a/mods/hyruletools/textures/hyruletools_sword.png and b/mods/hyruletools/textures/hyruletools_sword.png differ diff --git a/mods/hyruletools/textures/hyruletools_tool_obaxe.png b/mods/hyruletools/textures/hyruletools_tool_obaxe.png index 7d444b8..c17f4e6 100644 Binary files a/mods/hyruletools/textures/hyruletools_tool_obaxe.png and b/mods/hyruletools/textures/hyruletools_tool_obaxe.png differ diff --git a/mods/hyruletools/textures/hyruletools_zora_tunic.png b/mods/hyruletools/textures/hyruletools_zora_tunic.png index 191c10d..a23f4bc 100644 Binary files a/mods/hyruletools/textures/hyruletools_zora_tunic.png and b/mods/hyruletools/textures/hyruletools_zora_tunic.png differ diff --git a/mods/hyruletools/textures/mastersword_sword.png b/mods/hyruletools/textures/mastersword_sword.png index 1456b12..b9a383b 100644 Binary files a/mods/hyruletools/textures/mastersword_sword.png and b/mods/hyruletools/textures/mastersword_sword.png differ diff --git a/mods/hyruletools/textures/mastersword_sword_light.png b/mods/hyruletools/textures/mastersword_sword_light.png index 7062d3b..3746c84 100644 Binary files a/mods/hyruletools/textures/mastersword_sword_light.png and b/mods/hyruletools/textures/mastersword_sword_light.png differ diff --git a/mods/lightning/init.lua b/mods/lightning/init.lua index 1fa70a3..284dcd6 100644 --- a/mods/lightning/init.lua +++ b/mods/lightning/init.lua @@ -18,15 +18,15 @@ lightning.range_h = 100 lightning.range_v = 50 lightning.size = 100 -- disable this to stop lightning mod from striking -lightning.auto = true +lightning.auto = false local rng = PcgRandom(32321123312123) local ps = {} -local ttl = 1 +--local ttl = 1 local sky_set = false -local revertsky = function() +--[[local revertsky = function() if ttl == 0 then return end @@ -35,9 +35,9 @@ local revertsky = function() return end - if weather.state ~= "none" then - return - end + --if weather.state ~= "none" then + -- return + --end for key, entry in pairs(ps) do if not sky_set then @@ -48,9 +48,9 @@ local revertsky = function() end ps = {} -end +end]] -minetest.register_globalstep(revertsky) +--minetest.register_globalstep(revertsky) -- select a random strike point, midpoint local function choose_pos(pos) @@ -106,27 +106,19 @@ lightning.strike = function(pos) if not pos then return false end - - minetest.add_particlespawner({ - amount = 1, - time = 0.2, - -- make it hit the top of a block exactly with the bottom - minpos = {x = pos2.x, y = pos2.y + (lightning.size / 2) + 1/2, z = pos2.z }, - maxpos = {x = pos2.x, y = pos2.y + (lightning.size / 2) + 1/2, z = pos2.z }, - minvel = {x = 0, y = 0, z = 0}, - maxvel = {x = 0, y = 0, z = 0}, - minacc = {x = 0, y = 0, z = 0}, - maxacc = {x = 0, y = 0, z = 0}, - minexptime = 0.2, - maxexptime = 0.2, - minsize = lightning.size * 10, - maxsize = lightning.size * 10, - collisiondetection = true, - vertical = true, - -- to make it appear hitting the node that will get set on fire, make sure - -- to make the texture lightning bolt hit exactly in the middle of the - -- texture (e.g. 127/128 on a 256x wide texture) - texture = "lightning_lightning_" .. rng:next(1,3) .. ".png", + + + minetest.add_particle({ + pos = {x = pos2.x, y = pos2.y + (lightning.size / 2) + 1/2, z = pos2.z }, + velocity = {x = 0, y = 0, z = 0}, + acceleration = {x = 0, y = 0, z = 0}, + expirationtime = 0.2, + size = lightning.size * 10, + collisiondetection = true, + collision_removal = false, + vertical = true, + texture = "lightning_lightning_" .. rng:next(1,3) .. ".png", + glow = 10 }) minetest.sound_play({ pos = pos, name = "lightning_thunder", gain = 10, max_hear_distance = 500 }) @@ -148,11 +140,20 @@ lightning.strike = function(pos) if ps[name] == nil then ps[name] = {p = player, sky = sky} player:set_sky(0xffffff, "plain", {}) + minetest.after(0.3, function() + if player ~= nil then + if minetest.get_timeofday()*24000 >= 6000 and minetest.get_timeofday()*24000 <= 19000 then + player:set_sky({r=111, g=111, b=111}, "plain", nil, true) + else + player:set_sky(nil, "regular", nil, true) + end + end + end) end end - + -- trigger revert of skybox - ttl = 5 + --ttl = 5 -- set the air node above it on fire pos2.y = pos2.y + 1/2 diff --git a/mods/mana/init.lua b/mods/mana/init.lua index 7c7694a..8687600 100644 --- a/mods/mana/init.lua +++ b/mods/mana/init.lua @@ -22,7 +22,7 @@ mana.playerlist = {} mana.settings = {} mana.settings.default_max = 200 mana.settings.default_regen = 1 -mana.settings.regen_timer = 0.4 +mana.settings.regen_timer = 1 do local default_max = tonumber(minetest.setting_get("mana_default_max")) @@ -230,8 +230,8 @@ minetest.register_on_joinplayer(function(player) mana.setmax(playername, 200) player:hud_add({ hud_elem_type = "statbar", - position = {x=0.842,y=0.02}, - size = {x=248, y=34}, + position = {x=0.992,y=0.02}, + size = {x=247, y=34}, text = "hud_mana_bg.png", number = 2.1, alignment = {x=0,y=1}, @@ -240,7 +240,7 @@ minetest.register_on_joinplayer(function(player) ) mana_hud = player:hud_add({ hud_elem_type = "statbar", - position = {x=0.847,y=0.02}, + position = {x=0.994,y=0.02}, size = {x=24, y=34}, text = "hud_mana.png", number = mana.get(playername)/10, diff --git a/mods/mobs_animal/textures/mobs_cucco_chick.png b/mods/mobs_animal/textures/mobs_cucco_chick.png new file mode 100644 index 0000000..1950655 Binary files /dev/null and b/mods/mobs_animal/textures/mobs_cucco_chick.png differ diff --git a/mods/mobs_fairy/init.lua b/mods/mobs_fairy/init.lua index c23dcdb..7100f22 100644 --- a/mods/mobs_fairy/init.lua +++ b/mods/mobs_fairy/init.lua @@ -28,22 +28,18 @@ if mobs.mod and mobs.mod == "redo" then stepheight = 10, do_custom = function(self, pos) local pos = self.object:getpos() - minetest.add_particlespawner( - 1, --amount - 1, --time - {x=pos.x-0.1, y=pos.y, z=pos.z-0.1}, --minpos - {x=pos.x+0.1, y=pos.y, z=pos.z+0.1}, --maxpos - {x=-0, y=-0, z=-0}, --minvel - {x=0, y=0, z=0}, --maxvel - {x=-0.2,y=-0.2,z=-0.2}, --minacc - {x=0.2,y=-0.5,z=0.2}, --maxacc - 0.5, --minexptime - 1, --maxexptime - 1, --minsize - 2, --maxsize - false, --collisiondetection - "mobs_fairy_spark.png" --texture - ) + minetest.add_particle({ + pos = {x=pos.x+math.random(-1,1)/10, y=pos.y, z=pos.z+math.random(-1,1)/10}, + velocity = {x=0, y=0, z=0}, + acceleration = {x=math.random(-2,2)/10, y=math.random(-2,-5)/10, z=math.random(-2,2)/10}, + expirationtime = math.random(5,10)/10, + size = math.random(1,2), + collisiondetection = false, + collisionremoval = false, + vertical = false, + texture = "mobs_fairy_spark.png", + glow = 9 + }) local objs = minetest.env:get_objects_inside_radius(pos, 1.5) for _, obj in pairs(objs) do diff --git a/mods/mobs_loz/armos.lua b/mods/mobs_loz/armos.lua index c14f27e..e943c1d 100644 --- a/mods/mobs_loz/armos.lua +++ b/mods/mobs_loz/armos.lua @@ -7,7 +7,7 @@ mobs:register_mob("mobs_loz:armos", { damage = 3, hp_min = 10, hp_max = 27, - armor = 90, + armor = 100, collisionbox = {-0.5, 0, -0.5, 0.5, 1.5, 0.5}, visual = "mesh", mesh = "armos.b3d", diff --git a/mods/mobs_loz/biri.lua b/mods/mobs_loz/biri.lua index fa671a2..99627ed 100644 --- a/mods/mobs_loz/biri.lua +++ b/mods/mobs_loz/biri.lua @@ -6,12 +6,13 @@ mobs:register_mob("mobs_loz:biri", { attack_type = "dogfight", hp_min = 10, hp_max = 25, - armor = 90, + armor = 130, collisionbox = {-0.4, 0, -0.4, 0.4, 1, 0.4}, visual = "mesh", mesh = "biri.b3d", textures = { {"mobs_biri.png"}, + {"mobs_biri2.png"}, }, makes_footstep_sound = false, view_range = 5, diff --git a/mods/mobs_loz/bongobongo.lua b/mods/mobs_loz/bongobongo.lua index f7255ac..e524b76 100644 --- a/mods/mobs_loz/bongobongo.lua +++ b/mods/mobs_loz/bongobongo.lua @@ -93,22 +93,22 @@ mobs:register_mob("mobs_loz:bongobongo", { shoot_end = 25, }, on_die = function(self, pos) - minetest.add_particlespawner( - 10, --amount - 1, --time - {x=pos.x-1, y=pos.y-1, z=pos.z-1}, --minpos - {x=pos.x+1, y=pos.y-1, z=pos.z+1}, --maxpos - {x=-0, y=-0, z=-0}, --minvel - {x=0, y=0, z=0}, --maxvel - {x=-0.5,y=1,z=-0.5}, --minacc - {x=0.5,y=1,z=0.5}, --maxacc - 1, --minexptime - 1.5, --maxexptime - 20, --minsize - 25, --maxsize - false, --collisiondetection - "mobs_loz_light.png" --texture - ) + for i=1,10 do + minetest.after((i/10)+math.random(-9,9)/20, function() + minetest.add_particle({ + pos = {x=pos.x+math.random(-1,1), y=pos.y, z=pos.z+math.random(-1,1)}, + velocity = {x=0, y=0, z=0}, + acceleration = {x=math.random(-5,5)/10, y=1, z=math.random(-5,5)/10}, + expirationtime = math.random(10,15)/10, + size = math.random(20,25), + collisiondetection = false, + collisionremoval = false, + vertical = true, + texture = "mobs_loz_light.png", + glow = 9 + }) + end) + end minetest.set_node(pos, {name = "default:water_source"}) end, on_rightclick = function(self, clicker) diff --git a/mods/mobs_loz/business_scrub.lua b/mods/mobs_loz/business_scrub.lua index 6d97d2b..ea658da 100644 --- a/mods/mobs_loz/business_scrub.lua +++ b/mods/mobs_loz/business_scrub.lua @@ -7,7 +7,7 @@ mobs:register_mob("mobs_loz:business_scrub", { shoot_offset = 1.5, hp_min = 10, hp_max = 25, - armor = 90, + armor = 150, collisionbox = {-0.4, -0.1, -0.2, 0.2, 0.4, 0.2}, visual = "mesh", mesh = "business_scrub.b3d", diff --git a/mods/mobs_loz/chuchu.lua b/mods/mobs_loz/chuchu.lua index 950f18f..2345342 100644 --- a/mods/mobs_loz/chuchu.lua +++ b/mods/mobs_loz/chuchu.lua @@ -9,7 +9,7 @@ mobs:register_mob("mobs_loz:chuchu", { damage = 2, hp_min = 3, hp_max = 27, - armor = 100, + armor = 150, collisionbox = {-0.2, -0, -0.2, 0.2, 0.7, 0.2}, visual_size = {x=1.5, y=1.5}, visual = "mesh", diff --git a/mods/mobs_loz/darknut.lua b/mods/mobs_loz/darknut.lua index aef992b..992e2bf 100644 --- a/mods/mobs_loz/darknut.lua +++ b/mods/mobs_loz/darknut.lua @@ -9,7 +9,7 @@ mobs:register_mob("mobs_loz:darknut", { damage = 4, hp_min = 30, hp_max = 47, - armor = 80, + armor = 100, collisionbox = {-0.7, -0, -0.7, 0.7, 2, 0.7}, visual_size = {x=1.3, y=1.3}, visual = "mesh", diff --git a/mods/mobs_loz/deku_baba.lua b/mods/mobs_loz/deku_baba.lua index 979feaf..5f307e5 100644 --- a/mods/mobs_loz/deku_baba.lua +++ b/mods/mobs_loz/deku_baba.lua @@ -5,16 +5,17 @@ mobs:register_mob("mobs_loz:deku_baba", { type = "monster", passive = false, attack_type = "dogfight", - reach = 2, + reach = 3.5, damage = 2, hp_min = 10, hp_max = 27, - armor = 95, + armor = 130, collisionbox = {-0.3, 0, -0.2, 0.2, 1.2, 0.2}, visual = "mesh", mesh = "dekubaba.b3d", textures = { {"mobs_dekubaba.png"}, + {"mobs_dekubaba2.png"}, }, blood_texture = "default_dry_grass.png", makes_footstep_sound = false, @@ -26,7 +27,7 @@ mobs:register_mob("mobs_loz:deku_baba", { run_velocity = 0.05, jump = false, drops = { - {name = "mobs_loz:deku_nut", + {name = "mobs_loz:nut", chance = 1, min = 1, max = 3}, }, on_die = function(self) @@ -42,7 +43,7 @@ mobs:register_mob("mobs_loz:deku_baba", { fear_height = 3, animation = { speed_normal = 12, - speed_run = 15, + speed_run = 30, stand_start = 1, stand_end = 19, walk_start = 1, diff --git a/mods/mobs_loz/deku_scrub.lua b/mods/mobs_loz/deku_scrub.lua index 21ffd5b..e398aa2 100644 --- a/mods/mobs_loz/deku_scrub.lua +++ b/mods/mobs_loz/deku_scrub.lua @@ -8,7 +8,7 @@ mobs:register_mob("mobs_loz:deku_scrub", { shoot_offset = 2, hp_min = 10, hp_max = 25, - armor = 90, + armor = 120, collisionbox = {-0.4, 0, -0.2, 0.2, 1, 0.2}, visual = "mesh", mesh = "deku_scrub.b3d", diff --git a/mods/mobs_loz/dodongo.lua b/mods/mobs_loz/dodongo.lua index 26aba47..1b68bc4 100644 --- a/mods/mobs_loz/dodongo.lua +++ b/mods/mobs_loz/dodongo.lua @@ -10,7 +10,7 @@ mobs:register_mob("mobs_loz:bdodongo", { damage = 1, hp_min = 12, hp_max = 25, - armor = 80, + armor = 160, collisionbox = {-0.2, 0, -0.2, 0.2, 0.4, 0.4}, visual = "mesh", mesh = "bdodongo.b3d", @@ -169,7 +169,7 @@ mobs:register_mob("mobs_loz:dodongo_boss", { damage = 3, hp_min = 82, hp_max = 125, - armor = 60, + armor = 80, collisionbox = {-2, 0, -2, 1.5, 4.5, 2}, visual = "mesh", mesh = "dodongo.b3d", @@ -198,6 +198,22 @@ mobs:register_mob("mobs_loz:dodongo_boss", { minetest.env:add_entity(pos, "experience:orb") minetest.env:add_entity(pos, "experience:orb") minetest.env:add_entity(pos, "experience:orb") + for i=1,10 do + minetest.after((i/10)+math.random(-9,9)/20, function() + minetest.add_particle({ + pos = {x=pos.x+math.random(-1,1), y=pos.y, z=pos.z+math.random(-1,1)}, + velocity = {x=0, y=0, z=0}, + acceleration = {x=math.random(-5,5)/10, y=1, z=math.random(-5,5)/10}, + expirationtime = math.random(10,15)/10, + size = math.random(20,25), + collisiondetection = false, + collisionremoval = false, + vertical = true, + texture = "mobs_loz_light.png", + glow = 9 + }) + end) + end end, water_damage = 5, lava_damage = 0, @@ -216,25 +232,6 @@ mobs:register_mob("mobs_loz:dodongo_boss", { shoot_start = 45, shoot_end = 65, }, - on_die = function(self, pos) - minetest.set_node(pos, {name = "fire:basic_flame"}) - minetest.add_particlespawner( - 10, --amount - 1, --time - {x=pos.x-1, y=pos.y-1, z=pos.z-1}, --minpos - {x=pos.x+1, y=pos.y-1, z=pos.z+1}, --maxpos - {x=-0, y=-0, z=-0}, --minvel - {x=0, y=0, z=0}, --maxvel - {x=-0.5,y=1,z=-0.5}, --minacc - {x=0.5,y=1,z=0.5}, --maxacc - 1, --minexptime - 1.5, --maxexptime - 20, --minsize - 25, --maxsize - false, --collisiondetection - "mobs_loz_light.png" --texture - ) - end, }) --mobs:register_spawn("mobs_loz:dodongo_boss", {"hyrule_mapgen:dodongo_spawn"}, 20, 0, 7000, 1, 31000) diff --git a/mods/mobs_loz/ganon.lua b/mods/mobs_loz/ganon.lua index 41ae69d..d498f88 100644 --- a/mods/mobs_loz/ganon.lua +++ b/mods/mobs_loz/ganon.lua @@ -91,44 +91,44 @@ mobs:register_mob("mobs_loz:ganon", { shoot_end = 36, }, on_die = function(self, pos) - minetest.add_particlespawner( - 10, --amount - 1, --time - {x=pos.x-1, y=pos.y-1, z=pos.z-1}, --minpos - {x=pos.x+1, y=pos.y-1, z=pos.z+1}, --maxpos - {x=-0, y=-0, z=-0}, --minvel - {x=0, y=0, z=0}, --maxvel - {x=-0.5,y=1,z=-0.5}, --minacc - {x=0.5,y=1,z=0.5}, --maxacc - 1, --minexptime - 1.5, --maxexptime - 20, --minsize - 25, --maxsize - false, --collisiondetection - "mobs_loz_light.png" --texture - ) + for i=1,10 do + minetest.after((i/10)+math.random(-9,9)/20, function() + minetest.add_particle({ + pos = {x=pos.x+math.random(-1,1), y=pos.y, z=pos.z+math.random(-1,1)}, + velocity = {x=0, y=0, z=0}, + acceleration = {x=math.random(-5,5)/10, y=1, z=math.random(-5,5)/10}, + expirationtime = math.random(10,15)/10, + size = math.random(20,25), + collisiondetection = false, + collisionremoval = false, + vertical = true, + texture = "mobs_loz_light.png", + glow = 9 + }) + end) + end end, do_custom = function(self) local pos = self.object:getpos() if minetest.find_node_near(pos, 10, {"hyrule_mapgen:ganon_sphere"}) then if self.health <= 100 then self.health = 200 - minetest.add_particlespawner( - 10, --amount - 1, --time - {x=pos.x-1, y=pos.y-1, z=pos.z-1}, --minpos - {x=pos.x+1, y=pos.y-1, z=pos.z+1}, --maxpos - {x=-0, y=-0, z=-0}, --minvel - {x=0, y=0, z=0}, --maxvel - {x=-0.5,y=1,z=-0.5}, --minacc - {x=0.5,y=1,z=0.5}, --maxacc - 1, --minexptime - 1.5, --maxexptime - 20, --minsize - 25, --maxsize - false, --collisiondetection - "mobs_loz_light.png^[colorize:red:100" --texture - ) + for i=1,10 do + minetest.after((i/10)+math.random(-9,9)/20, function() + minetest.add_particle({ + pos = {x=pos.x+math.random(-1,1), y=pos.y, z=pos.z+math.random(-1,1)}, + velocity = {x=0, y=0, z=0}, + acceleration = {x=math.random(-5,5)/10, y=1, z=math.random(-5,5)/10}, + expirationtime = math.random(10,15)/10, + size = math.random(20,25), + collisiondetection = false, + collisionremoval = false, + vertical = true, + texture = "mobs_loz_light.png^[colorize:red:100", + glow = 9 + }) + end) + end self.object:set_animation({x=85, y=105}, 12, 0) end end diff --git a/mods/mobs_loz/goron.lua b/mods/mobs_loz/goron.lua index cbe2490..85272f3 100644 --- a/mods/mobs_loz/goron.lua +++ b/mods/mobs_loz/goron.lua @@ -10,7 +10,7 @@ mobs:register_mob("mobs_loz:goron", { attack_type = "dogfight", hp_min = 10, hp_max = 25, - armor = 80, + armor = 100, collisionbox = {-0.4, 0, -0.4, 0.4, 1.5, 0.4}, visual = "mesh", mesh = "goron.b3d", diff --git a/mods/mobs_loz/hiploop.lua b/mods/mobs_loz/hiploop.lua index 134c043..5e93fed 100644 --- a/mods/mobs_loz/hiploop.lua +++ b/mods/mobs_loz/hiploop.lua @@ -6,7 +6,7 @@ mobs:register_mob("mobs_loz:hiploop", { damage = 5, hp_min = 10, hp_max = 20, - armor = 100, + armor = 140, collisionbox = {-0.3, 0, -0.3, 0.3, 0.5, 0.3}, visual = "mesh", mesh = "hiploop.b3d", diff --git a/mods/mobs_loz/keese.lua b/mods/mobs_loz/keese.lua index 62b2020..9b56da7 100644 --- a/mods/mobs_loz/keese.lua +++ b/mods/mobs_loz/keese.lua @@ -6,7 +6,7 @@ mobs:register_mob("mobs_loz:keese", { attack_type = "dogfight", hp_min = 5, hp_max = 10, - armor = 100, + armor = 170, collisionbox = {-0.2, 0, -0.2, 0.2, 0.5, 0.2}, visual = "mesh", mesh = "keese.b3d", diff --git a/mods/mobs_loz/leever.lua b/mods/mobs_loz/leever.lua index bf62e1d..7fe94b0 100644 --- a/mods/mobs_loz/leever.lua +++ b/mods/mobs_loz/leever.lua @@ -7,7 +7,7 @@ mobs:register_mob("mobs_loz:leever", { damage = 1, hp_min = 5, hp_max = 10, - armor = 100, + armor = 130, collisionbox = {-0.3, -0, -0.3, 0.3, 0.4, 0.3}, visual_size = {x=1, y=1}, visual = "mesh", diff --git a/mods/mobs_loz/madscrub.lua b/mods/mobs_loz/madscrub.lua index 575974d..582a7d1 100644 --- a/mods/mobs_loz/madscrub.lua +++ b/mods/mobs_loz/madscrub.lua @@ -12,7 +12,7 @@ mobs:register_mob("mobs_loz:mad_scrub", { shoot_offset = 1.5, hp_min = 30, hp_max = 35, - armor = 80, + armor = 130, collisionbox = {-0.4, 0, -0.4, 0.4, 0.5, 0.4}, visual = "mesh", mesh = "mad_scrub.b3d", diff --git a/mods/mobs_loz/midna.lua b/mods/mobs_loz/midna.lua index bc72749..4efef80 100644 --- a/mods/mobs_loz/midna.lua +++ b/mods/mobs_loz/midna.lua @@ -9,7 +9,6 @@ mobs:register_mob("mobs_loz:midna", { hp_min = 50, hp_max = 85, armor = 80, - owner = "", order = "follow", collisionbox = {-0.3, 0, -0.3, 0.3, 1.5, 0.3}, visual = "mesh", @@ -42,33 +41,20 @@ mobs:register_mob("mobs_loz:midna", { punch_end = 50, }, do_custom = function(self, dtime) + if math.random(1,4) ~= 1 then return end local pos = self.object:getpos() - minetest.add_particlespawner( - 1, --amount - 2, --time - {x=pos.x-0.3, y=pos.y-0.3, z=pos.z-0.3}, --minpos - {x=pos.x+1, y=pos.y+1, z=pos.z+1}, --maxpos - {x=0, y=0, z=0}, --minvel - {x=0, y=0, z=0}, --maxvel - {x=-0,y=0,z=-0}, --minacc - {x=0,y=1,z=0}, --maxacc - 1, --minexptime - 2, --maxexptime - 0.5, --minsize - 1, --maxsize - false, --collisiondetection - "mobs_particle.png" --texture - ) - end, - on_rightclick = function(self, clicker) - local player = clicker:get_player_name() - if self.order == "follow" then - self.order = "stand" - minetest.chat_send_player(player, "Midna is following") - else - self.order = "follow" - minetest.chat_send_player(player, "Midna is wandering") - end + minetest.add_particle({ + pos = {x=pos.x+math.random(-10,10)/10, y=pos.y+math.random(0,10)/10, z=pos.z+math.random(-10,10)/10}, + velocity = {x = math.random(-1,1)/10, y = 0.4, z = math.random(-1,1)/10}, + acceleration = {x = math.random(-1,1)/10, y=0.5, z = math.random(-1,1)/10}, + expirationtime = 0.8, + size = math.random(5, 20)/10, + collisiondetection = true, + collisionremoval = true, + vertical = true, + texture = "twilight_twilight"..math.random(1,2)..".png", + glow = 5 + }) end, }) diff --git a/mods/mobs_loz/mimic.lua b/mods/mobs_loz/mimic.lua index ffe3010..6e66e46 100644 --- a/mods/mobs_loz/mimic.lua +++ b/mods/mobs_loz/mimic.lua @@ -55,7 +55,7 @@ mobs:register_mob("mobs_loz:mimic", { damage = 3, hp_min = 10, hp_max = 27, - armor = 90, + armor = 130, collisionbox = {-0.5, 0, -0.5, 0.5, 1, 0.5}, visual = "mesh", mesh = "mimic.b3d", @@ -121,7 +121,7 @@ mobs:register_mob("mobs_loz:mimic2", { damage = 3, hp_min = 10, hp_max = 27, - armor = 90, + armor = 130, collisionbox = {-0.5, 0, -0.5, 0.5, 1, 0.5}, visual = "mesh", mesh = "mimic.b3d", diff --git a/mods/mobs_loz/models/zora_female.b3d b/mods/mobs_loz/models/zora_female.b3d new file mode 100644 index 0000000..3d75d08 Binary files /dev/null and b/mods/mobs_loz/models/zora_female.b3d differ diff --git a/mods/mobs_loz/models/zora.b3d b/mods/mobs_loz/models/zora_male.b3d similarity index 100% rename from mods/mobs_loz/models/zora.b3d rename to mods/mobs_loz/models/zora_male.b3d diff --git a/mods/mobs_loz/moldorm.lua b/mods/mobs_loz/moldorm.lua index 4a1b223..689efe8 100644 --- a/mods/mobs_loz/moldorm.lua +++ b/mods/mobs_loz/moldorm.lua @@ -7,7 +7,7 @@ mobs:register_mob("mobs_loz:moldorm", { damage = 1, hp_min = 10, hp_max = 15, - armor = 100, + armor = 150, collisionbox = {-0.5, -0, -0.5, 0.5, 1, 0.5}, visual = "mesh", mesh = "moldorm.b3d", @@ -50,4 +50,73 @@ mobs:register_mob("mobs_loz:moldorm", { }, }) -mobs:register_egg("mobs_loz:moldorm", "Moldorm", "mobs_zol.png", 1) \ No newline at end of file +mobs:register_egg("mobs_loz:moldorm", "Moldorm", "mobs_zol.png", 1) + +mobs:register_mob("mobs_loz:great_moldorm", { + type = "monster", + passive = false, + attack_type = "dogfight", + reach = 1, + damage = 1, + hp_min = 50, + hp_max = 60, + armor = 100, + collisionbox = {-0.9, -0, -0.9, 0.9, 1.5, 0.9}, + visual = "mesh", + mesh = "moldorm.b3d", + textures = { + {"mobs_great_moldorm.png"}, + }, + visual_size = {x=5.5, y=4.5}, + blood_texture = "mobs_slime.png", + makes_footstep_sound = true, + view_range = 5, + walk_velocity = 0.8, + run_velocity = 1.9, + jumpheight = 5, + drops = { + {name = "hyruletools:red_rupee", + chance = 4, min = 1, max = 1}, + }, + on_die = function(self) + local pos = self.object:getpos() + minetest.env:add_item(pos, "default:sword_bronze") + minetest.env:add_entity(pos, "experience:orb") + minetest.env:add_entity(pos, "experience:orb") + minetest.env:add_entity(pos, "experience:orb") + for i=1,10 do + minetest.after((i/10)+math.random(-9,9)/20, function() + minetest.add_particle({ + pos = {x=pos.x+math.random(-1,1), y=pos.y, z=pos.z+math.random(-1,1)}, + velocity = {x=0, y=0, z=0}, + acceleration = {x=math.random(-5,5)/10, y=1, z=math.random(-5,5)/10}, + expirationtime = math.random(10,15)/10, + size = math.random(20,25), + collisiondetection = false, + collisionremoval = false, + vertical = true, + texture = "mobs_loz_light.png", + glow = 9 + }) + end) + end + end, + water_damage = 0, + lava_damage = 0, + light_damage = 0, + fear_height = 5, + animation = { + speed_normal = 12, + speed_run = 15, + stand_start = 15, + stand_end = 28, + walk_start = 15, + walk_end = 28, + run_start = 1, + run_end = 14, + punch_start = 1, + punch_end = 14, + }, +}) + +mobs:register_egg("mobs_loz:great_moldorm", "Great Moldorm", "mobs_zol.png^[colorize:yellow:20", 1) \ No newline at end of file diff --git a/mods/mobs_loz/octorock.lua b/mods/mobs_loz/octorock.lua index 413064a..828351c 100644 --- a/mods/mobs_loz/octorock.lua +++ b/mods/mobs_loz/octorock.lua @@ -8,7 +8,7 @@ mobs:register_mob("mobs_loz:octorock", { shoot_offset = 1.2, hp_min = 20, hp_max = 35, - armor = 100, + armor = 150, collisionbox = {-0.5, 0, -0.5, 0.5, 0.8, 0.5}, visual_size = {x=1.5, y=1.5}, visual = "mesh", @@ -66,7 +66,7 @@ mobs:register_arrow("mobs_loz:octorock_rock", { if item ~= "shields:shield_steel" and item ~= "shields:shield_admin" and item ~= "shields:shield_bronze" and item ~= "shields:shield_wood" and item ~= "shields:shield_cactus" and item ~= "shields:shield_wood_enhanced" and item ~= "shields:shield_cactus_enhanced" then player:punch(self.object, 1.0, { full_punch_interval = 1.0, - damage_groups = {fleshy = 1}, + damage_groups = {fleshy = 2}, }, nil) end end, @@ -74,7 +74,7 @@ mobs:register_arrow("mobs_loz:octorock_rock", { hit_mob = function(self, player) player:punch(self.object, 1.0, { full_punch_interval = 1.0, - damage_groups = {fleshy = 1}, + damage_groups = {fleshy = 2}, }, nil) end, @@ -112,8 +112,8 @@ mobs:register_mob("mobs_loz:octorock_boss", { fall_speed = -6, stepheight = 3, drops = { - {name = "hyruletools:blue_rupee", - chance = 5, min = 5, max = 5}, + {name = "hyruletools:magglv_n", + chance = 1, min = 1, max = 1}, }, on_die = function(self) local pos = self.object:getpos() @@ -121,6 +121,22 @@ mobs:register_mob("mobs_loz:octorock_boss", { minetest.env:add_entity(pos, "hyruletools:heart_entity") end minetest.env:add_entity(pos, "experience:orb") + for i=1,10 do + minetest.after((i/10)+math.random(-9,9)/20, function() + minetest.add_particle({ + pos = {x=pos.x+math.random(-1,1), y=pos.y, z=pos.z+math.random(-1,1)}, + velocity = {x=0, y=0, z=0}, + acceleration = {x=math.random(-5,5)/10, y=1, z=math.random(-5,5)/10}, + expirationtime = math.random(10,15)/10, + size = math.random(20,25), + collisiondetection = false, + collisionremoval = false, + vertical = true, + texture = "mobs_loz_light.png", + glow = 9 + }) + end) + end end, water_damage = 1, lava_damage = 1, diff --git a/mods/mobs_loz/peahat.lua b/mods/mobs_loz/peahat.lua index 79ced15..5e4bc10 100644 --- a/mods/mobs_loz/peahat.lua +++ b/mods/mobs_loz/peahat.lua @@ -8,7 +8,7 @@ mobs:register_mob("mobs_loz:peahat", { attack_type = "dogfight", hp_min = 7, hp_max = 12, - armor = 130, + armor = 100, collisionbox = {-0.4, 0, -0.4, 0.4, 1.2, 0.4}, visual = "mesh", mesh = "peahat.b3d", @@ -23,7 +23,7 @@ mobs:register_mob("mobs_loz:peahat", { water_damage = 1, lava_damage = 2, light_damage = 0, - view_range = 10, + view_range = 25, drops = { {name = "hyruletools:blue_rupee", chance = 5, min = 1, max = 3}, diff --git a/mods/mobs_loz/redead.lua b/mods/mobs_loz/redead.lua index 272bb16..27a2c33 100644 --- a/mods/mobs_loz/redead.lua +++ b/mods/mobs_loz/redead.lua @@ -22,7 +22,7 @@ mobs:register_mob("mobs_loz:redead", { attack_type = "dogfight", hp_min = 20, hp_max = 30, - armor = 100, + armor = 150, collisionbox = {-0.4, -1, -0.4, 0.4, 0.7, 0.4}, visual = "mesh", mesh = "character.b3d", diff --git a/mods/mobs_loz/scrub.lua b/mods/mobs_loz/scrub.lua index aef2137..9f1d1b2 100644 --- a/mods/mobs_loz/scrub.lua +++ b/mods/mobs_loz/scrub.lua @@ -13,7 +13,7 @@ mobs:register_mob("mobs_loz:deku_scrub", { shoot_offset = 1.5, hp_min = 10, hp_max = 25, - armor = 80, + armor = 150, collisionbox = {-0.3, -0.5, -0.3, 0.3, 0, 0.3}, visual = "mesh", mesh = "scrub2.b3d", diff --git a/mods/mobs_loz/skulltula.lua b/mods/mobs_loz/skulltula.lua index 2feb620..50a6bc8 100644 --- a/mods/mobs_loz/skulltula.lua +++ b/mods/mobs_loz/skulltula.lua @@ -6,7 +6,7 @@ mobs:register_mob("mobs_loz:skulltula", { damage = 3, hp_min = 28, hp_max = 37, - armor = 90, + armor = 150, collisionbox = {-0.3, 0, -0.3, 0.3, 1, 0.3}, visual_size = {x=1.5, y=1.5}, visual = "mesh", diff --git a/mods/mobs_loz/stalchid.lua b/mods/mobs_loz/stalchid.lua index 4fee732..9581c92 100644 --- a/mods/mobs_loz/stalchid.lua +++ b/mods/mobs_loz/stalchid.lua @@ -9,7 +9,7 @@ mobs:register_mob("mobs_loz:stalchild", { damage = 2, hp_min = 12, hp_max = 27, - armor = 100, + armor = 130, collisionbox = {-0.3, 0, -0.3, 0.3, 1.2, 0.3}, visual = "mesh", mesh = "stalchild.b3d", diff --git a/mods/mobs_loz/subrosian.lua b/mods/mobs_loz/subrosian.lua index a0ff06b..5229f9d 100644 --- a/mods/mobs_loz/subrosian.lua +++ b/mods/mobs_loz/subrosian.lua @@ -6,7 +6,7 @@ mobs:register_mob("mobs_loz:subrosian", { attack_type = "dogfight", hp_min = 10, hp_max = 25, - armor = 80, + armor = 120, collisionbox = {-0.4, 0, -0.4, 0.4, 1, 0.4}, visual = "mesh", mesh = "subrosian.b3d", diff --git a/mods/mobs_loz/tektite.lua b/mods/mobs_loz/tektite.lua index 8442f37..6b0b5b6 100644 --- a/mods/mobs_loz/tektite.lua +++ b/mods/mobs_loz/tektite.lua @@ -6,7 +6,7 @@ mobs:register_mob("mobs_loz:tektite", { damage = 2, hp_min = 28, hp_max = 37, - armor = 90, + armor = 150, collisionbox = {-0.2, -0.01, -0.2, 0.2, 0.7, 0.2}, --visual_size = {x=1.5, y=1.5}, visual = "mesh", @@ -58,7 +58,7 @@ mobs:register_mob("mobs_loz:tektite2", { damage = 3, hp_min = 28, hp_max = 37, - armor = 90, + armor = 150, collisionbox = {-0.2, -0.01, -0.2, 0.2, 0.7, 0.2}, --visual_size = {x=1.5, y=1.5}, visual = "mesh", diff --git a/mods/mobs_loz/textures/mobs_biri2.png b/mods/mobs_loz/textures/mobs_biri2.png new file mode 100644 index 0000000..8eca696 Binary files /dev/null and b/mods/mobs_loz/textures/mobs_biri2.png differ diff --git a/mods/mobs_loz/textures/mobs_dekubaba2.png b/mods/mobs_loz/textures/mobs_dekubaba2.png new file mode 100644 index 0000000..10d569b Binary files /dev/null and b/mods/mobs_loz/textures/mobs_dekubaba2.png differ diff --git a/mods/mobs_loz/textures/mobs_great_moldorm.png b/mods/mobs_loz/textures/mobs_great_moldorm.png new file mode 100644 index 0000000..acb141d Binary files /dev/null and b/mods/mobs_loz/textures/mobs_great_moldorm.png differ diff --git a/mods/mobs_loz/textures/mobs_octorock.png b/mods/mobs_loz/textures/mobs_octorock.png index dc21b85..4800395 100644 Binary files a/mods/mobs_loz/textures/mobs_octorock.png and b/mods/mobs_loz/textures/mobs_octorock.png differ diff --git a/mods/mobs_loz/textures/mobs_octorock2.png b/mods/mobs_loz/textures/mobs_octorock2.png index 5a8025f..76d229b 100644 Binary files a/mods/mobs_loz/textures/mobs_octorock2.png and b/mods/mobs_loz/textures/mobs_octorock2.png differ diff --git a/mods/mobs_loz/textures/mobs_poe2.png b/mods/mobs_loz/textures/mobs_poe2.png index dca6977..8e55290 100644 Binary files a/mods/mobs_loz/textures/mobs_poe2.png and b/mods/mobs_loz/textures/mobs_poe2.png differ diff --git a/mods/mobs_loz/textures/mobs_poe3.png b/mods/mobs_loz/textures/mobs_poe3.png index 63a87d6..650ddd3 100644 Binary files a/mods/mobs_loz/textures/mobs_poe3.png and b/mods/mobs_loz/textures/mobs_poe3.png differ diff --git a/mods/mobs_loz/textures/mobs_poe_soul.png b/mods/mobs_loz/textures/mobs_poe_soul.png index d30ce80..48b744c 100644 Binary files a/mods/mobs_loz/textures/mobs_poe_soul.png and b/mods/mobs_loz/textures/mobs_poe_soul.png differ diff --git a/mods/mobs_loz/textures/mobs_zora_female.png b/mods/mobs_loz/textures/mobs_zora_female.png new file mode 100644 index 0000000..14ac550 Binary files /dev/null and b/mods/mobs_loz/textures/mobs_zora_female.png differ diff --git a/mods/mobs_loz/textures/mobs_zora.png b/mods/mobs_loz/textures/mobs_zora_male.png similarity index 100% rename from mods/mobs_loz/textures/mobs_zora.png rename to mods/mobs_loz/textures/mobs_zora_male.png diff --git a/mods/mobs_loz/tingle.lua b/mods/mobs_loz/tingle.lua index af1277c..b0e1db0 100644 --- a/mods/mobs_loz/tingle.lua +++ b/mods/mobs_loz/tingle.lua @@ -3,7 +3,7 @@ mobs:register_mob("mobs_loz:tingle", { passive = true, hp_min = 13, hp_max = 27, - armor = 90, + armor = 150, collisionbox = {-0.2, -0, -0.2, 0.2, 1.3, 0.2}, --visual_size = {x=1.5, y=1.5}, visual = "mesh", @@ -35,7 +35,7 @@ mobs:register_mob("mobs_loz:tingle", { local pos = self.object:getpos() minetest.chat_send_player(name, "Tingle, Tingle! Kooloo-Limpah!") self.state = "stand" - set_animation(self, "punch") + self.object:set_animation({x=1, y=20}, 12, 0) minetest.add_particlespawner({ amount = 3, time = 1.5, diff --git a/mods/mobs_loz/volvagia.lua b/mods/mobs_loz/volvagia.lua index 0363220..bf3c3af 100644 --- a/mods/mobs_loz/volvagia.lua +++ b/mods/mobs_loz/volvagia.lua @@ -68,22 +68,22 @@ mobs:register_mob("mobs_loz:volvagia", { fly_in = "air", on_die = function(self, pos) mobs:explosion(pos, 2, 1, 1) - minetest.add_particlespawner( - 10, --amount - 1, --time - {x=pos.x-1, y=pos.y-1, z=pos.z-1}, --minpos - {x=pos.x+1, y=pos.y-1, z=pos.z+1}, --maxpos - {x=-0, y=-0, z=-0}, --minvel - {x=0, y=0, z=0}, --maxvel - {x=-0.5,y=1,z=-0.5}, --minacc - {x=0.5,y=1,z=0.5}, --maxacc - 1, --minexptime - 1.5, --maxexptime - 20, --minsize - 25, --maxsize - false, --collisiondetection - "mobs_loz_light.png" --texture - ) + for i=1,10 do + minetest.after((i/10)+math.random(-9,9)/20, function() + minetest.add_particle({ + pos = {x=pos.x+math.random(-1,1), y=pos.y, z=pos.z+math.random(-1,1)}, + velocity = {x=0, y=0, z=0}, + acceleration = {x=math.random(-5,5)/10, y=1, z=math.random(-5,5)/10}, + expirationtime = math.random(10,15)/10, + size = math.random(20,25), + collisiondetection = false, + collisionremoval = false, + vertical = true, + texture = "mobs_loz_light.png", + glow = 9 + }) + end) + end end, }) diff --git a/mods/mobs_loz/wolfos.lua b/mods/mobs_loz/wolfos.lua index 3a76492..650f044 100644 --- a/mods/mobs_loz/wolfos.lua +++ b/mods/mobs_loz/wolfos.lua @@ -14,7 +14,7 @@ mobs:register_mob("mobs_loz:wolfos", { damage = 4, hp_min = 30, hp_max = 47, - armor = 90, + armor = 100, collisionbox = {-0.5, -0, -0.5, 0.5, 1, 0.5}, --visual_size = {x=1.5, y=1.5}, visual = "mesh", @@ -67,7 +67,7 @@ mobs:register_mob("mobs_loz:wolfos2", { damage = 4, hp_min = 40, hp_max = 77, - armor = 90, + armor = 100, collisionbox = {-0.5, -0, -0.5, 0.5, 1, 0.5}, --visual_size = {x=1.5, y=1.5}, visual = "mesh", diff --git a/mods/mobs_loz/zol.lua b/mods/mobs_loz/zol.lua index 42c0fb9..8645cae 100644 --- a/mods/mobs_loz/zol.lua +++ b/mods/mobs_loz/zol.lua @@ -7,7 +7,7 @@ mobs:register_mob("mobs_loz:zol", { damage = 1, hp_min = 10, hp_max = 15, - armor = 100, + armor = 130, collisionbox = {-0.2, -0, -0.2, 0.2, 0.4, 0.2}, visual_size = {x=1.5, y=1.5}, visual = "mesh", @@ -55,7 +55,7 @@ mobs:register_mob("mobs_loz:little_zol", { damage = 1, hp_min = 10, hp_max = 15, - armor = 100, + armor = 130, collisionbox = {-0.2, -0, -0.2, 0.2, 0.4, 0.2}, visual_size = {x=0.8, y=0.8}, visual = "mesh", diff --git a/mods/mobs_loz/zora.lua b/mods/mobs_loz/zora.lua index a13ec8a..1f67a62 100644 --- a/mods/mobs_loz/zora.lua +++ b/mods/mobs_loz/zora.lua @@ -2,7 +2,7 @@ -- zora by D00Med -- an edit of mese monster by Zeg9 -mobs:register_mob("mobs_loz:zora", { +mobs:register_mob("mobs_loz:zora_male", { type = "animal", passive = true, damage = 0, @@ -12,9 +12,9 @@ mobs:register_mob("mobs_loz:zora", { armor = 80, collisionbox = {-0.4, -0, -0.4, 0.4, 1, 0.4}, visual = "mesh", - mesh = "zora.b3d", + mesh = "zora_male.b3d", textures = { - {"mobs_zora.png"}, + {"mobs_zora_male.png"}, }, blood_texture = "hyruletools_ice_shard.png", makes_footstep_sound = true, @@ -59,16 +59,84 @@ mobs:register_mob("mobs_loz:zora", { do_custom = function(self) if not self.child - and math.random(1, 250) == 1 then + and math.random(1, 2000) == 1 then local pos = self.object:getpos() - minetest.add_item(pos, "mobs:scale") + minetest.add_item(pos, "mobs_loz:scale") end end, }) -mobs:register_egg("mobs_loz:zora", "Zora", "default_ice.png", 1) +mobs:register_egg("mobs_loz:zora_male", "Zora (male)", "default_ice.png", 1) + +mobs:register_mob("mobs_loz:zora_female", { + type = "animal", + passive = true, + damage = 0, + attack_type = "dogfight", + hp_min = 10, + hp_max = 25, + armor = 80, + collisionbox = {-0.4, -0, -0.4, 0.4, 1, 0.4}, + visual = "mesh", + mesh = "zora_female.b3d", + textures = { + {"mobs_zora_female.png"}, + }, + blood_texture = "hyruletools_ice_shard.png", + makes_footstep_sound = true, + view_range = 5, + walk_velocity = 3, + run_velocity = 7, + runaway = true, + runaway_timer = 40, + jump = false, + stepheight = 1.5, + fly = true, + fly_in = "default:water_source", + jump_height = 0, + fall_damage = 0, + fall_speed = -6, + drops = { + {name = "hyruletools:ice_fragment", + chance = 9, min = 1, max = 3}, + {name = "hyruletools:green_rupee", + chance = 5, min = 1, max = 2}, + }, + on_die = function(self) + local pos = self.object:getpos() + if math.random(1,7) == 2 then + minetest.env:add_entity(pos, "hyruletools:heart_entity") + end + minetest.env:add_entity(pos, "experience:orb") + end, + water_damage = 0, + lava_damage = 1, + light_damage = 0, + animation = { + speed_normal = 15, + speed_run = 20, + stand_start = 1, + stand_end = 20, + walk_start = 25, + walk_end = 45, + run_start = 25, + run_end = 45, + }, + do_custom = function(self) + + if not self.child + and math.random(1, 250) == 1 then + + local pos = self.object:getpos() + + minetest.add_item(pos, "mobs_loz:scale") + end + end, +}) + +mobs:register_egg("mobs_loz:zora_female", "Zora (female)", "default_ice.png^[colorize:red:70", 1) playereffects.register_effect_type("potion_swim_lv1", "Fast Swim", nil, {"swim"}, function(player) @@ -89,8 +157,10 @@ minetest.register_craftitem("mobs_loz:scale", { on_use = function(item, user, pointed_thing) local player = user:get_player_name() local breath = user:get_breath() - if breath <= 10 then - playereffects.apply_effect_type("potion_swim_lv1", 10, user) + local pos = user:getpos() + user:set_breath(breath+5) + if minetest.get_node(pos).name == "default:water_source" or minetest.get_node(pos).name == "default:river_water_source" then + playereffects.apply_effect_type("potion_swim_lv1", 4, user) end end, -}) \ No newline at end of file +}) diff --git a/mods/mobs_npc/trader.lua b/mods/mobs_npc/trader.lua index 2c50418..83879fc 100644 --- a/mods/mobs_npc/trader.lua +++ b/mods/mobs_npc/trader.lua @@ -26,24 +26,24 @@ mobs.human = { mobs.shopkeeper = { items = { --{item for sale, price, chance of appearing in trader's inventory} - {"hyruletools:heart 5", "hyruletools:green_rupee 10", 10}, - {"bows:arrow_steel 10", "hyruletools:green_rupee 20", 5}, - {"shields:shield_wood 1", "hyruletools:green_rupee 30", 12}, - {"shields:shield_steel 1", "hyruletools:green_rupee 25", 17}, - {"hyruletools:goron_tunic 1", "hyruletools:red_rupee 30", 17}, - {"hyruletools:zora_tunic 1", "hyruletools:blue_rupee 30", 50}, + {"hyruletools:heart 5", "hyruletools:green_rupee 5", 10}, + {"bows:arrow_steel 10", "hyruletools:green_rupee 10", 5}, + {"shields:shield_wood 1", "hyruletools:green_rupee 20", 12}, + {"shields:shield_steel 1", "hyruletools:green_rupee 30", 17}, + {"hyruletools:goron_tunic 1", "hyruletools:red_rupee 40", 17}, + {"hyruletools:zora_tunic 1", "hyruletools:blue_rupee 40", 50}, {"hyruletools:key 1", "hyruletools:green_rupee 10", 40}, {"hyruletools:letter 5", "hyruletools:green_rupee 5", 17}, - {"tnt:tnt 10", "hyruletools:blue_rupee 15", 20}, - {"mobs_fairy:fairy 1", "hyruletools:red_rupee 50", 17}, + {"tnt:tnt 10", "hyruletools:blue_rupee 10", 20}, + {"mobs_fairy:fairy 1", "hyruletools:red_rupee 30", 17}, {"mobs:bucket_milk 1", "hyruletools:green_rupee 15", 27}, {"default:papyrus 5", "hyruletools:green_rupee 15", 7}, - {"default:pick_steel 1", "hyruletools:blue_rupee 50", 7}, - {"default:sword_steel 1", "hyruletools:red_rupee 100", 17}, - {"default:shovel_steel 1", "hyruletools:green_rupee 50", 17}, + {"default:pick_steel 1", "hyruletools:blue_rupee 30", 7}, + {"default:sword_steel 1", "hyruletools:red_rupee 35", 17}, + {"default:shovel_steel 1", "hyruletools:green_rupee 25", 17}, }, names = { - "Bruce", "Bruce", "Bruce", "Bruce", "Bruce", "Bruce", "Bruce" + "Bruce", "B.", "BRUCE", "Bruce", "Bruice", "Brusse", "Brooce" } } diff --git a/mods/mobs_redo/api.lua b/mods/mobs_redo/api.lua index 193a00a..246cf15 100644 --- a/mods/mobs_redo/api.lua +++ b/mods/mobs_redo/api.lua @@ -1,8 +1,9 @@ --- Mobs Api (31st January 2017) +-- Mobs Api (27th May 2017) mobs = {} mobs.mod = "redo" +mobs.version = "20170527" -- Intllib @@ -29,27 +30,7 @@ if rawget(_G, "invisibility") then end --- Load settings -local damage_enabled = minetest.setting_getbool("enable_damage") -local peaceful_only = minetest.setting_getbool("only_peaceful_mobs") -local disable_blood = minetest.setting_getbool("mobs_disable_blood") -local creative = minetest.setting_getbool("creative_mode") -local spawn_protected = tonumber(minetest.setting_get("mobs_spawn_protected")) or 1 -local remove_far = minetest.setting_getbool("remove_far_mobs") -local difficulty = tonumber(minetest.setting_get("mob_difficulty")) or 1.0 -local show_health = minetest.setting_getbool("mob_show_health") ~= false - --- calculate aoc range for mob counts -local aosrb = tonumber(minetest.setting_get("active_object_send_range_blocks")) -local abr = tonumber(minetest.setting_get("active_block_range")) -local aoc_range = math.max(aosrb, abr) * 16 - --- pathfinding settings -local enable_pathfinding = true -local stuck_timeout = 3 -- how long before mob gets stuck in place and starts searching -local stuck_path_timeout = 10 -- how long will mob follow path before giving up - --- localize functions +-- localize math functions local pi = math.pi local square = math.sqrt local sin = math.sin @@ -61,8 +42,7 @@ local atann = math.atan local random = math.random local floor = math.floor local atan = function(x) - - if x ~= x then + if not x or x ~= x then --error("atan bassed NaN") return 0 else @@ -71,7 +51,30 @@ local atan = function(x) end -mob_sound = function(self, sound) +-- Load settings +local damage_enabled = minetest.setting_getbool("enable_damage") +local peaceful_only = minetest.setting_getbool("only_peaceful_mobs") +local disable_blood = minetest.setting_getbool("mobs_disable_blood") +local creative = minetest.setting_getbool("creative_mode") +local spawn_protected = tonumber(minetest.setting_get("mobs_spawn_protected")) or 1 +local remove_far = minetest.setting_getbool("remove_far_mobs") +local difficulty = tonumber(minetest.setting_get("mob_difficulty")) or 1.0 +local show_health = minetest.setting_getbool("mob_show_health") ~= false +local max_per_block = tonumber(minetest.setting_get("max_objects_per_block") or 99) + +-- calculate aoc range for mob count +local aosrb = tonumber(minetest.setting_get("active_object_send_range_blocks")) +local abr = tonumber(minetest.setting_get("active_block_range")) +local aoc_range = max(aosrb, abr) * 16 + +-- pathfinding settings +local enable_pathfinding = true +local stuck_timeout = 3 -- how long before mob gets stuck in place and starts searching +local stuck_path_timeout = 10 -- how long will mob follow path before giving up + + +-- play sound +local mob_sound = function(self, sound) if sound then minetest.sound_play(sound, { @@ -83,7 +86,8 @@ mob_sound = function(self, sound) end -do_attack = function(self, player) +-- attack player/mob +local do_attack = function(self, player) if self.state == "attack" then return @@ -98,33 +102,21 @@ do_attack = function(self, player) end -set_yaw = function(self, yaw) +-- move mob in facing direction +local set_velocity = function(self, v) - if yaw ~= yaw then --- print ("--- yaw nan") - return - end - - self.yaw = yaw -- + self.rotate - self.object:setyaw(self.yaw) -end - - -set_velocity = function(self, v) - - local yaw = self.object:getyaw() + self.rotate + local yaw = (self.object:getyaw() or 0) + self.rotate self.object:setvelocity({ --- x = sin(self.yaw) * -v, x = sin(yaw) * -v, y = self.object:getvelocity().y, --- z = cos(self.yaw) * v z = cos(yaw) * v }) end -get_velocity = function(self) +-- get overall speed of mob +local get_velocity = function(self) local v = self.object:getvelocity() @@ -132,86 +124,49 @@ get_velocity = function(self) end -set_anim = function(self, anim_start, anim_end, anim_speed, anim_name) +-- set yaw +local set_yaw = function(self, yaw) - if not anim_start or not anim_end then - return + if not yaw or yaw ~= yaw then + yaw = 0 end - self.object:set_animation( - {x = anim_start, y = anim_end}, anim_speed or 15, 0) + self:setyaw(yaw) - self.animation.current = anim_name + return yaw end -set_animation = function(self, type) +-- set defined animation +local set_animation = function(self, anim) - if not self.animation then - return - end + if not self.animation then return end self.animation.current = self.animation.current or "" - if type == "stand" and self.animation.current ~= "stand" then - - set_anim(self, - self.animation.stand_start, - self.animation.stand_end, - self.animation.speed_stand, "stand") - - elseif type == "walk" and self.animation.current ~= "walk" then - - set_anim(self, - self.animation.walk_start, - self.animation.walk_end, - self.animation.speed_walk, "walk") - - elseif type == "run" and self.animation.current ~= "run" then - - set_anim(self, - self.animation.run_start, - self.animation.run_end, - self.animation.speed_run, "run") - - elseif type == "punch" and self.animation.current ~= "punch" then - - set_anim(self, - self.animation.punch_start, - self.animation.punch_end, - self.animation.speed_punch, "punch") - - elseif type == "punch2" and self.animation.current ~= "punch2" then - - set_anim(self, - self.animation.punch2_start, - self.animation.punch2_end, - self.animation.speed_punch2, "punch2") - - elseif type == "shoot" and self.animation.current ~= "shoot" then - - set_anim(self, - self.animation.shoot_start, - self.animation.shoot_end, - self.animation.speed_shoot, "shoot") - - elseif type == "die" and self.animation.current ~= "die" then - - set_anim(self, - self.animation.die_start, - self.animation.die_end, - self.animation.speed_die, "die") - - elseif type == "fly" and self.animation.current ~= "fly" then - - set_anim(self, - self.animation.fly_start, - self.animation.fly_end, - self.animation.speed_fly, "fly") + if anim == self.animation.current + or not self.animation[anim .. "_start"] + or not self.animation[anim .. "_end"] then + return end + + self.animation.current = anim + + self.object:set_animation({ + x = self.animation[anim .. "_start"], + y = self.animation[anim .. "_end"] + }, self.animation[anim .. "_speed"] or self.animation.speed_normal or 15) + end --- get distance + +-- above function exported for mount.lua +function mobs:set_animation(anim) + set_animation(self, anim) +end + + +-- this is a faster way to calculate distance local get_distance = function(a, b) local x, y, z = a.x - b.x, a.y - b.y, a.z - b.z @@ -221,7 +176,7 @@ end -- check line of sight (BrunoMine) -function line_of_sight(self, pos1, pos2, stepsize) +local line_of_sight = function(self, pos1, pos2, stepsize) stepsize = stepsize or 1 @@ -249,9 +204,11 @@ function line_of_sight(self, pos1, pos2, stepsize) -- Actual Distance (ad) traveled local ad = 0 - -- It continues to advance in the line of sight in search of a real obstruction. + -- It continues to advance in the line of sight in search of a real + -- obstruction which counts as 'normal' nodebox. while minetest.registered_nodes[nn] - and minetest.registered_nodes[nn].walkable == false do + and (minetest.registered_nodes[nn].walkable == false + or minetest.registered_nodes[nn].drawtype == "nodebox") do -- Check if you can still move forward if td < ad + stepsize then @@ -260,10 +217,19 @@ function line_of_sight(self, pos1, pos2, stepsize) -- Moves the analyzed pos local d = get_distance(pos1, pos2) + npos1.x = ((pos2.x - pos1.x) / d * stepsize) + pos1.x npos1.y = ((pos2.y - pos1.y) / d * stepsize) + pos1.y npos1.z = ((pos2.z - pos1.z) / d * stepsize) + pos1.z + -- NaN checks + if d == 0 + or npos1.x ~= npos1.x + or npos1.y ~= npos1.y + or npos1.z ~= npos1.z then + return false + end + ad = ad + stepsize -- scan again @@ -281,13 +247,12 @@ end -- are we flying in what we are suppose to? (taikedz) -local function flight_check(self, pos_w) +local flight_check = function(self, pos_w) --- local nod = minetest.get_node(pos_w).name local nod = self.standing_in if type(self.fly_in) == "string" - and ( nod == self.fly_in or nod == self.fly_in:gsub("_source", "_flowing") ) then + and (nod == self.fly_in or nod == self.fly_in:gsub("_source", "_flowing")) then return true @@ -301,46 +266,13 @@ local function flight_check(self, pos_w) end end end -end - - --- check line of sight for walkers and swimmers alike (deprecated) -function line_of_sight_water(self, pos1, pos2, stepsize) - - local s, pos_w = minetest.line_of_sight(pos1, pos2, stepsize) - - -- normal walking and flying mobs can see you through air - if s == true then - return true - end - - -- swimming mobs can see you through water - if s == false - and self.fly - and self.fly_in == "default:water_source" then - - local nod = minetest.get_node(pos_w).name - - if nod == "default:water_source" - or nod == "default:water_flowing" then - - return true - end - - -- just incase we have a special node for flying/swimming mobs - elseif s == false - and self.fly - and flight_check(self, pos_w) then - return true - end return false - end -- particle effects -function effect(pos, amount, texture, min_size, max_size, radius, gravity) +local effect = function(pos, amount, texture, min_size, max_size, radius, gravity) radius = radius or 2 min_size = min_size or 0.5 @@ -366,7 +298,7 @@ end -- update nametag colour -function update_tag(self) +local update_tag = function(self) local col = "#00FF00" local qua = self.hp_max / 4 @@ -391,14 +323,55 @@ function update_tag(self) end --- check if mob is dead or only hurt -function check_for_death(self) +-- drop items +local item_drop = function(self, cooked) - -- has health actually changed? - if self.health == self.old_health then - return + local obj, item, num + local pos = self.object:getpos() + + self.drops = self.drops or {} -- nil check + + for n = 1, #self.drops do + + if random(1, self.drops[n].chance) == 1 then + + num = random(self.drops[n].min, self.drops[n].max) + item = self.drops[n].name + + -- cook items when true + if cooked then + + local output = minetest.get_craft_result({ + method = "cooking", width = 1, items = {item}}) + + if output and output.item and not output.item:is_empty() then + item = output.item:get_name() + end + end + + -- add item if it exists + obj = minetest.add_item(pos, ItemStack(item .. " " .. num)) + + if obj and obj:get_luaentity() then + + obj:setvelocity({ + x = random(-10, 10) / 9, + y = 6, + z = random(-10, 10) / 9, + }) + else + obj:remove() -- item does not exist + end + end end + self.drops = {} +end + + +-- check if mob is dead or only hurt +local check_for_death = function(self, cause) + self.old_health = self.health -- still got some health? play hurt sound @@ -419,7 +392,6 @@ function check_for_death(self) if show_health then self.htimer = 2 - --self.nametag = "health: " .. self.health .. " of " .. self.hp_max self.nametag = "♥ " .. self.health .. " / " .. self.hp_max update_tag(self) @@ -428,32 +400,16 @@ function check_for_death(self) return false end - -- drop items when dead - local obj - local pos = self.object:getpos() - self.drops = self.drops or {} -- error check - - for n = 1, #self.drops do - - if random(1, self.drops[n].chance) == 1 then - - obj = minetest.add_item(pos, - ItemStack(self.drops[n].name .. " " - .. random(self.drops[n].min, self.drops[n].max))) - - if obj then - - obj:setvelocity({ - x = random(-10, 10) / 9, - y = 6, - z = random(-10, 10) / 9, - }) - end - end + if cause == "lava" then + item_drop(self, true) + else + item_drop(self, nil) end mob_sound(self, self.sounds.death) + local pos = self.object:getpos() + -- execute custom death function if self.on_die then @@ -491,7 +447,7 @@ end -- check if within physical map limits (-30911 to 30927) -function within_limits(pos, radius) +local within_limits = function(pos, radius) if (pos.x - radius) > -30913 and (pos.x + radius) < 30928 @@ -507,15 +463,13 @@ end -- is mob facing a cliff -local function is_at_cliff(self) +local is_at_cliff = function(self) if self.fear_height == 0 then -- 0 for no falling protection! return false end local yaw = self.object:getyaw() --- local dir_x = -sin(self.yaw) * (self.collisionbox[4] + 0.5) --- local dir_z = cos(self.yaw) * (self.collisionbox[4] + 0.5) local dir_x = -sin(yaw) * (self.collisionbox[4] + 0.5) local dir_z = cos(yaw) * (self.collisionbox[4] + 0.5) local pos = self.object:getpos() @@ -534,7 +488,7 @@ end -- get node but use fallback for nil or unknown -local function node_ok(pos, fallback) +local node_ok = function(pos, fallback) fallback = fallback or "default:dirt" @@ -553,7 +507,7 @@ end -- environmental damage (water, lava, fire, light) -do_env_damage = function(self) +local do_env_damage = function(self) -- feed/tame text timer (so mob 'full' messages dont spam chat) if self.htimer > 0 then @@ -589,6 +543,8 @@ do_env_damage = function(self) self.health = self.health - self.light_damage effect(pos, 5, "tnt_smoke.png") + + if check_for_death(self, "light") then return end end -- what is mob standing in? @@ -616,7 +572,8 @@ do_env_damage = function(self) self.health = self.health - self.water_damage effect(pos, 5, "bubble.png", nil, nil, 1, nil) --- end + + if check_for_death(self, "water") then return end -- lava or fire elseif self.lava_damage ~= 0 @@ -628,6 +585,8 @@ do_env_damage = function(self) effect(pos, 5, "fire_basic_flame.png", nil, nil, 1, nil) + if check_for_death(self, "lava") then return end + -- damage_per_second node check elseif minetest.registered_nodes[self.standing_in].damage_per_second ~= 0 then @@ -639,16 +598,25 @@ do_env_damage = function(self) end end - check_for_death(self) + check_for_death(self, "") end -- jump if facing a solid node (not fences or gates) -do_jump = function(self) +local do_jump = function(self) - if self.fly + if not self.jump + or self.jump_height == 0 + or self.fly or self.child then - return + return false + end + + -- something stopping us while moving? + if self.state ~= "stand" + and get_velocity(self) > 0.5 + and self.object:getvelocity().y ~= 0 then + return false end local pos = self.object:getpos() @@ -662,12 +630,10 @@ do_jump = function(self) --print ("standing on:", nod.name, pos.y) if minetest.registered_nodes[nod.name].walkable == false then - return + return false end -- where is front --- local dir_x = -sin(self.yaw) * (self.collisionbox[4] + 0.5) --- local dir_z = cos(self.yaw) * (self.collisionbox[4] + 0.5) local dir_x = -sin(yaw) * (self.collisionbox[4] + 0.5) local dir_z = cos(yaw) * (self.collisionbox[4] + 0.5) @@ -680,7 +646,7 @@ do_jump = function(self) -- thin blocks that do not need to be jumped if nod.name == "default:snow" then - return + return false end --print ("in front:", nod.name, pos.y + 0.5) @@ -692,26 +658,23 @@ do_jump = function(self) local v = self.object:getvelocity() - v.y = self.jump_height + 1 + v.y = self.jump_height -- + 1 + + set_animation(self, "jump") -- only when defined self.object:setvelocity(v) mob_sound(self, self.sounds.jump) + + return true end -end - --- this is a faster way to calculate distance -local get_distance = function(a, b) - - local x, y, z = a.x - b.x, a.y - b.y, a.z - b.z - - return square(x * x + y * y + z * z) + return false end -- blast damage to entities nearby (modified from TNT mod) -function entity_physics(pos, radius) +local entity_physics = function(pos, radius) radius = radius * 2 @@ -738,7 +701,7 @@ end -- should mob follow what I'm holding ? -function follow_holding(self, clicker) +local follow_holding = function(self, clicker) if mobs.invis[clicker:get_player_name()] then return false @@ -768,7 +731,7 @@ end -- find two animals of same type and breed if nearby and horny -local function breed(self) +local breed = function(self) -- child takes 240 seconds before growing into adult if self.child == true then @@ -903,37 +866,50 @@ end -- find and replace what mob is looking for (grass, wheat etc.) -function replace(self, pos) +local replace = function(self, pos) - if self.replace_rate - and self.child == false - and random(1, self.replace_rate) == 1 then + if not self.replace_rate + or not self.replace_what + or self.child == true + or self.object:getvelocity().y ~= 0 + or random(1, self.replace_rate) > 1 then + return + end - local pos = self.object:getpos() + local what, with, y_offset - pos.y = pos.y + self.replace_offset + if type(self.replace_what[1]) == "table" then + + local num = random(#self.replace_what) + + what = self.replace_what[num][1] or "" + with = self.replace_what[num][2] or "" + y_offset = self.replace_what[num][3] or 0 + else + what = self.replace_what + with = self.replace_with or "" + y_offset = self.replace_offset or 0 + end + + pos.y = pos.y + y_offset + + if #minetest.find_nodes_in_area(pos, pos, what) > 0 then -- print ("replace node = ".. minetest.get_node(pos).name, pos.y) - if self.replace_what - and self.replace_with - and self.object:getvelocity().y == 0 - and #minetest.find_nodes_in_area(pos, pos, self.replace_what) > 0 then + minetest.set_node(pos, {name = with}) - minetest.set_node(pos, {name = self.replace_with}) - - -- when cow/sheep eats grass, replace wool and milk - if self.gotten == true then - self.gotten = false - self.object:set_properties(self) - end + -- when cow/sheep eats grass, replace wool and milk + if self.gotten == true then + self.gotten = false + self.object:set_properties(self) end end end -- check if daytime and also if mob is docile during daylight hours -function day_docile(self) +local day_docile = function(self) if self.docile_by_day == false then @@ -949,7 +925,7 @@ end -- path finding and smart mob routine by rnd -function smart_mobs(self, s, p, dist, dtime) +local smart_mobs = function(self, s, p, dist, dtime) local s1 = self.path.lastpos @@ -964,8 +940,7 @@ function smart_mobs(self, s, p, dist, dtime) -- im stuck, search for path if (self.path.stuck_timer > stuck_timeout and not self.path.following) - or (self.path.stuck_timer > stuck_path_timeout - and self.path.following) then + or (self.path.stuck_timer > stuck_path_timeout and self.path.following) then self.path.stuck_timer = 0 @@ -993,7 +968,7 @@ function smart_mobs(self, s, p, dist, dtime) p1.y = floor(p1.y + 0.5) p1.z = floor(p1.z + 0.5) - self.path.way = minetest.find_path(s, p1, 16, 2, 6, "Dijkstra") --"A*_noprefetch") + self.path.way = minetest.find_path(s, p1, 16, 2, 6, "Dijkstra") -- attempt to unstick mob that is "daydreaming" self.object:setpos({ @@ -1013,12 +988,18 @@ function smart_mobs(self, s, p, dist, dtime) -- lets make way by digging/building if not accessible if self.pathfinding == 2 then - -- add block and remove one block above so - -- there is room to jump if needed + -- is player higher than mob? if s.y < p1.y then + -- build upwards if not minetest.is_protected(s, "") then - minetest.set_node(s, {name = "default:dirt"}) + + local ndef1 = minetest.registered_nodes[self.standing_in] + + if ndef1 and (ndef1.buildable_to or ndef1.groups.liquid) then + + minetest.set_node(s, {name = "default:dirt"}) + end end local sheight = math.ceil(self.collisionbox[5]) + 1 @@ -1026,14 +1007,21 @@ function smart_mobs(self, s, p, dist, dtime) -- assume mob is 2 blocks high so it digs above its head s.y = s.y + sheight + -- remove one block above to make room to jump if not minetest.is_protected(s, "") then - local node1 = minetest.get_node(s).name + local node1 = node_ok(s, "air").name + local ndef1 = minetest.registered_nodes[node1] if node1 ~= "air" - and node1 ~= "ignore" then + and node1 ~= "ignore" + and ndef1 + and not ndef1.groups.level + and not ndef1.groups.unbreakable then + minetest.set_node(s, {name = "air"}) minetest.add_item(s, ItemStack(node1)) + end end @@ -1042,9 +1030,7 @@ function smart_mobs(self, s, p, dist, dtime) else -- dig 2 blocks to make door toward player direction --- local yaw1 = self.yaw + pi / 2 local yaw1 = self.object:getyaw() + pi / 2 - local p1 = { x = s.x + cos(yaw1), y = s.y, @@ -1053,19 +1039,29 @@ function smart_mobs(self, s, p, dist, dtime) if not minetest.is_protected(p1, "") then - local node1 = minetest.get_node(p1).name + local node1 = node_ok(p1, "air").name + local ndef1 = minetest.registered_nodes[node1] if node1 ~= "air" - and node1 ~= "ignore" then + and node1 ~= "ignore" + and ndef1 + and not ndef1.groups.level + and not ndef1.groups.unbreakable then + minetest.add_item(p1, ItemStack(node1)) minetest.set_node(p1, {name = "air"}) end p1.y = p1.y + 1 - node1 = minetest.get_node(p1).name + node1 = node_ok(p1, "air").name + ndef1 = minetest.registered_nodes[node1] if node1 ~= "air" - and node1 ~= "ignore" then + and node1 ~= "ignore" + and ndef1 + and not ndef1.groups.level + and not ndef1.groups.unbreakable then + minetest.add_item(p1, ItemStack(node1)) minetest.set_node(p1, {name = "air"}) end @@ -1170,7 +1166,6 @@ local monster_attack = function(self) -- field of view check goes here -- choose closest player to attack --- if line_of_sight_water(self, sp, p, 2) == true if line_of_sight(self, sp, p, 2) == true and dist < min_dist then min_dist = dist @@ -1207,7 +1202,7 @@ local npc_attack = function(self) if obj and obj.type == "monster" then - p = obj.object:getpos() + local p = obj.object:getpos() dist = get_distance(p, s) @@ -1298,27 +1293,16 @@ local follow_flop = function(self) z = p.z - s.z } --- local yaw = atan2(vec.z, vec.x) - pi / 2 local yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate if p.x > s.x then yaw = yaw + pi end - self.object:setyaw(yaw) --- set_yaw(self, yaw) + yaw = set_yaw(self.object, yaw) -- anyone but standing npc's can move along if dist > self.reach and self.order ~= "stand" then - if (self.jump - and get_velocity(self) <= 0.5 - and self.object:getvelocity().y == 0) - or (self.object:getvelocity().y == 0 - and self.jump_chance > 0) then - - do_jump(self) - end - set_velocity(self, self.walk_velocity) if self.walk_chance ~= 0 then @@ -1363,7 +1347,10 @@ local dogswitch = function(self, dtime) self.dogshoot_count = self.dogshoot_count + dtime - if self.dogshoot_count > self.dogshoot_count_max then + if (self.dogshoot_switch == 1 + and self.dogshoot_count > self.dogshoot_count_max) + or (self.dogshoot_switch == 2 + and self.dogshoot_count > self.dogshoot_count2_max) then self.dogshoot_count = 0 @@ -1381,7 +1368,7 @@ end -- execute current state (stand, walk, run, attacks) local do_states = function(self, dtime) - local yaw = 0 -- self.yaw + local yaw = 0 if self.state == "stand" then @@ -1407,17 +1394,14 @@ local do_states = function(self, dtime) z = lp.z - s.z } --- yaw = atan2(vec.z, vec.x) - pi / 2 yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate if lp.x > s.x then yaw = yaw + pi end else --- yaw = random() * 2 * pi yaw = (random(0, 360) - 180) / 180 * pi end - self.object:setyaw(yaw) --- set_yaw(self, yaw) + yaw = set_yaw(self.object, yaw) end set_velocity(self, 0) @@ -1434,6 +1418,15 @@ local do_states = function(self, dtime) set_velocity(self, self.walk_velocity) self.state = "walk" set_animation(self, "walk") + + -- fly up/down randombly for flying mobs + if self.fly and random(1, 100) <= self.walk_chance then + + local v = self.object:getvelocity() + local ud = random(-1, 2) / 9 + + self.object:setvelocity({x = v.x, y = ud, z = v.z}) + end end end @@ -1476,12 +1469,15 @@ local do_states = function(self, dtime) z = lp.z - s.z } --- yaw = atan2(vec.z, vec.x) + pi / 2 yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate if lp.x > s.x then yaw = yaw + pi end + + -- look towards land and jump/move in that direction + yaw = set_yaw(self.object, yaw) + do_jump(self) + set_velocity(self, self.walk_velocity) else --- yaw = random() * 2 * pi yaw = (random(0, 360) - 180) / 180 * pi end @@ -1492,36 +1488,24 @@ local do_states = function(self, dtime) z = lp.z - s.z } --- yaw = atan2(vec.z, vec.x) + pi / 2 yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate if lp.x > s.x then yaw = yaw + pi end end - self.object:setyaw(yaw) --- set_yaw(self, yaw) + yaw = set_yaw(self.object, yaw) -- otherwise randomly turn elseif random(1, 100) <= 30 then yaw = random() * 2 * pi - self.object:setyaw(yaw) --- set_yaw(self, yaw) + yaw = set_yaw(self.object, yaw) end -- stand for great fall in front local temp_is_cliff = is_at_cliff(self) - -- jump when walking comes to a halt - if temp_is_cliff == false - and self.jump - and get_velocity(self) <= 0.5 - and self.object:getvelocity().y == 0 then - - do_jump(self) - end - if temp_is_cliff or random(1, 100) <= 30 then @@ -1558,14 +1542,6 @@ local do_states = function(self, dtime) set_animation(self, "walk") end - -- jump when walking comes to a halt - if self.jump - and get_velocity(self) <= 0.5 - and self.object:getvelocity().y == 0 then - - do_jump(self) - end - -- attack routines (explode, dogfight, shoot, dogshoot) elseif self.state == "attack" then @@ -1600,13 +1576,11 @@ local do_states = function(self, dtime) z = p.z - s.z } --- yaw = atan2(vec.z, vec.x) - pi / 2 yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate if p.x > s.x then yaw = yaw + pi end - self.object:setyaw(yaw) --- set_yaw(self, yaw) + yaw = set_yaw(self.object, yaw) if dist > self.reach then @@ -1620,12 +1594,6 @@ local do_states = function(self, dtime) self.timer = 0 self.blinktimer = 0 - if get_velocity(self) <= 0.5 - and self.object:getvelocity().y == 0 then - - do_jump(self) - end - set_velocity(self, self.run_velocity) end @@ -1655,9 +1623,6 @@ local do_states = function(self, dtime) local pos = self.object:getpos() local radius = self.explosion_radius or 1 - -- hurt player/mobs caught in blast area - entity_physics(pos, radius) - -- dont damage anything if area protected or next to water if minetest.find_node_near(pos, 1, {"group:water"}) or minetest.is_protected(pos, "") then @@ -1668,15 +1633,20 @@ local do_states = function(self, dtime) effect(pos, 15, "tnt_smoke.png") + -- hurt player/mobs caught in blast area + entity_physics(pos, radius) + return end pos.y = pos.y - 1 - mobs:explosion(pos, radius, 0, 1, self.sounds.explode) + mobs:explosion(pos, radius, 1, 1, self.sounds.explode) self.object:remove() + entity_physics(pos, radius) + return end end @@ -1688,14 +1658,12 @@ local do_states = function(self, dtime) if self.fly and dist > self.reach then - local nod = node_ok(s) local p1 = s local me_y = floor(p1.y) local p2 = p local p_y = floor(p2.y + 1) local v = self.object:getvelocity() --- if nod.name == self.fly_in then if flight_check(self, s) then if me_y < p_y then @@ -1768,13 +1736,11 @@ local do_states = function(self, dtime) z = p.z - s.z } --- yaw = atan2(vec.z, vec.x) - pi / 2 yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate if p.x > s.x then yaw = yaw + pi end - self.object:setyaw(yaw) --- set_yaw(self, yaw) + yaw = set_yaw(self.object, yaw) -- move towards enemy if beyond mob reach if dist > self.reach then @@ -1786,16 +1752,6 @@ local do_states = function(self, dtime) smart_mobs(self, s, p, dist, dtime) end - -- jump attack - if (self.jump - and get_velocity(self) <= 0.5 - and self.object:getvelocity().y == 0) - or (self.object:getvelocity().y == 0 - and self.jump_chance > 0) then - - do_jump(self) - end - if is_at_cliff(self) then set_velocity(self, 0) @@ -1835,10 +1791,9 @@ local do_states = function(self, dtime) local p2 = p local s2 = s - p2.y = p2.y + .5--1.5 - s2.y = s2.y + .5--1.5 + p2.y = p2.y + .5 + s2.y = s2.y + .5 --- if line_of_sight_water(self, p2, s2) == true then if line_of_sight(self, p2, s2) == true then -- play attack sound @@ -1880,13 +1835,11 @@ local do_states = function(self, dtime) z = p.z - s.z } --- yaw = atan2(vec.z, vec.x) - pi / 2 yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate if p.x > s.x then yaw = yaw + pi end - self.object:setyaw(yaw) --- set_yaw(self, yaw) + yaw = set_yaw(self.object, yaw) set_velocity(self, 0) @@ -1920,6 +1873,8 @@ local do_states = function(self, dtime) vec.z = vec.z * (v / amount) obj:setvelocity(vec) + else + obj:remove() -- arrow entity does not exist end end end @@ -1948,7 +1903,8 @@ local falling = function(self, pos) end -- in water then float up - if minetest.registered_nodes[node_ok(pos).name].groups.liquid then +-- if minetest.registered_nodes[node_ok(pos).name].groups.liquid then + if minetest.registered_nodes[node_ok(pos).name].groups.water then if self.floats == 1 then @@ -1970,7 +1926,7 @@ local falling = function(self, pos) if self.fall_damage == 1 and self.object:getvelocity().y == 0 then - local d = self.old_y - self.object:getpos().y + local d = (self.old_y or 0) - self.object:getpos().y if d > 5 then @@ -1978,7 +1934,7 @@ local falling = function(self, pos) effect(pos, 5, "tnt_smoke.png", 1, 2, 2, nil) - if check_for_death(self) then + if check_for_death(self, "fall") then return end end @@ -1989,8 +1945,14 @@ local falling = function(self, pos) end +-- deal damage and effects when mob punched local mob_punch = function(self, hitter, tflp, tool_capabilities, dir) + -- mob health check + if self.health <= 0 then + return + end + -- error checking when mod profiling is enabled if not tool_capabilities then print (S("[MOBS] mod profiling enabled, damage not enabled")) @@ -2096,9 +2058,15 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir) -- do damage self.health = self.health - floor(damage) - -- exit here if dead - if check_for_death(self) then - return + -- exit here if dead, special item check + if weapon:get_name() == "mobs:pick_lava" then + if check_for_death(self, "lava") then + return + end + else + if check_for_death(self, "hit") then + return + end end --[[ add healthy afterglow when hit (can cause hit lag with larger textures) @@ -2112,7 +2080,7 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir) -- knock back effect (only on full punch) if self.knock_back > 0 - and tflp > punch_interval then + and tflp >= punch_interval then local v = self.object:getvelocity() local r = 1.4 - min(punch_interval, 1.4) @@ -2156,18 +2124,20 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir) yaw = yaw + pi end - set_yaw(self, yaw) + yaw = set_yaw(self.object, yaw) self.state = "runaway" self.runaway_timer = 0 self.following = nil end + local name = hitter:get_player_name() or "" + -- attack puncher and call other mobs for help if self.passive == false and self.state ~= "flop" and self.child == false and hitter:get_player_name() ~= self.owner - and not mobs.invis[ hitter:get_player_name() ] then + and not mobs.invis[ name ] then -- attack whoever punched mob self.state = "" @@ -2183,21 +2153,74 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir) if obj then + -- only alert members of same mob if obj.group_attack == true - and obj.state ~= "attack" then + and obj.state ~= "attack" + and obj.owner ~= name + and obj.name == self.name then do_attack(obj, hitter) end + + -- have owned mobs attack player threat + if obj.owner == name and obj.owner_loyal then + do_attack(obj, self.object) + end end end end end -local mob_activate = function(self, staticdata, dtime_s, def) +-- get entity staticdata +local mob_staticdata = function(self) + + -- remove mob when out of range unless tamed + if remove_far + and self.remove_ok + and not self.tamed + and self.lifetimer < 20000 then + + --print ("REMOVED " .. self.name) + + self.object:remove() + + return ""-- nil + end + + self.remove_ok = true + self.attack = nil + self.following = nil + self.state = "stand" + + -- used to rotate older mobs + if self.drawtype + and self.drawtype == "side" then + self.rotate = math.rad(90) + end + + local tmp = {} + + for _,stat in pairs(self) do + + local t = type(stat) + + if t ~= "function" + and t ~= "nil" + and t ~= "userdata" then + tmp[_] = self[_] + end + end + + --print('===== '..self.name..'\n'.. dump(tmp)..'\n=====\n') + return minetest.serialize(tmp) +end + + +-- activate mob and reload settings +local mob_activate = function(self, staticdata, def) -- remove monsters in peaceful mode, or when no data - if (self.type == "monster" and peaceful_only) - or not staticdata then + if (self.type == "monster" and peaceful_only) then self.object:remove() @@ -2208,7 +2231,6 @@ local mob_activate = function(self, staticdata, dtime_s, def) local tmp = minetest.deserialize(staticdata) if tmp then - for _,stat in pairs(tmp) do self[_] = stat end @@ -2217,6 +2239,11 @@ local mob_activate = function(self, staticdata, dtime_s, def) -- select random texture, set model and size if not self.base_texture then + -- compatiblity with old simple mobs textures + if type(def.textures[1]) == "string" then + def.textures = {def.textures} + end + self.base_texture = def.textures[random(1, #def.textures)] self.base_mesh = def.mesh self.base_size = self.visual_size @@ -2288,16 +2315,15 @@ local mob_activate = function(self, staticdata, dtime_s, def) -- set anything changed above self.object:set_properties(self) --- set_yaw(self, random() * 2 * pi) - self.object:setyaw((random(0, 360) - 180) / 180 * pi) + set_yaw(self.object, (random(0, 360) - 180) / 180 * pi) update_tag(self) end +-- main mob function local mob_step = function(self, dtime) local pos = self.object:getpos() --- local yaw = self.yaw local yaw = 0 -- when lifetimer expires remove mob (except npc and tamed) @@ -2404,6 +2430,8 @@ local mob_step = function(self, dtime) do_states(self, dtime) + do_jump(self) + end @@ -2423,17 +2451,14 @@ end mobs.spawning_mobs = {} --- register mob function +-- register mob entity function mobs:register_mob(name, def) mobs.spawning_mobs[name] = true minetest.register_entity(name, { ---automatic_face_movement_dir = def.rotate and math.rad(def.rotate) or false, ---automatic_face_movement_max_rotation_per_sec = -1, - - stepheight = def.stepheight or 0.6, + stepheight = def.stepheight or 1.1, -- was 0.6 name = name, type = def.type, attack_type = def.attack_type, @@ -2443,8 +2468,7 @@ minetest.register_entity(name, { order = def.order or "", on_die = def.on_die, do_custom = def.do_custom, - jump_height = def.jump_height or 6, - jump_chance = def.jump_chance or 0, + jump_height = def.jump_height or 4, -- was 6 drawtype = def.drawtype, -- DEPRECATED, use rotate instead rotate = math.rad(def.rotate or 0), -- 0=front, 90=side, 180=back, 270=side2 lifetimer = def.lifetimer or 180, -- 3 minutes @@ -2473,7 +2497,7 @@ minetest.register_entity(name, { sounds = def.sounds or {}, animation = def.animation, follow = def.follow, - jump = def.jump or true, + jump = def.jump ~= false, walk_chance = def.walk_chance or 50, attacks_monsters = def.attacks_monsters or false, group_attack = def.group_attack or false, @@ -2514,8 +2538,10 @@ minetest.register_entity(name, { dogshoot_switch = def.dogshoot_switch, dogshoot_count = 0, dogshoot_count_max = def.dogshoot_count_max or 5, + dogshoot_count2_max = def.dogshoot_count2_max or (def.dogshoot_count_max or 5), attack_animals = def.attack_animals or false, specific_attack = def.specific_attack, + owner_loyal = def.owner_loyal, on_blast = def.on_blast or do_tnt, @@ -2523,51 +2549,12 @@ minetest.register_entity(name, { on_punch = mob_punch, - on_activate = function(self, staticdata, dtime_s) - mob_activate(self, staticdata, dtime_s, def) + on_activate = function(self, staticdata) + return mob_activate(self, staticdata, def) end, get_staticdata = function(self) - - -- remove mob when out of range unless tamed - if remove_far - and self.remove_ok - and not self.tamed - and self.lifetimer < 20000 then - - --print ("REMOVED " .. self.name) - - self.object:remove() - - return nil - end - - self.remove_ok = true - self.attack = nil - self.following = nil - self.state = "stand" - - -- used to rotate older mobs - if self.drawtype - and self.drawtype == "side" then - self.rotate = math.rad(90) - end - - local tmp = {} - - for _,stat in pairs(self) do - - local t = type(stat) - - if t ~= 'function' - and t ~= 'nil' - and t ~= 'userdata' then - tmp[_] = self[_] - end - end - - -- print('===== '..self.name..'\n'.. dump(tmp)..'\n=====\n') - return minetest.serialize(tmp) + return mob_staticdata(self) end, }) @@ -2578,7 +2565,8 @@ end -- END mobs:register_mob function -- count how many mobs of one type are inside an area local count_mobs = function(pos, type) - local num = 0 + local num_type = 0 + local num_total = 0 local objs = minetest.get_objects_inside_radius(pos, aoc_range) for n = 1, #objs do @@ -2587,14 +2575,21 @@ local count_mobs = function(pos, type) local obj = objs[n]:get_luaentity() - if obj and obj.name and obj.name == type then -- mob type count - --if obj and obj.name and obj.health ~= nil then -- all mob count - num = num + 1 + -- count mob type and add to total also + if obj and obj.name and obj.name == type then + + num_type = num_type + 1 + num_total = num_total + 1 + + -- add to total mobs + elseif obj and obj.name and obj.health ~= nil then + + num_total = num_total + 1 end end end - return num + return num_type, num_total end @@ -2639,9 +2634,9 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, end -- do not spawn if too many of same mob in area - if active_object_count_wider >= aoc - and count_mobs(pos, name) >= aoc then ---print ("--- too many entities", name, aoc) + if active_object_count_wider >= max_per_block + or count_mobs(pos, name) >= aoc then +--print ("--- too many entities", name, aoc, active_object_count_wider) return end @@ -2921,7 +2916,6 @@ function mobs:register_arrow(name, def) local node = node_ok(pos).name if minetest.registered_nodes[node].walkable then - --if node ~= "air" then self.hit_node(self, pos, node) @@ -2979,7 +2973,7 @@ function mobs:register_arrow(name, def) end --- Spawn Egg +-- register spawn eggs function mobs:register_egg(mob, desc, background, addegg, no_creative) local grp = {} @@ -2996,6 +2990,56 @@ function mobs:register_egg(mob, desc, background, addegg, no_creative) "^[mask:mobs_chicken_egg_overlay.png)" end + -- register new spawn egg containing mob information + minetest.register_craftitem(mob .. "_set", { + + description = desc .. " (Tamed)", + inventory_image = invimg, + groups = {not_in_creative_inventory = 1}, + stack_max = 1, + + on_place = function(itemstack, placer, pointed_thing) + + local pos = pointed_thing.above + + -- am I clicking on something with existing on_rightclick function? + local under = minetest.get_node(pointed_thing.under) + local def = minetest.registered_nodes[under.name] + if def and def.on_rightclick then + return def.on_rightclick(pointed_thing.under, under, placer, itemstack) + end + + if pos + and within_limits(pos, 0) + and not minetest.is_protected(pos, placer:get_player_name()) then + + pos.y = pos.y + 1 + + local data = itemstack:get_metadata() + local mob = minetest.add_entity(pos, mob, data) + local ent = mob:get_luaentity() + + if not ent then + mob:remove() + return + end + + if ent.type ~= "monster" then + -- set owner and tame if not monster + ent.owner = placer:get_player_name() + ent.tamed = true + end + + -- since mob is unique we remove egg once spawned + itemstack:take_item() + end + + return itemstack + end, + }) + + + -- register old stackable mob egg minetest.register_craftitem(mob, { description = desc, @@ -3043,180 +3087,154 @@ function mobs:register_egg(mob, desc, background, addegg, no_creative) end, }) - -- spawn egg containing mob information - minetest.register_craftitem(mob .. "_set", { - - description = desc .. " (set)", - inventory_image = invimg, - groups = {not_in_creative_inventory = 1}, - stack_max = 1, - - on_place = function(itemstack, placer, pointed_thing) - - local pos = pointed_thing.above - - -- am I clicking on something with existing on_rightclick function? - local under = minetest.get_node(pointed_thing.under) - local def = minetest.registered_nodes[under.name] - if def and def.on_rightclick then - return def.on_rightclick(pointed_thing.under, under, placer, itemstack) - end - - if pos - and within_limits(pos, 0) - and not minetest.is_protected(pos, placer:get_player_name()) then - - pos.y = pos.y + 1 - - local data = itemstack:get_metadata() - local mob = minetest.add_entity(pos, mob, data) - local ent = mob:get_luaentity() - - if not ent then - mob:remove() - return - end - - if ent.type ~= "monster" then - -- set owner and tame if not monster - ent.owner = placer:get_player_name() - ent.tamed = true - end - - -- if not in creative then take item - if not creative then - itemstack:take_item() - end - end - - return itemstack - end, - }) end -- capture critter (thanks to blert2112 for idea) function mobs:capture_mob(self, clicker, chance_hand, chance_net, chance_lasso, force_take, replacewith) - if not self.child - and clicker:is_player() - and clicker:get_inventory() then - - -- get name of clicked mob - local mobname = self.name - - -- if not nil change what will be added to inventory - if replacewith then - mobname = replacewith - end - - local name = clicker:get_player_name() - - -- is mob tamed? - if self.tamed == false - and force_take == false then - - minetest.chat_send_player(name, S("Not tamed!")) - - return - end - - -- cannot pick up if not owner - if self.owner ~= name - and force_take == false then - - minetest.chat_send_player(name, S("@1 is owner!", self.owner)) - - return - end - - if clicker:get_inventory():room_for_item("main", mobname) then - - -- was mob clicked with hand, net, or lasso? - local tool = clicker:get_wielded_item() - local chance = 0 - - if tool:is_empty() then - chance = chance_hand - - elseif tool:get_name() == "mobs:net" then - - chance = chance_net - - tool:add_wear(4000) -- 17 uses - - clicker:set_wielded_item(tool) - - elseif tool:get_name() == "mobs:magic_lasso" then - - chance = chance_lasso - - tool:add_wear(650) -- 100 uses - - clicker:set_wielded_item(tool) - end - - -- return if no chance - if chance == 0 then return end - - -- calculate chance.. add to inventory if successful? - if random(1, 100) <= chance then - --- add special mob egg containing all mob information -local new_stack = ItemStack(mobname .. "_set") -local tmp = {} -for _,stat in pairs(self) do - local t = type(stat) - if t ~= 'function' - and t ~= 'nil' - and t ~= 'userdata' then - tmp[_] = self[_] - end -end -local data_str = minetest.serialize(tmp) -local inv = clicker:get_inventory() -new_stack:set_metadata(data_str) -if inv:room_for_item("main", new_stack) then - inv:add_item("main", new_stack) -else - minetest.add_item(clicker:getpos(), new_stack) -end - --- clicker:get_inventory():add_item("main", mobname) - - self.object:remove() - else - minetest.chat_send_player(name, S("Missed!")) - end - end - end -end - - --- protect tamed mob with rune iten -function mobs:protect(self, clicker) - - local name = clicker:get_player_name() - - if self.tamed == false then - minetest.chat_send_player(name, S("Not tamed!")) + if self.child + or not clicker:is_player() + or not clicker:get_inventory() then return false end - local tool = clicker:get_wielded_item() + -- get name of clicked mob + local mobname = self.name - if tool:get_name() == "mobs:protector" then - - tool:take_item() -- take 1 protection rune - clicker:set_wielded_item(tool) - - self.protected = true - minetest.chat_send_player(name, S("Protected!")) - - return true + -- if not nil change what will be added to inventory + if replacewith then + mobname = replacewith end - return false + local name = clicker:get_player_name() + local tool = clicker:get_wielded_item() + + -- are we using hand, net or lasso to pick up mob? + if tool:get_name() ~= "" + and tool:get_name() ~= "mobs:net" + and tool:get_name() ~= "mobs:magic_lasso" then + return false + end + + -- is mob tamed? + if self.tamed == false + and force_take == false then + + minetest.chat_send_player(name, S("Not tamed!")) + + return true -- false + end + + -- cannot pick up if not owner + if self.owner ~= name + and force_take == false then + + minetest.chat_send_player(name, S("@1 is owner!", self.owner)) + + return true -- false + end + + if clicker:get_inventory():room_for_item("main", mobname) then + + -- was mob clicked with hand, net, or lasso? + local chance = 0 + + if tool:get_name() == "" then + chance = chance_hand + + elseif tool:get_name() == "mobs:net" then + + chance = chance_net + + tool:add_wear(4000) -- 17 uses + + clicker:set_wielded_item(tool) + + elseif tool:get_name() == "mobs:magic_lasso" then + + chance = chance_lasso + + tool:add_wear(650) -- 100 uses + + clicker:set_wielded_item(tool) + + end + + -- calculate chance.. add to inventory if successful? + if chance > 0 and random(1, 100) <= chance then + + -- default mob egg + local new_stack = ItemStack(mobname) + + -- add special mob egg with all mob information + -- unless 'replacewith' contains new item to use + if not replacewith then + + new_stack = ItemStack(mobname .. "_set") + + local tmp = {} + + for _,stat in pairs(self) do + local t = type(stat) + if t ~= "function" + and t ~= "nil" + and t ~= "userdata" then + tmp[_] = self[_] + end + end + + local data_str = minetest.serialize(tmp) + + new_stack:set_metadata(data_str) + end + + local inv = clicker:get_inventory() + + if inv:room_for_item("main", new_stack) then + inv:add_item("main", new_stack) + else + minetest.add_item(clicker:getpos(), new_stack) + end + + self.object:remove() + + else + minetest.chat_send_player(name, S("Missed!")) + end + end + + return true +end + + +-- protect tamed mob with rune item +function mobs:protect(self, clicker) + + local name = clicker:get_player_name() + local tool = clicker:get_wielded_item() + + if tool:get_name() ~= "mobs:protector" then + return false + end + + if self.tamed == false then + minetest.chat_send_player(name, S("Not tamed!")) + return true -- false + end + + if self.protected == true then + minetest.chat_send_player(name, S("Already protected!")) + return true -- false + end + + tool:take_item() -- take 1 protection rune + clicker:set_wielded_item(tool) + + self.protected = true + minetest.chat_send_player(name, S("Protected!")) + + return true end @@ -3348,6 +3366,11 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) return end + -- limit name entered to 64 characters long + if string.len(fields.name) > 64 then + fields.name = string.sub(fields.name, 1, 64) + end + -- update nametag mob_obj[name].nametag = fields.name diff --git a/mods/mobs_redo/api.txt b/mods/mobs_redo/api.txt index 21a778e..dd56748 100644 --- a/mods/mobs_redo/api.txt +++ b/mods/mobs_redo/api.txt @@ -1,5 +1,5 @@ -MOB API (31st January 2017) +MOB API (12th May 2017) The mob api is a function that can be called on by other mods to add new animals or monsters into minetest. @@ -25,6 +25,7 @@ This functions registers a new mob as a Minetest entity. 'docile_by_day' when true, mob will not attack during daylight hours unless provoked 'attacks_monsters' usually for npc's to attack monsters in area 'group_attack' true to defend same kind of mobs from attack in area + 'owner_loyal' when true owned mobs will attack any monsters you punch 'attack_animals' true for monster to attack animals as well as player and npc's 'specific_attack' has a table of entity names that monsters can attack {"player", "mobs_animal:chicken"} 'hp_min' minimum health @@ -42,14 +43,13 @@ This functions registers a new mob as a Minetest entity. 'makes_footstep_sound' same is in minetest.register_entity() 'follow' item when held will cause mob to follow player, can be single string "default:apple" or table {"default:apple", "default:diamond"} 'view_range' the range in that the monster will see the playerand follow him - 'walk_chance' chance of mob walking around - 'jump_chance' chance of mob jumping around, set above to 0 for jumping mob only + 'walk_chance' chance of mob walking around, set above to 0 for jumping mob only 'walk_velocity' the velocity when the monster is walking around 'run_velocity' the velocity when the monster is attacking a player 'runaway' when true mob will turn and run away when punched 'stepheight' minimum node height mob can walk onto without jumping (default: 0.6) 'jump' can mob jump, true or false - 'jump_height' height mob can jump, default is 6 + 'jump_height' height mob can jump, default is 6 (0 to disable jump) 'fly' can mob fly, true or false (used for swimming mobs also) 'fly_in' node name that mob flys inside, e.g "air", "default:water_source" for fish 'damage' the damage per second @@ -83,7 +83,8 @@ This functions registers a new mob as a Minetest entity. 'explode' follows player in range and will flash and explode when in reach 'dogshoot' shoots arrows when in range and one on one attack when in reach 'dogshoot_switch' allows switching between shoot and dogfight modes inside dogshoot using timer (1 = shoot, 2 = dogfight) - 'dogshoot_count_max' number of seconds before switching above modes. + 'dogshoot_count_max' number of seconds before switching to dogfight mode. + 'dogshoot_count2_max' number of seconds before switching back to shoot mode. 'custom_attack' is a function that is called when mob is in range to attack player, parameters are (self, to_attack) 'double_melee_attack' if false then api will choose randomly between 'punch' and 'punch2' attack animations 'on_blast' is called when TNT explodes near mob, function uses (object, damage) and returns (do_damage, do_knockback, drops) @@ -102,35 +103,31 @@ This functions registers a new mob as a Minetest entity. 'jump' sound when jumping 'explode' sound when exploding 'distance' maximum distance sounds are heard from (default is 10) - 'animation' a table with the animation ranges and speed of the model - 'stand_start' start frame of stand animation - 'stand_end' end frame of stand animation - 'walk_start' start frame of walk animation - 'walk_end' end frame of walk animation - 'run_start' start frame of run animation - 'run_end' end frame of run animation - 'punch_start' start frame of punch animation - 'punch_end' end frame of punch animation - 'punch2_start' start frame of alt.punch animation - 'punch2_end' end frame of alt.punch animation - 'shoot_start' start frame of shoot animation - 'shoot_end' end frame of shoot animation - 'die_start' start frame of die animation - 'die_end' end frame of die animation - 'speed_normal' normal animation speed - 'fly_start' start frame of fly animation - 'fly_end' end frame of fly animation - 'speed_run' running animation speed - 'speed_punch' punching animation speed - 'speed_punch2' alternative punching animation speed - 'speed_shoot' shooting animation speed - 'speed_die' die animation speed - 'speed_fly' fly animation speed + +Mobs can look for specific nodes as they walk and replace them to mimic eating + 'replace_what' group if items to replace e.g. {"farming:wheat_8", "farming:carrot_8"} 'replace_with' replace with what e.g. "air" or in chickens case "mobs:egg" 'replace_rate' how random should the replace rate be (typically 10) 'replace_offset' +/- value to check specific node to replace +The 'replace_what' has been updated to use tables for what, with and y_offset e.g. + + replace_what = { {"group:grass", "air", 0}, {"default:dirt_with_grass", "default:dirt", -1} } + +Mob animation comes in three parts, start_frame, end_frame and frame_speed which +can be added to the mob definition under pre-defined mob animation names like: + + 'animation' a table with the animation ranges and speed of the model + 'stand_start', 'stand_end', 'stand_speed' when mob stands still + 'walk_start', 'walk_end', 'walk_speed' when mob walks + 'run_start', 'run_end', 'run_speed' when mob runs + 'fly_start', 'fly_end', 'fly_speed' when mob flies + 'punch_start', 'punch_end', 'punch_speed' when mob attacks + 'punch2_start', 'punch2_end', 'punch2_speed' when mob attacks (alternative) + 'die_start', 'die_end', 'die_speed' when mob dies +also 'speed_normal' for compatibility with older mobs for animation speed (deprecated) + The mob api also has some preset variables and functions that it will remember for each mob @@ -139,8 +136,9 @@ The mob api also has some preset variables and functions that it will remember f 'self.child' used for when breeding animals have child, will use child_texture and be half size 'self.owner' string used to set owner of npc mobs, typically used for dogs 'self.order' set to "follow" or "stand" so that npc will follow owner or stand it's ground + 'self.nametag' contains the name of the mob which it can show above 'on_die' a function that is called when mob is killed - 'do_custom' a custom function that is called while mob is active and which has access to all of the self.* variables e.g. (self.health for health or self.standing_in for node status), return with 'false' to skip remainder of mob API. + 'do_custom' a custom function that is called every tick while mob is active and which has access to all of the self.* variables e.g. (self.health for health or self.standing_in for node status), return with 'false' to skip remainder of mob API. mobs:register_spawn(name, nodes, max_light, min_light, chance, active_object_count, max_height, day_toggle) @@ -157,7 +155,7 @@ These functions register a spawn algorithm for the mob. Without this function th 'interval' is same as in register_abm() (default is 30 for mobs:register_spawn) 'chance' is same as in register_abm() 'active_object_count' mob is only spawned if active_object_count_wider of ABM is <= this - 'min_height' is the maximum height the mob can spawn + 'min_height' is the minimum height the mob can spawn 'max_height' is the maximum height the mob can spawn 'day_toggle' true for day spawning, false for night or nil for anytime 'on_spawn' is a custom function which runs after mob has spawned and gives self and pos values. @@ -235,12 +233,12 @@ This function is generally called inside the on_rightclick section of the mob ap 'chance_net' chance of capturing mob using net (1 to 100) 0 to disable 'chance_lasso' chance of capturing mob using magic lasso (1 to 100) 0 to disable 'force_take' take mob by force, even if tamed (true or false) - 'replacewith' once captured replace mob with this item instead + 'replacewith' once captured replace mob with this item instead (overrides new mob eggs with saved information) mobs:feed_tame(self, clicker, feed_count, breed) -This function allows the mob to be fed the item inside self.follow be it apple, wheat or whatever a set number of times and be tamed or bred as a result. +This function allows the mob to be fed the item inside self.follow be it apple, wheat or whatever a set number of times and be tamed or bred as a result. Will return true when mob is fed with item it likes. 'self' mob information 'clicker' player information @@ -251,7 +249,7 @@ This function allows the mob to be fed the item inside self.follow be it apple, mobs:protect(self, clicker) -This function can be used to right-click any tamed mob with mobs:protector item, this will protect the mob from harm inside of a protected area from other players. +This function can be used to right-click any tamed mob with mobs:protector item, this will protect the mob from harm inside of a protected area from other players. Will return true when mob right-clicked with mobs:protector item. 'self' mob information 'clicker' player information @@ -298,6 +296,27 @@ This function allows an attached player to move the mob around and animate it at 'dtime' tick time used inside drive function +mobs:fly(self, dtime, speed, can_shoot, arrow_entity, move_animation, stand_animation) + +This function allows an attached player to fly the mob around using directional controls. + + 'self' mob information + 'dtime' tick time used inside fly function + 'speed' speed of flight + 'can_shoot' true if mob can fire arrow (sneak and left mouse button fires) + 'arrow_entity' name of arrow entity used for firing + 'move_animation' string containing movement animation e.g. "walk" + 'stand_animation' string containing movement animation e.g. "stand" + + +mobs:set_animation(self, name) + +This function sets the current animation for mob, defaulting to "stand" if not found. + + 'self' mob information + 'name' name of animation + + Certain variables need to be set before using the above functions: 'self.v2' toggle switch diff --git a/mods/mobs_redo/locale/tr.txt b/mods/mobs_redo/locale/tr.txt new file mode 100644 index 0000000..3f2833e --- /dev/null +++ b/mods/mobs_redo/locale/tr.txt @@ -0,0 +1,39 @@ +# Türkçe çeviri by Admicos +# Turkish translation by Admicos + +# Son düzenleme: 26 Nisan 2017 +# Last edit: 26 April 2017 + +#init.lua +[MOD] Mobs Redo loaded = [MOD] Mobs Red yüklendi + +#api.lua +[MOBS] mod profiling enabled, damage not enabled = [MOBS] profilleme açık, zarar kapalı +lifetimer expired, removed @1 = Can zamanlayıcısı bitti, @1 silindi +[Mobs Redo] @1 has spawning disabled = @1 yaratılması kapandı +[Mobs Redo] Chance setting for @1 is now @2 = [Mobs Redo] @1'in şans ayarı şimdi @2 +[mobs] @1 failed to spawn at @2 = @1, @2'de yaratılamadı +Not tamed! = Evcil değil! +@1 is owner! = Sahibi @1! +Missed! = Kaçırdın! +@1 at full health (@2) = @1 tam canında (@2) +@1 has been tamed! = @1 tamamen evcilleştirilmiştir! +Enter name: = İsim gir: +Rename = Yeniden adlandır + +#crafts.lua +Nametag = İsim etiketi +Leather = Deri +Raw Meat = Çiğ et +Meat = Et +Magic Lasso (right-click animal to put in inventory) = Sihirli kement (hayvana sağ tıklayarak envantere koy) +Net (right-click animal to put in inventory) = Ağ (hayvana sağ tıklayarak envantere koy) +Steel Shears (right-click to shear) = Çelik makas (sağ tıklayarak kes) + +#spawner.lua +Mob Spawner = Canavar Yaratıcı +Mob MinLight MaxLight Amount PlayerDist = Mob MinIşık MaxIşık Miktar OyuncuMesafesi +Spawner Not Active (enter settings) = Yaratıcı aktif değil (ayarlara gir) +Spawner Active (@1) = Yaratıcı aktif (@1) +Mob Spawner settings failed! = Yaratıcı ayarları uygulanamadı. +> name min_light[0-14] max_light[0-14] max_mobs_in_area[0 to disable] distance[1-20] y_offset[-10 to 10] = > isim min_isik[0-14] max_isik[0-14] alandaki_max_canavar_sayisi[kapatmak icin 0] mesafe[1-20] y_cikinti[-10 ve 10 arası] \ No newline at end of file diff --git a/mods/mobs_redo/mount.lua b/mods/mobs_redo/mount.lua index ca86b8e..b26f8ac 100644 --- a/mods/mobs_redo/mount.lua +++ b/mods/mobs_redo/mount.lua @@ -141,7 +141,8 @@ function mobs.attach(entity, player) default.player_set_animation(player, "sit" , 30) end) - player:set_look_yaw(entity.object:getyaw() - rot_view) + --player:set_look_yaw(entity.object:getyaw() - rot_view) + player:set_look_horizontal(entity.object:getyaw() - rot_view) end @@ -196,10 +197,8 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime) entity.v = entity.v - entity.accel / 10 end - --entity.object:setyaw(entity.driver:get_look_yaw() - rot_steer) --- entity.object:setyaw(entity.driver:get_look_horizontal())-- - rot_steer) - -- fix mob rotation +-- entity.object:setyaw(entity.driver:get_look_yaw() - entity.rotate) entity.object:setyaw(entity.driver:get_look_horizontal() - entity.rotate) if can_fly then @@ -242,7 +241,7 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime) if entity.v == 0 and velo.x == 0 and velo.y == 0 and velo.z == 0 then if stand_anim then - set_animation(entity, stand_anim) + mobs:set_animation(entity, stand_anim) end return @@ -250,7 +249,7 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime) -- set moving animation if moving_anim then - set_animation(entity, moving_anim) + mobs:set_animation(entity, moving_anim) end -- Stop! @@ -340,9 +339,6 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime) else v = v * 0.25 end --- elseif ni == "walkable" then --- v = 0 --- new_acce.y = 1 end new_velo = get_velocity(v, entity.object:getyaw() - rot_view, velo.y) @@ -370,3 +366,72 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime) entity.v2 = v end + + +-- directional flying routine by D00Med (edited by TenPlus1) + +function mobs.fly(entity, dtime, speed, shoots, arrow, moving_anim, stand_anim) + + local ctrl = entity.driver:get_player_control() + local velo = entity.object:getvelocity() + local dir = entity.driver:get_look_dir() +-- local yaw = entity.driver:get_look_yaw() + local yaw = entity.driver:get_look_horizontal() + 1.57 -- offset fix between old and new commands + local rot_steer, rot_view = math.pi / 2, 0 + + if entity.player_rotation.y == 90 then + rot_steer, rot_view = 0, math.pi / 2 + end + + if ctrl.up then + entity.object:setvelocity({ + x = dir.x * speed, + y = dir.y * speed + 2, + z = dir.z * speed + }) + + elseif ctrl.down then + entity.object:setvelocity({ + x = -dir.x * speed, + y = dir.y * speed + 2, + z = -dir.z * speed + }) + + elseif not ctrl.down or ctrl.up or ctrl.jump then + entity.object:setvelocity({x = 0, y = -2, z = 0}) + end + + entity.object:setyaw(yaw + math.pi + math.pi / 2 - entity.rotate) + + -- firing arrows + if ctrl.LMB and ctrl.sneak and shoots then + + local pos = entity.object:getpos() + local obj = minetest.add_entity({ + x = pos.x + 0 + dir.x * 2.5, + y = pos.y + 1.5 + dir.y, + z = pos.z + 0 + dir.z * 2.5}, arrow) + + local ent = obj:get_luaentity() + if ent then + ent.switch = 1 -- for mob specific arrows + ent.owner_id = tostring(entity.object) -- so arrows dont hurt entity you are riding + local vec = {x = dir.x * 6, y = dir.y * 6, z = dir.z * 6} +-- local yaw = entity.driver:get_look_yaw() + local yaw = entity.driver:get_look_horizontal() + obj:setyaw(yaw + math.pi / 2) + obj:setvelocity(vec) + else + obj:remove() + end + end + + -- change animation if stopped + if velo.x == 0 and velo.y == 0 and velo.z == 0 then + + mobs:set_animation(entity, stand_anim) + else + -- moving animation + mobs:set_animation(entity, moving_anim) + end +end diff --git a/mods/mobs_redo/readme.MD b/mods/mobs_redo/readme.MD index 033bd53..20722c0 100644 --- a/mods/mobs_redo/readme.MD +++ b/mods/mobs_redo/readme.MD @@ -22,7 +22,9 @@ Lucky Blocks: 9 Changelog: - +- 1.36- Death check added, if mob dies in fire/lava/with lava pick then drops are cooked +- 1.35- Added owner_loyal flag for owned mobs to attack player enemies, also fixed group_attack +- 1.34- Added function to fly mob using directional movement (thanks D00Med for flying code) - 1.33- Added functions to mount ride mobs (mobs.attach, mobs.detach, mobs.drive) many thanks to Blert2112 - 1.32- Added new spawn check to count specific mobs AND new minetest.conf setting to chance spawn chance and numbers, added ability to protect tamed mobs - 1.31- Added 'attack_animals' and 'specific_attack' flags for custom monster attacks, also 'mob_difficulty' .conf setting to make mobs harder. diff --git a/mods/mobs_redo/spawner.lua b/mods/mobs_redo/spawner.lua index 9be2bf8..11ddfee 100644 --- a/mods/mobs_redo/spawner.lua +++ b/mods/mobs_redo/spawner.lua @@ -71,6 +71,9 @@ minetest.register_node("mobs:spawner", { end, }) + +local max_per_block = tonumber(minetest.setting_get("max_objects_per_block") or 99) + -- spawner abm minetest.register_abm({ label = "Mob spawner node", @@ -81,6 +84,11 @@ minetest.register_abm({ action = function(pos, node, active_object_count, active_object_count_wider) + -- return if too many entities already + if active_object_count_wider >= max_per_block then + return + end + -- get meta and command local meta = minetest.get_meta(pos) local comm = meta:get_string("command"):split(" ") @@ -98,17 +106,23 @@ minetest.register_abm({ return end + -- are we spawning a registered mob? + if not mobs.spawning_mobs[mob] then + --print ("--- mob doesn't exist", mob) + return + end + -- check objects inside 9x9 area around spawner local objs = minetest.get_objects_inside_radius(pos, 9) local count = 0 local ent = nil -- count mob objects of same type in area - for k, obj in pairs(objs) do + for k, obj in ipairs(objs) do ent = obj:get_luaentity() - if ent and ent.name == mob then + if ent and ent.name and ent.name == mob then count = count + 1 end end diff --git a/mods/mobs_redo/textures/mobs_meat.png b/mods/mobs_redo/textures/mobs_meat.png index 2608ea7..1d615d0 100644 Binary files a/mods/mobs_redo/textures/mobs_meat.png and b/mods/mobs_redo/textures/mobs_meat.png differ diff --git a/mods/mobs_redo/textures/mobs_meat_raw.png b/mods/mobs_redo/textures/mobs_meat_raw.png index 74d1695..e67cc1c 100644 Binary files a/mods/mobs_redo/textures/mobs_meat_raw.png and b/mods/mobs_redo/textures/mobs_meat_raw.png differ diff --git a/mods/moreplants/init.lua b/mods/moreplants/init.lua index bead456..0848a85 100644 --- a/mods/moreplants/init.lua +++ b/mods/moreplants/init.lua @@ -908,7 +908,7 @@ minetest.register_node("moreplants:palm", { minetest.register_node("moreplants:palmleaves2", { description = "Palm Leaves (2)", drawtype = "plantlike", - visual_scale = 2.5, + visual_scale = 5, tiles = {"moreplants_palmleaves2.png"}, inventory_image = "moreplants_palmleaves2.png", use_texture_alpha = true, @@ -927,7 +927,7 @@ minetest.register_node("moreplants:palmleaves2", { minetest.register_node("moreplants:palmleaves1", { description = "Palm Leaves (1)", drawtype = "signlike", - visual_scale = 4.0, + visual_scale = 5.0, tiles = {"moreplants_palmleaves.png"}, inventory_image = "moreplants_palmleaves.png", use_texture_alpha = true, diff --git a/mods/noairblocks/init.lua b/mods/noairblocks/init.lua deleted file mode 100644 index 8ff3b7b..0000000 --- a/mods/noairblocks/init.lua +++ /dev/null @@ -1,230 +0,0 @@ --- NODES - -minetest.register_node("noairblocks:water_flowingx", { - description = "Flowing Waterx", - inventory_image = minetest.inventorycube("default_water.png"), - drawtype = "flowingliquid", - tiles = {"default_water.png"}, - special_tiles = { - { - image="default_water_flowing_animated.png", - backface_culling=false, - animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.8} - }, - { - image="default_water_flowing_animated.png", - backface_culling=true, - animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.8} - }, - }, - alpha = 0, - paramtype = "light", - paramtype2 = "flowingliquid", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - drop = "", - drowning = 1, - liquidtype = "flowing", - liquid_alternative_flowing = "noairblocks:water_flowingx", - liquid_alternative_source = "noairblocks:water_sourcex", - liquid_viscosity = WATER_VISC, - freezemelt = "default:snow", - post_effect_color = {a = 103, r = 30, g = 60, b = 90}, - groups = {water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1, freezes=1, melt_around=1}, -}) - -minetest.register_node("noairblocks:water_sourcex", { - description = "Water Sourcex", - inventory_image = minetest.inventorycube("default_water.png"), - drawtype = "liquid", - tiles = { - {name="default_water_source_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0}} - }, - special_tiles = { - -- New-style water source material (mostly unused) - { - name="default_water_source_animated.png", - animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0}, - backface_culling = false, - } - }, - alpha = 0, - paramtype = "light", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - drop = "", - drowning = 1, - liquidtype = "source", - liquid_alternative_flowing = "noairblocks:water_flowingx", - liquid_alternative_source = "noairblocks:water_sourcex", - liquid_viscosity = WATER_VISC, - freezemelt = "default:ice", - post_effect_color = {a = 103, r = 30, g = 60, b = 90}, - groups = {water=3, liquid=3, puts_out_fire=1, freezes=1, not_in_creative_inventory=1}, -}) - - --- ABM'S - - --- 6 x default to noairblocks - - -minetest.register_abm({ -nodenames = {"group:sea"}, -interval = 1, -chance = 1, -action = function(pos, node, active_object_count, active_object_count_wider) - local xn = {x = pos.x - 1, y = pos.y, z = pos.z} - local yp= {x = pos.x, y = pos.y + 1, z = pos.z} - local xnyp= {x = pos.x - 1, y = pos.y + 1, z = pos.z} - if minetest.get_node(xn).name == "default:water_source" and - minetest.get_node(yp).name ~= "air" and - minetest.get_node(xnyp).name ~= "air" then - minetest.add_node(xn, {name = "noairblocks:water_sourcex"}) else - if minetest.get_node(xn).name == "default:water_flowing" and - minetest.get_node(yp).name ~= "air" and - minetest.get_node(xnyp).name ~= "air" then - minetest.add_node(xn, {name = "noairblocks:water_flowingx"}) else - return - end - end -end, -}) - -minetest.register_abm({ -nodenames = {"group:sea"}, -interval = 1, -chance = 1, -action = function(pos, node, active_object_count, active_object_count_wider) - local xp = {x = pos.x + 1, y = pos.y, z = pos.z} - local yp= {x = pos.x, y = pos.y + 1, z = pos.z} - local xpyp= {x = pos.x + 1, y = pos.y + 1, z = pos.z} - if minetest.get_node(xp).name == "default:water_source" and - minetest.get_node(yp).name ~= "air" and - minetest.get_node(xpyp).name ~= "air" then - minetest.add_node(xp, {name = "noairblocks:water_sourcex"}) else - if minetest.get_node(xp).name == "default:water_flowing" and - minetest.get_node(yp).name ~= "air" and - minetest.get_node(xpyp).name ~= "air" then - minetest.add_node(xp, {name = "noairblocks:water_flowingx"}) else - return - end - end -end, -}) - -minetest.register_abm({ -nodenames = {"group:sea"}, -interval = 1, -chance = 1, -action = function(pos, node, active_object_count, active_object_count_wider) - local zn = {x = pos.x, y = pos.y, z = pos.z - 1} - local yp= {x = pos.x, y = pos.y + 1, z = pos.z} - local znyp= {x = pos.x, y = pos.y + 1, z = pos.z - 1} - if minetest.get_node(zn).name == "default:water_source" and - minetest.get_node(yp).name ~= "air" and - minetest.get_node(znyp).name ~= "air" then - minetest.add_node(zn, {name = "noairblocks:water_sourcex"}) else - if minetest.get_node(zn).name == "default:water_flowing" and - minetest.get_node(yp).name ~= "air" and - minetest.get_node(znyp).name ~= "air" then - minetest.add_node(zn, {name = "noairblocks:water_flowingx"}) else - return - end - end -end, -}) - -minetest.register_abm({ -nodenames = {"group:sea"}, -interval = 1, -chance = 1, -action = function(pos, node, active_object_count, active_object_count_wider) - local zp = {x = pos.x, y = pos.y, z = pos.z + 1} - local yp= {x = pos.x, y = pos.y + 1, z = pos.z} - local zpyp= {x = pos.x, y = pos.y + 1, z = pos.z + 1} - if minetest.get_node(zp).name == "default:water_source" and - minetest.get_node(yp).name ~= "air" and - minetest.get_node(zpyp).name ~= "air" then - minetest.add_node(zp, {name = "noairblocks:water_sourcex"}) else - if minetest.get_node(zp).name == "default:water_flowing" and - minetest.get_node(yp).name ~= "air" and - minetest.get_node(zpyp).name ~= "air" then - minetest.add_node(zp, {name = "noairblocks:water_flowingx"}) else - return - end - end -end, -}) - -minetest.register_abm({ -nodenames = {"group:sea"}, -interval = 1, -chance = 1, -action = function(pos, node, active_object_count, active_object_count_wider) - local yp= {x = pos.x, y = pos.y + 1, z = pos.z} - if minetest.get_node(yp).name == "default:water_source" then - minetest.add_node(yp, {name = "noairblocks:water_sourcex"}) else - if minetest.get_node(yp).name == "default:water_flowing" then - minetest.add_node(yp, {name = "noairblocks:water_flowingx"}) else - return - end - end -end, -}) - -minetest.register_abm({ -nodenames = {"group:sea"}, -interval = 1, -chance = 1, -action = function(pos, node, active_object_count, active_object_count_wider) - local yn = {x = pos.x, y = pos.y - 1, z = pos.z} - local yp= {x = pos.x, y = pos.y + 1, z = pos.z} - if minetest.get_node(yn).name == "default:water_source" and - minetest.get_node(yp).name ~= "air" then - minetest.add_node(yn, {name = "noairblocks:water_sourcex"}) else - if minetest.get_node(yn).name == "default:water_flowing" and - minetest.get_node(yp).name ~= "air" then - minetest.add_node(yn, {name = "noairblocks:water_flowingx"}) else - return - end - end -end, -}) - - --- Undoing x - - -minetest.register_abm({ -nodenames = {"noairblocks:water_sourcex"}, -interval = 1, -chance = 1, -action = function(pos, node, active_object_count, active_object_count_wider) -local pos0 = {x=pos.x-1,y=pos.y-1,z=pos.z-1} -local pos1 = {x=pos.x+1,y=pos.y+1,z=pos.z+1} - if #minetest.find_nodes_in_area(pos0, pos1, "group:sea") < 1 then - minetest.add_node(pos, {name = "default:water_source"}) else - return - end -end, -}) - -minetest.register_abm({ -nodenames = {"noairblocks:water_flowingx"}, -interval = 1, -chance = 1, -action = function(pos, node, active_object_count, active_object_count_wider) -local pos0 = {x=pos.x-1,y=pos.y-1,z=pos.z-1} -local pos1 = {x=pos.x+1,y=pos.y+1,z=pos.z+1} - if #minetest.find_nodes_in_area(pos0, pos1, "group:sea") < 1 then - minetest.add_node(pos, {name = "default:water_flowing"}) else - return - end -end, -}) \ No newline at end of file diff --git a/mods/noairblocks/readme.txt b/mods/noairblocks/readme.txt deleted file mode 100644 index 9674ffa..0000000 --- a/mods/noairblocks/readme.txt +++ /dev/null @@ -1,12 +0,0 @@ -.png's: -default_water_source_animated.png -default_water_flowing_animated.png -RealBadAngel's animated water (WTFPL) - -Code: -minetest/games/minetest_game/mods/default/nodes.lua --> water - -Copyright (C) 2011-2012 celeron55, Perttu Ahola -GNU Lesser General Public License as published by -the Free Software Foundation; either version 2.1 of the License, or -(at your option) any later version. diff --git a/mods/quartz/textures/quartz.png b/mods/quartz/textures/quartz.png index 7201267..dea13d6 100644 Binary files a/mods/quartz/textures/quartz.png and b/mods/quartz/textures/quartz.png differ diff --git a/mods/quartz/textures/quartz_crystal_full.png b/mods/quartz/textures/quartz_crystal_full.png index 113cb2f..0a96c57 100644 Binary files a/mods/quartz/textures/quartz_crystal_full.png and b/mods/quartz/textures/quartz_crystal_full.png differ diff --git a/mods/quartz/textures/quartz_ore.png b/mods/quartz/textures/quartz_ore.png index 65d4fea..b312206 100644 Binary files a/mods/quartz/textures/quartz_ore.png and b/mods/quartz/textures/quartz_ore.png differ diff --git a/mods/sprint/init.lua b/mods/sprint/init.lua index 350ba51..1e69471 100644 --- a/mods/sprint/init.lua +++ b/mods/sprint/init.lua @@ -10,7 +10,7 @@ distributed without any warranty. --Configuration variables, these are all explained in README.md SPRINT_METHOD = 1 SPRINT_SPEED = 1.9 -SPRINT_JUMP = 1.5 +SPRINT_JUMP = 1.4 SPRINT_STAMINA = 5 SPRINT_TIMEOUT = 0.05 --Only used if SPRINT_METHOD = 0 diff --git a/mods/twilight/depends.txt b/mods/twilight/depends.txt index b960bd8..0ba9cc5 100644 --- a/mods/twilight/depends.txt +++ b/mods/twilight/depends.txt @@ -1,2 +1,2 @@ default -weather_pack \ No newline at end of file +hyrule_weather \ No newline at end of file diff --git a/mods/twilight/init.lua b/mods/twilight/init.lua index 2aa20b2..dd7492e 100644 --- a/mods/twilight/init.lua +++ b/mods/twilight/init.lua @@ -22,7 +22,6 @@ if minetest.setting_getbool("twilight") then --Vignette overlay from Vignette mod by TriBlade9(license MIT) minetest.register_on_joinplayer(function(player) - weather.state = "twilight" minetest.after(0,function() player:override_day_night_ratio(0.41) end) @@ -61,70 +60,9 @@ local name = player:get_player_name() end end) - ---weather, see weather pack twilight = {} -twilight.particles_count = 25 - --- calculates coordinates and draw particles for twilight weather -twilight.add_rain_particles = function(player, dtime) - rain.last_rp_count = 0 - for i=twilight.particles_count, 1,-1 do - local random_pos_x, random_pos_y, random_pos_z = weather.get_random_pos_by_player_look_dir(player) - random_pos_y = math.random() + math.random(player:getpos().y - 1, player:getpos().y + 7) - if minetest.get_node_light({x=random_pos_x, y=random_pos_y, z=random_pos_z}, 0.5) == 15 then - rain.last_rp_count = rain.last_rp_count + 1 - minetest.add_particle({ - pos = {x=random_pos_x, y=random_pos_y, z=random_pos_z}, - velocity = {x = math.random(-0.1,0.1), y = math.random(0.1,0.1), z = math.random(-0.1,0.1)}, - acceleration = {x = math.random(-0.1,0.1), y=0.1, z = math.random(-0.1,0.1)}, - expirationtime = 0.6, - size = math.random(0.5, 1), - collisiondetection = true, - vertical = true, - texture = twilight.get_texture(), - playername = player:get_player_name() - }) - end - end -end - - - --- Simple random texture getter -twilight.get_texture = function() - local texture_name - local random_number = math.random() - if random_number > 0.5 then - texture_name = "twilight_twilight1.png" - else - texture_name = "twilight_twilight2.png" - end - return texture_name; -end - -minetest.register_globalstep(function(dtime) - if weather.state ~= "twilight" then - return false - end - - for _, player in ipairs(minetest.get_connected_players()) do - if (weather.is_underwater(player)) then - return false - end - twilight.add_rain_particles(player, dtime) - end -end) - --- register twilight weather -if weather.reg_weathers.twilight == nil then - weather.reg_weathers.twilight = { - chance = 10, - clear = function() end - } -end twilight_mode = false --[[ @@ -152,8 +90,9 @@ local glow = nil minetest.register_globalstep(function(dtime) if twilight_mode == true then - weather.state = "twilight" for _, player in ipairs(minetest.get_connected_players()) do + hyrule_weather.current = 8 + hyrule_weather.weather = "twilight" player:set_sky({}, "skybox", twilightsky) -- Sets skybox player:override_day_night_ratio(0.41) local pname = player:get_player_name(); @@ -162,6 +101,19 @@ if twilight_mode == true then local remov = inv:remove_item("main", "hyruletools:sword") local add = inv:add_item("main", "hyruletools:sword_light") end + local pos = player:getpos() + minetest.add_particle({ + pos = {x=pos.x+math.random(-10,10), y=pos.y+math.random(0,1), z=pos.z+math.random(-10,10)}, + velocity = {x = math.random(-1,1)/10, y = 0.4, z = math.random(-1,1)/10}, + acceleration = {x = math.random(-1,1)/10, y=0.5, z = math.random(-1,1)/10}, + expirationtime = 0.8, + size = math.random(5, 20)/10, + collisiondetection = true, + collisionremoval = true, + vertical = true, + texture = "twilight_twilight"..math.random(1,2)..".png", + glow = 5 + }) if hud_changed == false then glow = player:hud_add({ hud_elem_type = "image", @@ -171,7 +123,7 @@ if twilight_mode == true then y = -100 }, text = "twilight_hud.png" - }) + }) hud_changed = true --player:set_properties({mesh = "wolfplayer.b3d", textures = {"wolfplayer.png"}}) --player:set_eye_offset({x=0,y=0,z=0}, {x=0,y=3,z=-3}) @@ -189,10 +141,11 @@ if twilight_mode == true then end else for _, player in ipairs(minetest.get_connected_players()) do - if weather.state == "twilight" then + if hyrule_weather.weather == "twilight" then player:set_sky({}, "regular", {}) -- Sets skybox player:override_day_night_ratio(nil) - weather.state = "none" + hyrule_weather.weather = "none" + hyrule_weather.current = 7 end local pname = player:get_player_name(); local inv = minetest.get_inventory({type="player", name=pname}); @@ -229,12 +182,12 @@ minetest.register_craftitem("twilight:crystal", { twilight_mode = false elseif twilight_mode == false then twilight_mode = true - if not midna_spawned then + if not midna_spawned and placer:get_player_name() == "singleplayer" then local pos = placer:getpos() local obj = minetest.env:add_entity({x=pos.x, y=pos.y+2, z=pos.z}, "mobs_loz:midna") local midna = obj:get_luaentity() - midna.owner = placer midna.tamed = true + midna.owner = "singleplayer" midna_spawned = true end return itemstack diff --git a/mods/vehicles_loz/api.lua b/mods/vehicles_loz/api.lua index f3a3dd8..c6978cc 100644 --- a/mods/vehicles_loz/api.lua +++ b/mods/vehicles_loz/api.lua @@ -1,4 +1,4 @@ ---vehicles/mounts api by D00Med, based on lib_mount(see below) +--vehicles/mounts api by D00Med and zaoqi, based on lib_mount(see below) --License of lib_mount: -- Minetest mod: lib_mount @@ -26,6 +26,8 @@ --attach position seems broken, and eye offset will cause problems if the vehicle/mount/player is destroyed whilst driving/riding +vehicles = {} + local function force_detach(player) local attached_to = player:get_attach() if attached_to and attached_to:get_luaentity() then @@ -36,11 +38,11 @@ local function force_detach(player) player:set_detach() end default.player_attached[player:get_player_name()] = false - player:set_eye_offset({x=0, y=0, z=0}, {x=0, y=0, z=0}) + player:set_eye_offset({x=0, y=0, z=0}, {x=3,y=3,z=-1}) player:set_properties({visual_size = {x=1, y=1}}) end -function object_attach(entity, player, attach_at, visible, eye_offset) +function vehicles.object_attach(entity, player, attach_at, visible, eye_offset) force_detach(player) entity.driver = player entity.loaded = true @@ -60,7 +62,7 @@ function object_attach(entity, player, attach_at, visible, eye_offset) entity.object:setyaw(player:get_look_yaw() - math.pi / 2) end -function object_detach(entity, player, offset) +function vehicles.object_detach(entity, player, offset) entity.driver = nil entity.object:setvelocity({x=0, y=0, z=0}) player:set_detach() @@ -102,11 +104,11 @@ timer = 0 --New vehicle function, combines all of the others -function object_drive(entity, dtime, def) +function vehicles.object_drive(entity, dtime, def) --definition local speed = def.speed or 10 local fixed = def.fixed or false - local decell = def.decell or 0 + local decell = def.decell or 0.5 local shoots = def.shoots or false local arrow = def.arrow or nil local reload_time = def.reload_time or 1 @@ -126,7 +128,7 @@ function object_drive(entity, dtime, def) local boost = def.boost or false local boost_duration = def.boost_duration or 5 local boost_charge = def.boost_charge or 4 - local boost_effect = def.boost_effect + local boost_effect = def.boost_effect or nil local hover_speed = def.hover_speed or 1.5 local jump_speed = def.jump_speed or 5 local simple_vehicle = def.simple_vehicle or false @@ -135,12 +137,22 @@ function object_drive(entity, dtime, def) local driving_sound = def.driving_sound or nil local sound_duration = def.sound_duration or 5 local extra_yaw = def.extra_yaw or 0 + local death_node = def.death_node or nil + local destroy_node = def.destroy_node or nil + local place_node = def.place_node or nil + local place_chance = def.place_chance or 1 + local place_trigger = def.place_trigger or nil + local animation_speed = def.animation_speed or 20 + local uses_arrow_keys = def.uses_arrow_keys or false + local brakes = def.brakes or false + local handling = def.handling or {initial=1.1, braking=2.2} + local braking_effect = def.braking_effect or "vehicles_dust.png" - local moving_anim = def.moving_anim - local stand_anim = def.stand_anim - local jump_anim = def.jump_anim - local shoot_anim = def.shoot_anim - local shoot_anim2 = def.shoot_anim2 + local moving_anim = def.moving_anim or nil + local stand_anim = def.stand_anim or nil + local jump_anim = def.jump_anim or nil + local shoot_anim = def.shoot_anim or nil + local shoot_anim2 = def.shoot_anim2 or nil --variables local ctrl = entity.driver:get_player_control() @@ -151,12 +163,14 @@ function object_drive(entity, dtime, def) local yaw = entity.driver:get_look_yaw(); local pos = entity.object:getpos() local node = minetest.get_node(pos).name + local node_under = minetest.get_node({x=pos.x, y=pos.y+2, z=pos.z}) local accell = 1 --dummy variables local vec_rise = {} local vec_forward_simple = {} local inv = nil + local hovering = nil --definition dependant variables if fly then @@ -172,6 +186,8 @@ function object_drive(entity, dtime, def) --timer local absolute_speed = math.sqrt(math.pow(velo.x, 2)+math.pow(velo.z, 2)) + --decell = (absolute_speed/100)+((def.decell)-(speed/100)) + local anim_speed = (math.floor(absolute_speed*1.5)/1)+animation_speed if absolute_speed <= speed and ctrl.up then timer = timer + 1*dtime end @@ -179,17 +195,6 @@ function object_drive(entity, dtime, def) timer = 0 end - --timer dependant variables - local vec_forward_hover = {x=dir.x*(speed*0.2)*math.log(timer+0.5)+4*dir.x,y=hover_speed,z=dir.z*(speed*0.2)*math.log(timer+0.5)+4*dir.z} - local vec_forward_jump = {x=dir.x*speed/4*math.atan(0.5*timer-2)+8*dir.x,y=jump_speed,z=dir.z*speed/4*math.atan(0.5*timer-2)+8*dir.z} - local vec_forward = {x=dir.x*(speed*0.2)*math.log(timer+0.5)+4*dir.x,y=velo.y-0.5,z=dir.z*(speed*0.2)*math.log(timer+0.5)+4*dir.z} - local boat_forward = {x=dir.x*(speed*0.2)*math.log(timer+0.5)+4*dir.x,y=0,z=dir.z*(speed*0.2)*math.log(timer+0.5)+4*dir.z} - local vec_forward_fly = {x=dir.x*(speed*0.2)*math.log(timer+0.5)+4*dir.x,y=dir.y*(speed*0.2)*math.log(timer+0.5)+4*dir.y+1,z=dir.z*(speed*0.2)*math.log(timer+0.5)+4*dir.z} - local vec_boost = {x=dir.x*(speed*0.2)*math.log(timer+0.5)+8*dir.x,y=velo.y-0.5,z=dir.z*(speed*0.2)*math.log(timer+0.5)+8*dir.z} - local vec_backward = {x=-dir.x*(speed/4)*accell,y=velo.y-0.5,z=-dir.z*(speed/4)*accell} - local boat_backward = {x=-dir.x*(speed/4)*accell,y=0,z=-dir.z*(speed/4)*accell} - local vec_stop = {x=velo.x*decell,y=velo.y-gravity,z=velo.z*decell} - --boost reset if boost and not entity.boost then minetest.after(boost_charge, function() @@ -197,56 +202,213 @@ function object_drive(entity, dtime, def) end) end + --minetest.chat_send_all("decell:"..decell.." speed"..absolute_speed) + + --death_node + if death_node ~= nil and node == death_node then + if entity.driver then + vehicles.object_detach(entity, entity.driver, {x=1, y=0, z=1}) + end + vehicles.explodinate(entity, 5) + entity.object:remove() + return + end + + --place node + if place_node ~= nil and node == "air" or place_node ~= nil and node == "default:snow" or place_node ~= nil and minetest.get_item_group(node, "flora") ~= 0 then + if place_trigger == nil and math.random(1, place_chance) == 1 then + minetest.set_node(pos, {name=place_node}) + end + if place_trigger ~= nil and ctrl.sneak then + local facedir = minetest.dir_to_facedir(dir) + minetest.set_node(pos, {name=place_node, param2=facedir}) + end + end + + --destroy node + if destroy_node ~= nil and node == destroy_node then + minetest.dig_node(pos) + local item = minetest.get_node_drops(destroy_node) + if item[1] ~= nil then + minetest.add_item(pos, item[1]) + end + if item[2] ~= nil then + minetest.add_item(pos, item[1]) + end + end + + local turning_factor = 2 + + --brakes + local braking = 0 + local timer2 = 0 + if ctrl.jump and brakes then + braking = 1 + timer2 = timer2 + dtime*1 + local velo3 = nil + if velo3 == nil then + velo3 = velo + end + local effect_pos = {x=pos.x-dir.x*2, y=pos.y, z=pos.z-dir.z*2} + minetest.add_particlespawner( + 4, --amount + 0.5, --time + {x=effect_pos.x, y=effect_pos.y, z=effect_pos.z}, --minpos + {x=effect_pos.x, y=effect_pos.y, z=effect_pos.z}, --maxpos + {x=0, y=0, z=0}, --minvel + {x=-velo3.x, y=0.4, z=-velo3.z}, --maxvel + {x=-0,y=-0,z=-0}, --minacc + {x=0,y=0,z=0}, --maxacc + 0.5, --minexptime + 1, --maxexptime + 10, --minsize + 15, --maxsize + false, --collisiondetection + braking_effect --texture + ) + turning_factor = handling.initial + else + timer2 = 0 + turning_factor = handling.braking + end + + + --face the right way + local target_yaw = yaw+math.pi+math.pi/2+extra_yaw + local entity_yaw = entity.object:getyaw() + local change_yaw = (((target_yaw-entity_yaw+math.pi)%(math.pi*2))-math.pi)/(turning_factor*absolute_speed+1) + if entity_yaw ~= target_yaw and not uses_arrow_keys then + entity.object:setyaw(entity_yaw+change_yaw) + dir.x = -math.sin(entity_yaw) + dir.z = math.cos(entity_yaw) + else + --minetest.chat_send_all("yaw:"..entity_yaw) + --minetest.chat_send_all("dirx: "..dir.x.." dirz:"..dir.z) + if ctrl.left then + entity.object:setyaw(entity_yaw+(math.pi/360)*absolute_speed/2) + end + if ctrl.right then + entity.object:setyaw(entity_yaw-(math.pi/360)*absolute_speed/2) + end + dir.x = -math.sin(entity_yaw) + dir.z = math.cos(entity_yaw) + end + + --lava explode + if node == "default:lava_source" or node == "default:lava_flowing" then + if entity.driver then + vehicles.object_detach(entity, entity.driver, {x=1, y=0, z=1}) + end + vehicles.explodinate(entity, 5) + entity.object:remove() + return + end --respond to controls --check for water - if node == "default:river_water_source" or node == "default:water_source" or node == "default:river_water_flowing" or node == "default:water_flowing" then - entity.on_water = true - else - entity.on_water = false + local function is_water(node) + return node == "default:river_water_source" or node == "default:water_source" or node == "default:river_water_flowing" or node == "default:water_flowing" end - + entity.on_water = is_water(node) + entity.in_water = is_water(minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name) or is_water(node_under.name) + --apply water effects - if is_watercraft and entity.on_water == false then - entity.object:setvelocity({x=0, y=0, z=0}) - elseif entity.on_water and not is_watercraft then + if is_watercraft and entity.in_water then + entity.object:setvelocity({x=velo.x*0.9, y=velo.y+1, z=velo.z*0.9}) + elseif is_watercraft and entity.on_water == false then + entity.object:setvelocity({x=velo.x*decell,y=velo.y-1,z=velo.z*decell}) + elseif (entity.on_water or entity.in_water) and not is_watercraft then entity.object:setvelocity({x=velo.x*0.9, y=-1, z=velo.z*0.9}) + + --brakes + elseif ctrl.jump and brakes and not ctrl.up then + local velo2 = nil + if velo2 == nil then + velo2 = velo + end + local effect_pos = {x=pos.x-dir.x*2, y=pos.y, z=pos.z-dir.z*2} + entity.object:setvelocity({x=velo2.x*(0.95), y=velo.y, z=velo2.z*(0.95)}) + minetest.add_particlespawner( + 4, --amount + 0.5, --time + {x=effect_pos.x, y=effect_pos.y, z=effect_pos.z}, --minpos + {x=effect_pos.x, y=effect_pos.y, z=effect_pos.z}, --maxpos + {x=0, y=0.1, z=0}, --minvel + {x=-velo2.x, y=0.4, z=-velo2.z}, --maxvel + {x=-0,y=-0,z=-0}, --minacc + {x=0,y=0,z=0}, --maxacc + 0.5, --minexptime + 1, --maxexptime + 10, --minsize + 15, --maxsize + false, --collisiondetection + braking_effect --texture + ) + if timer >= 0.5 then + timer = timer-timer/10 + end + --[[elseif ctrl.jump and ctrl.up and brakes then + local velo3 = nil + if velo3 == nil then + velo3 = velo + end + local effect_pos = {x=pos.x-dir.x*2, y=pos.y, z=pos.z-dir.z*2} + entity.object:setvelocity({x=velo.x*(decell), y=velo.y, z=velo.z*(decell)}) + minetest.add_particlespawner( + 4, --amount + 0.5, --time + {x=effect_pos.x, y=effect_pos.y, z=effect_pos.z}, --minpos + {x=effect_pos.x, y=effect_pos.y, z=effect_pos.z}, --maxpos + {x=0, y=0, z=0}, --minvel + {x=-velo3.x, y=0.4, z=-velo3.z}, --maxvel + {x=-0,y=-0,z=-0}, --minacc + {x=0,y=0,z=0}, --maxacc + 0.5, --minexptime + 1, --maxexptime + 10, --minsize + 15, --maxsize + false, --collisiondetection + "vehicles_dust.png" --texture + ) + if timer >= 0.5 then + timer = timer-timer/25 + end]] + --boost elseif ctrl.up and not shoots2 and ctrl.aux1 and entity.boost then - entity.object:setyaw(yaw+math.pi+math.pi/2+extra_yaw) - entity.object:setvelocity(vec_boost) + entity.object:setvelocity({x=dir.x*(speed*0.2)*math.log(timer+0.5)+8*dir.x,y=velo.y-gravity/2,z=dir.z*(speed*0.2)*math.log(timer+0.5)+8*dir.z}) if boost_effect ~= nil then + local effect_pos = {x=pos.x-dir.x*2, y=pos.y, z=pos.z-dir.z*2} minetest.add_particlespawner( - 5, --amount - 1, --time - {x=pos.x-0.5, y=pos.y, z=pos.z-0.5}, --minpos - {x=pos.x+0.5, y=pos.y, z=pos.z+0.5}, --maxpos + 10, --amount + 0.25, --time + {x=effect_pos.x, y=effect_pos.y+0.2, z=effect_pos.z}, --minpos + {x=effect_pos.x, y=effect_pos.y+0.2, z=effect_pos.z}, --maxpos {x=-velo.x, y=-velo.y, z=-velo.z}, --minvel {x=-velo.x, y=-velo.y, z=-velo.z}, --maxvel {x=-0,y=-0,z=-0}, --minacc {x=0,y=1,z=0}, --maxacc - 0.1, --minexptime - 0.2, --maxexptime - 5, --minsize - 10, --maxsize + 0.02, --minexptime + 0.02, --maxexptime + 20, --minsize + 20, --maxsize false, --collisiondetection boost_effect --texture ) end minetest.after(boost_duration, function() - entity.nitro = false + entity.boost = false end) --animation if moving_anim ~= nil and not entity.moving and not hovering then - entity.object:set_animation(move_anim, 20, 0) + entity.object:set_animation(move_anim, anim_speed, 0) entity.moving = true end --rise elseif ctrl.jump and fly and fly_mode == "rise" then - entity.object:setyaw(yaw+math.pi+math.pi/2+extra_yaw) entity.object:setvelocity(vec_rise) --lib_mount animation if moving_anim ~= nil and not entity.moving then - entity.object:set_animation(moving_anim, 20, 0) + entity.object:set_animation(moving_anim, anim_speed, 0) entity.moving = true end --hover in place @@ -254,39 +416,92 @@ function object_drive(entity, dtime, def) entity.object:setvelocity({x=dir.x*speed, y=0, z=dir.z*speed}) --move forward elseif ctrl.up and not fixed then - entity.object:setyaw(yaw+math.pi+math.pi/2+extra_yaw) if not fly and not is_watercraft then - entity.object:setvelocity(vec_forward) + entity.object:setvelocity({x=(dir.x*(speed*0.2)*math.log(timer+0.5)+4*dir.x)/(braking*(0.1)+1),y=velo.y-0.5,z=(dir.z*(speed*0.2)*math.log(timer+0.5)+4*dir.z)/(braking*(0.1)+1)}) elseif not fly then - entity.object:setvelocity(boat_forward) + entity.object:setvelocity({x=dir.x*(speed*0.2)*math.log(timer+0.5)+4*dir.x,y=0,z=dir.z*(speed*0.2)*math.log(timer+0.5)+4*dir.z}) else - entity.object:setvelocity(vec_forward_fly) + entity.object:setvelocity({x=dir.x*(speed*0.2)*math.log(timer+0.5)+4*dir.x,y=dir.y*(speed*0.2)*math.log(timer+0.5)+4*dir.y+1,z=dir.z*(speed*0.2)*math.log(timer+0.5)+4*dir.z}) end --animation if moving_anim ~= nil and not entity.moving and not hovering then - entity.object:set_animation(moving_anim, 20, 0) + entity.object:set_animation(moving_anim, anim_speed, 0) entity.moving = true end --move backward - elseif ctrl.down and not fixed then - entity.object:setyaw(yaw+math.pi+math.pi/2+extra_yaw) + elseif ctrl.down and not fixed and not fly then if not is_watercraft then - entity.object:setvelocity(vec_backward) + if brakes and absolute_speed > 5 then + local velo2 = nil + if velo2 == nil then + velo2 = velo + end + local effect_pos = {x=pos.x-dir.x*2, y=pos.y, z=pos.z-dir.z*2} + entity.object:setvelocity({x=velo2.x*(0.95), y=velo.y, z=velo2.z*(0.95)}) + minetest.add_particlespawner( + 4, --amount + 0.5, --time + {x=effect_pos.x, y=effect_pos.y, z=effect_pos.z}, --minpos + {x=effect_pos.x, y=effect_pos.y, z=effect_pos.z}, --maxpos + {x=0, y=0.1, z=0}, --minvel + {x=-velo2.x, y=0.4, z=-velo2.z}, --maxvel + {x=-0,y=-0,z=-0}, --minacc + {x=0,y=0,z=0}, --maxacc + 0.5, --minexptime + 1, --maxexptime + 10, --minsize + 15, --maxsize + false, --collisiondetection + braking_effect --texture + ) + if timer >= 0.5 then + timer = timer-timer/10 + end + else + entity.object:setvelocity({x=-dir.x*(speed/4)*accell,y=velo.y-0.5,z=-dir.z*(speed/4)*accell}) + end else - entity.object:setvelocity(boat_backward) + if brakes and absolute_speed > 5 then + local velo2 = nil + if velo2 == nil then + velo2 = velo + end + local effect_pos = {x=pos.x-dir.x*2, y=pos.y, z=pos.z-dir.z*2} + entity.object:setvelocity({x=velo2.x*(0.95), y=velo.y, z=velo2.z*(0.95)}) + minetest.add_particlespawner( + 4, --amount + 0.5, --time + {x=effect_pos.x, y=effect_pos.y, z=effect_pos.z}, --minpos + {x=effect_pos.x, y=effect_pos.y, z=effect_pos.z}, --maxpos + {x=0, y=0.1, z=0}, --minvel + {x=-velo2.x, y=0.4, z=-velo2.z}, --maxvel + {x=-0,y=-0,z=-0}, --minacc + {x=0,y=0,z=0}, --maxacc + 0.5, --minexptime + 1, --maxexptime + 10, --minsize + 15, --maxsize + false, --collisiondetection + braking_effect --texture + ) + if timer >= 0.5 then + timer = timer-timer/10 + end + else + entity.object:setvelocity({x=-dir.x*(speed/4)*accell,y=0,z=-dir.z*(speed/4)*accell}) + end end --animation if moving_anim ~= nil and not entity.moving and not hovering then - entity.object:set_animation(moving_anim, 20, 0) + entity.object:set_animation(moving_anim, anim_speed, 0) entity.moving = true end --stop elseif not ctrl.down or ctrl.up then - entity.object:setyaw(yaw+math.pi+math.pi/2+extra_yaw) - entity.object:setvelocity(vec_stop) + entity.object:setvelocity({x=velo.x*decell,y=velo.y-gravity,z=velo.z*decell}) --animation if moving_anim ~= nil and entity.moving and not hovering then - entity.object:set_animation(stand_anim, 20, 0) + entity.object:set_animation(stand_anim, anim_speed, 0) entity.moving = false end end @@ -301,14 +516,15 @@ function object_drive(entity, dtime, def) obj:setvelocity(vec) local object = obj:get_luaentity() object.launcher = entity.driver + object.vehicle = entity.object --lib_mount animation if shoot_anim ~= nil and entity.object:get_animation().range ~= shoot_anim then - entity.object:set_animation(shoot_anim, 20, 0) + entity.object:set_animation(shoot_anim, anim_speed, 0) end minetest.after(reload_time, function() entity.loaded = true if stand_anim ~= nil and shoot_anim ~= nil then - entity.object:set_animation(stand_anim, 20, 0) + entity.object:set_animation(stand_anim, anim_speed, 0) end end) end @@ -319,19 +535,20 @@ function object_drive(entity, dtime, def) local remov = inv:remove_item("main", arrow2.."_item") entity.loaded2 = false local obj = minetest.env:add_entity({x=pos.x+0+dir.x*2,y=pos.y+shoot_y2+dir.y,z=pos.z+0+dir.z*2}, arrow2) - local vec = {x=dir.x*14,y=dir.y*14+shoot_angle,z=dir.z*14} + local vec = {x=dir.x*20,y=dir.y*20+shoot_angle,z=dir.z*20} obj:setyaw(yaw+math.pi/2+extra_yaw) obj:setvelocity(vec) local object = obj:get_luaentity() object.launcher = entity.driver + object.vehicle = entity.object --lib_mount animation if shoot_anim2 ~= nil and entity.object:get_animation().range ~= shoot_anim2 then - entity.object:set_animation(shoot_anim2, 20, 0) + entity.object:set_animation(shoot_anim2, anim_speed, 0) end minetest.after(reload_time2, function() entity.loaded2 = true if stand_anim ~= nil and shoot_anim2 ~= nil then - entity.object:set_animation(stand_anim, 20, 0) + entity.object:set_animation(stand_anim, anim_speed, 0) end end) end @@ -342,11 +559,11 @@ function object_drive(entity, dtime, def) local vec_hover = {x=velo.x+0,y=hover_speed,z=velo.z+0} entity.object:setvelocity(vec_hover) else - entity.object:setvelocity(vec_forward_hover) + entity.object:setvelocity({x=dir.x*(speed*0.2)*math.log(timer+0.5)+4*dir.x,y=hover_speed,z=dir.z*(speed*0.2)*math.log(timer+0.5)+4*dir.z}) end hovering = true if jump_anim ~= nil and entity.object:get_animation().range ~= jump_anim and hovering then - entity.object:set_animation(jump_anim, 20, 0) + entity.object:set_animation(jump_anim, anim_speed, 0) end minetest.after(5, function() entity.jumpcharge = true @@ -362,11 +579,11 @@ function object_drive(entity, dtime, def) local vec_jump = {x=velo.x+0,y=jump_speed,z=velo.z+0} entity.object:setvelocity(vec_jump) else - entity.object:setvelocity(vec_forward_hover) + entity.object:setvelocity({x=dir.x*speed/4*math.atan(0.5*timer-2)+8*dir.x,y=jump_speed,z=dir.z*speed/4*math.atan(0.5*timer-2)+8*dir.z}) end hovering = true if jump_anim ~= nil and entity.object:get_animation().range ~= jump_anim and hovering then - entity.object:set_animation(jump_anim, 20, 0) + entity.object:set_animation(jump_anim, anim_speed, 0) end minetest.after(0.5, function() entity.jumpcharge = true @@ -380,7 +597,7 @@ function object_drive(entity, dtime, def) --play sound if entity.sound_ready then minetest.sound_play(driving_sound, - {gain = 4, max_hear_distance = 3, loop = false}) + {to_player=entity.driver:get_player_name(), gain = 4, max_hear_distance = 3, loop = false}) entity.sound_ready = false minetest.after(sound_duration, function() entity.sound_ready = true @@ -391,7 +608,7 @@ end --simplified in an attempt to reduce lag -function object_drive_simple(entity, dtime, speed, decell) +function vehicles.object_drive_simple(entity, dtime, speed, decell) local ctrl = entity.driver:get_player_control() local velo = entity.object:getvelocity() local dir = entity.driver:get_look_dir(); @@ -409,7 +626,7 @@ function object_drive_simple(entity, dtime, speed, decell) end end -function object_glide(entity, dtime, speed, decell, gravity, moving_anim, stand_anim) +function vehicles.object_glide(entity, dtime, speed, decell, gravity, moving_anim, stand_anim) local ctrl = entity.driver:get_player_control() local dir = entity.driver:get_look_dir(); local velo = entity.object:getvelocity(); @@ -445,9 +662,7 @@ function object_glide(entity, dtime, speed, decell, gravity, moving_anim, stand_ end end ---spawner - -function register_vehicle_spawner(vehicle, desc, texture, is_boat) +function vehicles.register_spawner(vehicle, desc, texture, is_boat) minetest.register_craftitem(vehicle.."_spawner", { description = desc, inventory_image = texture, @@ -460,23 +675,25 @@ minetest.register_craftitem(vehicle.."_spawner", { local obj = minetest.env:add_entity(pointed_thing.above, vehicle) local object = obj:get_luaentity() object.owner = placer + if not minetest.setting_getbool("creative_mode") then item:take_item() return item + end elseif pointed_thing.type == "node" and minetest.get_item_group(pointed_thing.name, "water") then local obj = minetest.env:add_entity(pointed_thing.under, vehicle) obj:setvelocity({x=0, y=-1, z=0}) local object = obj:get_luaentity() object.owner = placer + if not minetest.setting_getbool("creative_mode") then item:take_item() return item end + end end, }) end ---explodinate - -function explode(ent, radius) +function vehicles.explodinate(ent, radius) local pos = ent.object:getpos() minetest.add_particlespawner({ amount = 90, @@ -512,4 +729,88 @@ function explode(ent, radius) texture = "vehicles_explosion.png" }) end) -end \ No newline at end of file +end + +function vehicles.on_punch(self, puncher) + local hp = self.object:get_hp() + if hp == 0 then + if self.driver then + vehicles.object_detach(self, self.driver, {x=1, y=0, z=1}) + end + vehicles.explodinate(self, 5) + end + if not self.driver then + return end + local creative_mode = creative and creative.is_enabled_for and creative.is_enabled_for(self.driver:get_player_name()) + if self.driver == puncher and (hp == self.hp_max-5 or hp == self.hp_max or creative_mode) then + local name = self.object:get_luaentity().name + local pos = self.object:getpos() + minetest.env:add_item(pos, name.."_spawner") + vehicles.object_detach(self, self.driver, {x=1, y=0, z=1}) + self.object:remove() + end +end + +function vehicles.object_no_drive(entity, dtime, def) + --definition + local decell = def.decell or 0 + local gravity = def.gravity or 1 + local is_watercraft = def.is_watercraft or false + local stand_anim = def.stand_anim + + --variables + local velo = entity.object:getvelocity() + local pos = entity.object:getpos() + local node = minetest.get_node(pos).name + + --timer dependant variables + local vec_stop = {x=velo.x*decell,y=velo.y-gravity,z=velo.z*decell} + + if node == "default:lava_source" or node == "default:lava_flowing" then + if entity.driver then + vehicles.object_detach(entity, entity.driver, {x=1, y=0, z=1}) + end + vehicles.explodinate(entity, 5) + entity.object:remove() + return + end + --respond to controls + --check for water + local function is_water(node) + return node == "default:river_water_source" or node == "default:water_source" or node == "default:river_water_flowing" or node == "default:water_flowing" + end + entity.on_water = is_water(node) or is_water({x=pos.x, y=pos.y-0.6, z=pos.z}) + entity.in_water = is_water(minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name) or is_water(minetest.get_node({x=pos.x, y=pos.y+2, z=pos.z}).name) + + --apply water effects + if is_watercraft and entity.in_water then + entity.object:setvelocity({x=velo.x*0.9, y=velo.y+1, z=velo.z*0.9}) + elseif is_watercraft and entity.on_water == false then + entity.object:setvelocity({x=velo.x*decell,y=velo.y-1,z=velo.z*decell}) + elseif entity.on_water and not is_watercraft then + entity.object:setvelocity({x=velo.x*0.9, y=-1, z=velo.z*0.9}) + else + --stop + entity.object:setvelocity(vec_stop) + --animation + if moving_anim ~= nil and entity.moving and not hovering then + entity.object:set_animation(stand_anim, 20, 0) + entity.moving = false + end + end +end + +function vehicles.on_step(self, dtime, def, have, no) + if self.driver then + vehicles.object_drive(self, dtime, def) + if have ~= nil then + have() + end + else + vehicles.object_no_drive(self, dtime, def) + if no ~= nil then + no() + end + end + return false +end diff --git a/mods/vehicles_loz/init.lua b/mods/vehicles_loz/init.lua index 385b091..e82302f 100644 --- a/mods/vehicles_loz/init.lua +++ b/mods/vehicles_loz/init.lua @@ -1,3 +1,5 @@ +local MP = minetest.get_modpath(minetest.get_current_modname()) +local S, NS = dofile(MP.."/intllib.lua") --load api dofile(minetest.get_modpath("vehicles").."/api.lua") @@ -16,44 +18,73 @@ minetest.register_entity("vehicles:horse", { collisionbox = {-0.5, 0, -0.5, 0.5, 1.3, 0.5}, on_rightclick = function(self, clicker) if self.driver and clicker == self.driver then - object_detach(self, clicker, {x=1, y=0, z=1}) + vehicles.object_detach(self, clicker, {x=1, y=0, z=1}) elseif not self.driver then - object_attach(self, clicker, {x=0, y=8, z=0}, true, {x=0, y=4, z=0}) - end - end, - on_punch = function(self, puncher) - --if not self.driver then - --local name = self.object:get_luaentity().name - --local pos = self.object:getpos() - --minetest.env:add_item(pos, name.."_spawner") - --self.object:remove() - --end - if self.object:get_hp() == 0 then - if self.driver then - object_detach(self, self.driver, {x=1, y=0, z=1}) - end - explode(self, 5) + vehicles.object_attach(self, clicker, {x=0, y=8, z=0}, true, {x=0, y=4, z=0}) end end, + on_punch = vehicles.on_punch, on_step = function(self, dtime) - if self.driver then - object_drive(self, dtime, { + return vehicles.on_step(self, dtime, { speed = 13, decell = 0.5, moving_anim = {x=75, y=100}, stand_anim = {x=25, y=25}, jump_type = "jump", jump_anim = {x=25, y=50}, - extra_yaw = 1.57 + extra_yaw = 1.57, + handling = {initial=2, braking=3} }) - return false - end - return true end, }) --register_vehicle_spawner("vehicles:horse", "Horse", "vehicles_horse_inv.png") +minetest.register_entity("vehicles:ship", { + visual = "mesh", + mesh = "ship.b3d", + textures = {"vehicles_ship.png"}, + velocity = 15, + acceleration = -5, + stepheight = 0, + hp_max = 200, + physical = true, + collisionbox = {-1, 0.4, -1, 1.3, 1, 1}, + on_rightclick = function(self, clicker) + if self.driver and clicker == self.driver then + vehicles.object_detach(self, clicker, {x=1, y=0, z=1}) + elseif not self.driver then + vehicles.object_attach(self, clicker, {x=0, y=20, z=4}, true, {x=0, y=5, z=4}) + end + end, + on_punch = vehicles.on_punch, + on_step = function(self, dtime) + return vehicles.on_step(self, dtime, { + speed = 12, + decell = 0.85, + is_watercraft = true, + gravity = 0, + boost = true, + boost_duration = 10, + boost_effect = "vehicles_splash.png", + brakes = true, + braking_effect = "vehicles_splash.png", + handling = {initial=1, braking=1.8} + }) + end, +}) + +vehicles.register_spawner("vehicles:ship", S("Sail Boat"), "vehicles_ship_inv.png", true) + +minetest.register_craft( { + output = "vehicles:ship_spawner 1", + recipe = { + { "wool:white", "wool:white", "" }, + { "default:acacia_wood", "hyrule_mapgen:crystal_1", "default:acacia_wood" }, + { "default:acacia_wood", "default:acacia_wood", "default:acacia_wood" } + } +}) + minetest.register_entity("vehicles:spinner", { visual = "mesh", mesh = "spinner.b3d", @@ -66,39 +97,25 @@ minetest.register_entity("vehicles:spinner", { collisionbox = {-0.4, -0.2, -0.4, 0.4, 0.3, 0.4}, on_rightclick = function(self, clicker) if self.driver and clicker == self.driver then - object_detach(self, clicker, {x=1, y=0, z=1}) + vehicles.object_detach(self, clicker, {x=1, y=0, z=1}) elseif not self.driver then - object_attach(self, clicker, {x=0, y=10, z=0}, true, {x=0, y=2, z=0}) - end - end, - on_punch = function(self, puncher) - if not self.driver then - local name = self.object:get_luaentity().name - local pos = self.object:getpos() - minetest.env:add_item(pos, name.."_spawner") - self.object:remove() - end - if self.object:get_hp() == 0 then - if self.driver then - object_detach(self, self.driver, {x=1, y=0, z=1}) - end - explode(self, 5) + vehicles.object_attach(self, clicker, {x=0, y=10, z=0}, true, {x=0, y=2, z=0}) end end, + on_punch = vehicles.on_punch, on_step = function(self, dtime) - if self.driver then - object_drive(self, dtime, { - speed = 12, + return vehicles.on_step(self, dtime, { + speed = 11, decell = 0.6, moving_anim = {x=3, y=18}, stand_anim = {x=1, y=1}, jump_type = "jump", - jump_anim = {x=3, y=18} + jump_anim = {x=3, y=18}, + brakes = false, + braking_effect = "hyrule_mapgen_trans.png", + handling = {initial=3, braking=3} }) - return false - end - return true end, }) -register_vehicle_spawner("vehicles:spinner", "Spinner", "vehicles_spinner_inv.png") \ No newline at end of file +vehicles.register_spawner("vehicles:spinner", "Spinner", "vehicles_spinner_inv.png") \ No newline at end of file diff --git a/mods/vehicles_loz/intllib.lua b/mods/vehicles_loz/intllib.lua new file mode 100644 index 0000000..6669d72 --- /dev/null +++ b/mods/vehicles_loz/intllib.lua @@ -0,0 +1,45 @@ + +-- Fallback functions for when `intllib` is not installed. +-- Code released under Unlicense . + +-- Get the latest version of this file at: +-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua + +local function format(str, ...) + local args = { ... } + local function repl(escape, open, num, close) + if escape == "" then + local replacement = tostring(args[tonumber(num)]) + if open == "" then + replacement = replacement..close + end + return replacement + else + return "@"..open..num..close + end + end + return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl)) +end + +local gettext, ngettext +if minetest.get_modpath("intllib") then + if intllib.make_gettext_pair then + -- New method using gettext. + gettext, ngettext = intllib.make_gettext_pair() + else + -- Old method using text files. + gettext = intllib.Getter() + end +end + +-- Fill in missing functions. + +gettext = gettext or function(msgid, ...) + return format(msgid, ...) +end + +ngettext = ngettext or function(msgid, msgid_plural, n, ...) + return format(n==1 and msgid or msgid_plural, ...) +end + +return gettext, ngettext diff --git a/mods/vehicles_loz/models/ship.b3d b/mods/vehicles_loz/models/ship.b3d new file mode 100644 index 0000000..259e125 Binary files /dev/null and b/mods/vehicles_loz/models/ship.b3d differ diff --git a/mods/vehicles_loz/models/vehicles_ship.png b/mods/vehicles_loz/models/vehicles_ship.png new file mode 100644 index 0000000..fe2a827 Binary files /dev/null and b/mods/vehicles_loz/models/vehicles_ship.png differ diff --git a/mods/vehicles_loz/textures/vehicles_ship_inv.png b/mods/vehicles_loz/textures/vehicles_ship_inv.png new file mode 100644 index 0000000..17cce37 Binary files /dev/null and b/mods/vehicles_loz/textures/vehicles_ship_inv.png differ diff --git a/mods/vehicles_loz/textures/vehicles_splash.png b/mods/vehicles_loz/textures/vehicles_splash.png new file mode 100644 index 0000000..fdca650 Binary files /dev/null and b/mods/vehicles_loz/textures/vehicles_splash.png differ diff --git a/mods/weather_pack/.gitignore b/mods/weather_pack/.gitignore deleted file mode 100644 index 260caf2..0000000 --- a/mods/weather_pack/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*~ -.settings/* -.project -.buildpath \ No newline at end of file diff --git a/mods/weather_pack/README.md b/mods/weather_pack/README.md deleted file mode 100644 index 09d83e3..0000000 --- a/mods/weather_pack/README.md +++ /dev/null @@ -1,47 +0,0 @@ -weather-pack -======================= -Weather mod for Minetest (http://minetest.net/) - -Weathers included ------------------------ -* rain -* snow -* thunder - -Commands ------------------------ -`set_weather ` requires `weather_manager` privilege. - -Dependencies ------------------------ -Thunder weather requres [lightning](https://github.com/minetest-mods/lightning) mod. - -Configuration properties ------------------------ -Weather mod for indoor check depends on sunlight propogation check. Some nodes (e.g. glass block) propogates sunlight and thus weather particles will go through it. To change that set `weather_allow_override_nodes=true` in `minetest.conf` file. Be aware that just few nodes will be override and these blocks needs to be re-builded to take effect. Maybe in future other 'cheap' way to check indoor will be available. - -Weather mod mostly relies on particles generation however for some small things ABM may be used. Users which do not want it can disable ABM with property `weather_allow_abm=false`. - -License of source code: ------------------------ -LGPL 2.1+ - -Authors of media files: ------------------------ - -TeddyDesTodes: -Snowflakes licensed under CC-BY-SA 3.0 by from weather branch at https://github.com/TeddyDesTodes/minetest/tree/weather - - * `weather_pack_snow_snowflake1.png` - CC-BY-SA 3.0 - * `weather_pack_snow_snowflake2.png` - CC-BY-SA 3.0 - -xeranas: - - * `weather_pack_rain_raindrop_1.png` - CC-0 - * `weather_pack_rain_raindrop_2.png` - CC-0 - * `weather_pack_rain_raindrop_3.png` - CC-0 - -inchadney (http://freesound.org/people/inchadney/): - - * `weather_rain.ogg` - CC-BY-SA 3.0 (cut from http://freesound.org/people/inchadney/sounds/58835/) - diff --git a/mods/weather_pack/depends.txt b/mods/weather_pack/depends.txt deleted file mode 100644 index b129625..0000000 --- a/mods/weather_pack/depends.txt +++ /dev/null @@ -1 +0,0 @@ -lightning? \ No newline at end of file diff --git a/mods/weather_pack/description.txt b/mods/weather_pack/description.txt deleted file mode 100644 index 6efa41e..0000000 --- a/mods/weather_pack/description.txt +++ /dev/null @@ -1 +0,0 @@ -Set of weathers for minetest. \ No newline at end of file diff --git a/mods/weather_pack/dust.lua b/mods/weather_pack/dust.lua deleted file mode 100644 index 21d1edb..0000000 --- a/mods/weather_pack/dust.lua +++ /dev/null @@ -1,85 +0,0 @@ -dust = {} - -dust.particles_count = 25 -dust.init_done = false - --- calculates coordinates and draw particles for dust weather -dust.add_rain_particles = function(player, dtime) - dust.last_rp_count = 0 - for i=dust.particles_count, 1,-1 do - local random_pos_x, random_pos_y, random_pos_z = weather.get_random_pos_by_player_look_dir(player) - random_pos_y = math.random() + math.random(player:getpos().y - 1, player:getpos().y + 7) - if minetest.get_node_light({x=random_pos_x, y=random_pos_y, z=random_pos_z}, 0.5) == nil then - return - end - if minetest.get_node_light({x=random_pos_x, y=random_pos_y, z=random_pos_z}, 0.5) >= 10 then - dust.last_rp_count = dust.last_rp_count + 1 - minetest.add_particle({ - pos = {x=random_pos_x, y=random_pos_y, z=random_pos_z}, - velocity = {x = math.random(-0.2,0.2), y = math.random(0.2,0.3), z = math.random(-0.2,0.2)}, - acceleration = {x = math.random(-0.2,0.2), y=0.2, z = math.random(-0.2,0.2)}, - expirationtime = 0.6, - size = math.random(0.5, 1), - collisiondetection = true, - vertical = true, - texture = dust.get_texture(), - playername = player:get_player_name() - }) - end - end -end - --- Simple random texture getter -dust.get_texture = function() - local texture_name - local random_number = math.random() - if random_number > 0.5 then - texture_name = "dust_dust1.png" - else - texture_name = "dust_dust2.png" - end - return texture_name; -end - -dust.set_sky_box = function() - skycolor.add_layer( - "weather-pack-dust-sky", - {{r=137, g=226, b=164}, - {r=137, g=226, b=164}, - {r=0, g=0, b=0}} - ) - skycolor.active = true -end - -dust.clear = function() - skycolor.remove_layer("weather-pack-dust-sky") - dust.init_done = false -end - -minetest.register_globalstep(function(dtime) - if weather.state ~= "dust" then - return false - end - - if dust.init_done == false then - dust.set_sky_box() - dust.init_done = true - end - - for _, player in ipairs(minetest.get_connected_players()) do - if (weather.is_underwater(player)) then - return false - end - dust.add_rain_particles(player, dtime) - end -end) - - - --- register dust weather -if weather.reg_weathers.dust == nil then - weather.reg_weathers.dust = { - chance = 10, - clear = dust.clear - } -end diff --git a/mods/weather_pack/init.lua b/mods/weather_pack/init.lua deleted file mode 100644 index 097773b..0000000 --- a/mods/weather_pack/init.lua +++ /dev/null @@ -1,14 +0,0 @@ -local modpath = minetest.get_modpath("weather_pack"); -dofile(modpath.."/weather_core.lua") -dofile(modpath.."/snow.lua") -dofile(modpath.."/rain.lua") -dofile(modpath.."/dust.lua") - -if minetest.get_modpath("lightning") ~= nil then - dofile(modpath.."/thunder.lua") -end - --- If not located then embeded skycolor mod version will be loaded. -if minetest.get_modpath("skycolor") == nil then - dofile(modpath.."/skycolor.lua") -end diff --git a/mods/weather_pack/mod.conf b/mods/weather_pack/mod.conf deleted file mode 100644 index 7baa047..0000000 --- a/mods/weather_pack/mod.conf +++ /dev/null @@ -1 +0,0 @@ -name = weather_pack diff --git a/mods/weather_pack/rain.lua b/mods/weather_pack/rain.lua deleted file mode 100644 index cd2bb78..0000000 --- a/mods/weather_pack/rain.lua +++ /dev/null @@ -1,186 +0,0 @@ -rain = { - -- max rain particles created at time - particles_count = 35, - - -- flag to turn on/off extinguish fire for rain - extinguish_fire = true, - - -- flag useful when mixing weathers - raining = false, - - -- keeping last timeofday value (rounded). - -- Defaulted to non-existing value for initial comparing. - sky_last_update = -1, - - init_done = false, -} - -rain.sound_handler = function(player) - return minetest.sound_play("weather_rain", { - object = player, - max_hear_distance = 2, - loop = true, - }) -end - --- set skybox based on time (uses skycolor api) -rain.set_sky_box = function() - skycolor.add_layer( - "weather-pack-rain-sky", - {{r=0, g=0, b=0}, - {r=85, g=86, b=98}, - {r=152, g=150, b=159}, - {r=85, g=86, b=98}, - {r=0, g=0, b=0}}) - skycolor.active = true -end - --- creating manually parctiles instead of particles spawner because of easier to control --- spawn position. -rain.add_rain_particles = function(player) - - rain.last_rp_count = 0 - for i=rain.particles_count, 1,-1 do - local random_pos_x, random_pos_y, random_pos_z = weather.get_random_pos_by_player_look_dir(player) - if minetest.get_node_light({x=random_pos_x, y=random_pos_y, z=random_pos_z}, 0.5) == 15 then - rain.last_rp_count = rain.last_rp_count + 1 - minetest.add_particle({ - pos = {x=random_pos_x, y=random_pos_y, z=random_pos_z}, - velocity = {x=0, y=-10, z=0}, - acceleration = {x=0, y=-30, z=0}, - expirationtime = 0.2, - size = math.random(0.5, 3), - collisiondetection = true, - collision_removal = true, - vertical = true, - texture = rain.get_texture(), - playername = player:get_player_name() - }) - end - end -end - --- Simple random texture getter -rain.get_texture = function() - local texture_name - local random_number = math.random() - if random_number > 0.33 then - texture_name = "weather_pack_rain_raindrop_1.png" - elseif random_number > 0.66 then - texture_name = "weather_pack_rain_raindrop_2.png" - else - texture_name = "weather_pack_rain_raindrop_3.png" - end - return texture_name; -end - --- register player for rain weather. --- basically needs for origin sky reference and rain sound controls. -rain.add_player = function(player) - if weather.players[player:get_player_name()] == nil then - local player_meta = {} - player_meta.origin_sky = {player:get_sky()} - weather.players[player:get_player_name()] = player_meta - end -end - --- remove player from player list effected by rain. --- be sure to remove sound before removing player otherwise soundhandler reference will be lost. -rain.remove_player = function(player) - local player_meta = weather.players[player:get_player_name()] - if player_meta ~= nil and player_meta.origin_sky ~= nil then - player:set_sky(player_meta.origin_sky[1], player_meta.origin_sky[2], player_meta.origin_sky[3]) - weather.players[player:get_player_name()] = nil - end -end - --- adds and removes rain sound depending how much rain particles around player currently exist. --- have few seconds delay before each check to avoid on/off sound too often --- when player stay on 'edge' where sound should play and stop depending from random raindrop appearance. -rain.update_sound = function(player) - local player_meta = weather.players[player:get_player_name()] - if player_meta ~= nil then - if player_meta.sound_updated ~= nil and player_meta.sound_updated + 5 > os.time() then - return false - end - - if player_meta.sound_handler ~= nil then - if rain.last_rp_count == 0 then - minetest.sound_stop(player_meta.sound_handler) - player_meta.sound_handler = nil - end - elseif rain.last_rp_count > 0 then - player_meta.sound_handler = rain.sound_handler(player) - end - - player_meta.sound_updated = os.time() - end -end - --- rain sound removed from player. -rain.remove_sound = function(player) - local player_meta = weather.players[player:get_player_name()] - if player_meta ~= nil and player_meta.sound_handler ~= nil then - minetest.sound_stop(player_meta.sound_handler) - player_meta.sound_handler = nil - end -end - --- callback function for removing rain -rain.clear = function() - rain.raining = false - rain.sky_last_update = -1 - rain.init_done = false - skycolor.remove_layer("weather-pack-rain-sky") - for _, player in ipairs(minetest.get_connected_players()) do - rain.remove_sound(player) - rain.remove_player(player) - end -end - -minetest.register_globalstep(function(dtime) - if weather.state ~= "rain" then - return false - end - - rain.make_weather() -end) - -rain.make_weather = function() - if rain.init_done == false then - rain.raining = true - rain.set_sky_box() - end - - for _, player in ipairs(minetest.get_connected_players()) do - if (weather.is_underwater(player)) then - return false - end - rain.add_player(player) - rain.add_rain_particles(player) - rain.update_sound(player) - end -end - -if weather.reg_weathers.rain == nil then - weather.reg_weathers.rain = { - chance = 15, - clear = rain.clear - } -end - --- ABM for extinguish fire -if weather.allow_abm then - minetest.register_abm({ - nodenames = {"fire:basic_flame"}, - interval = 4.0, - chance = 2, - action = function(pos, node, active_object_count, active_object_count_wider) - if rain.raining and rain.extinguish_fire then - if weather.is_outdoor(pos) then - minetest.remove_node(pos) - end - end - end - }) -end \ No newline at end of file diff --git a/mods/weather_pack/screenshot.png b/mods/weather_pack/screenshot.png deleted file mode 100644 index 1ee3ea0..0000000 Binary files a/mods/weather_pack/screenshot.png and /dev/null differ diff --git a/mods/weather_pack/skycolor.lua b/mods/weather_pack/skycolor.lua deleted file mode 100644 index b5005ba..0000000 --- a/mods/weather_pack/skycolor.lua +++ /dev/null @@ -1,212 +0,0 @@ -skycolor = { - -- Should be activated before do any effect. - active = false, - - -- To skip update interval - force_update = true, - - -- Update interval. - update_interval = 15, - - -- Main sky colors: starts from midnight to midnight. - -- Please do not set directly. Use add_layer instead. - colors = {}, - - -- min value which will be used in color gradient, usualy its first user given color in 'pure' color. - min_val = 0, - - -- number of colors while constructing gradient of user given colors - max_val = 1000, - - -- Enables smooth transition between existing sky color and target. - smooth_transitions = true, - - -- Transition between current sky color and new user given. - transition_in_progress = false, - - -- Transition colors are generated automaticly during initialization. - transition_colors = {}, - - -- Time where transition between current color and user given will be done - transition_time = 15, - - -- Tracks how much time passed during transition - transition_timer = 0, - - -- Table for tracking layer order - layer_names = {}, - - -- To layer to colors table - add_layer = function(layer_name, layer_color, instant_update) - skycolor.colors[layer_name] = layer_color - table.insert(skycolor.layer_names, layer_name) - if (instant_update ~= true) then - skycolor.init_transition() - end - skycolor.force_update = true - end, - - -- Retrieve layer from colors table - retrieve_layer = function() - local last_layer = skycolor.layer_names[#skycolor.layer_names] - return skycolor.colors[last_layer] - end, - - -- Remove layer from colors table - remove_layer = function(layer_name) - for k, name in ipairs(skycolor.layer_names) do - if name == layer_name then - table.remove(skycolor.layer_names, k) - skycolor.force_update = true - return - end - end - end, - - -- Update sky color. If players not specified update sky for all players. - update_sky_color = function(players) - local color = skycolor.current_sky_layer_color() - if (color == nil) then - skycolor.active = false - skycolor.set_default_sky() - return - end - - players = skycolor.utils.get_players(players) - for _, player in ipairs(players) do - player:set_sky(color, "plain", nil) - end - end, - - -- Returns current layer color in {r, g, b} format - current_sky_layer_color = function() - if #skycolor.layer_names == 0 then - return nil - end - - -- min timeofday value 0; max timeofday value 1. So sky color gradient range will be between 0 and 1 * skycolor.max_value. - local timeofday = minetest.get_timeofday() - local rounded_time = math.floor(timeofday * skycolor.max_val) - local color = skycolor.utils.convert_to_rgb(skycolor.min_val, skycolor.max_val, rounded_time, skycolor.retrieve_layer()) - return color - end, - - -- Initialy used only on - update_transition_sky_color = function() - if #skycolor.layer_names == 0 then - skycolor.active = false - skycolor.set_default_sky() - return - end - - local multiplier = 100 - local rounded_time = math.floor(skycolor.transition_timer * multiplier) - if rounded_time >= skycolor.transition_time * multiplier then - skycolor.stop_transition() - return - end - - local color = skycolor.utils.convert_to_rgb(0, skycolor.transition_time * multiplier, rounded_time, skycolor.transition_colors) - - local players = skycolor.utils.get_players(nil) - for _, player in ipairs(players) do - player:set_sky(color, "plain", nil) - end - end, - - -- Reset sky color to game default. If players not specified update sky for all players. - -- Could be sometimes useful but not recomended to use in general case as there may be other color layers - -- which needs to preserve. - set_default_sky = function(players) - local players = skycolor.utils.get_players(players) - for _, player in ipairs(players) do - player:set_sky(nil, "regular", nil) - end - end, - - init_transition = function() - -- sadly default sky returns unpredictible colors so transition mode becomes usable only for user defined color layers - -- Here '2' means that one color layer existed before new added and transition is posible. - if #skycolor.layer_names < 2 then - return - end - - local transition_start_color = skycolor.utils.get_current_bg_color() - if (transition_start_color == nil) then - return - end - local transition_end_color = skycolor.current_sky_layer_color() - skycolor.transition_colors = {transition_start_color, transition_end_color} - skycolor.transition_in_progress = true - end, - - stop_transition = function() - skycolor.transition_in_progress = false - skycolor.transition_colors = {} - skycolor.transition_timer = 0 - end, - - utils = { - convert_to_rgb = function(minval, maxval, current_val, colors) - local max_index = #colors - 1 - local val = (current_val-minval) / (maxval-minval) * max_index + 1.0 - local index1 = math.floor(val) - local index2 = math.min(math.floor(val)+1, max_index + 1) - local f = val - index1 - local c1 = colors[index1] - local c2 = colors[index2] - return {r=math.floor(c1.r + f*(c2.r - c1.r)), g=math.floor(c1.g + f*(c2.g-c1.g)), b=math.floor(c1.b + f*(c2.b - c1.b))} - end, - - -- Simply getter. Ether returns user given players list or get all connected players if none provided - get_players = function(players) - if players == nil or #players == 0 then - players = minetest.get_connected_players() - end - return players - end, - - -- Returns first player sky color. I assume that all players are in same color layout. - get_current_bg_color = function() - local players = skycolor.utils.get_players(nil) - for _, player in ipairs(players) do - return player:get_sky() - end - return nil - end - }, - -} - -local timer = 0 -minetest.register_globalstep(function(dtime) - if skycolor.active ~= true or #minetest.get_connected_players() == 0 then - return - end - - if skycolor.smooth_transitions and skycolor.transition_in_progress then - skycolor.transition_timer = skycolor.transition_timer + dtime - skycolor.update_transition_sky_color() - return - end - - if skycolor.force_update then - skycolor.update_sky_color() - skycolor.force_update = false - return - end - - -- regular updates based on iterval - timer = timer + dtime; - if timer >= skycolor.update_interval then - skycolor.update_sky_color() - timer = 0 - end - -end) - -minetest.register_on_joinplayer(function(player) - if (skycolor.active) then - skycolor.update_sky_color({player}) - end -end) \ No newline at end of file diff --git a/mods/weather_pack/snow.lua b/mods/weather_pack/snow.lua deleted file mode 100644 index 573047d..0000000 --- a/mods/weather_pack/snow.lua +++ /dev/null @@ -1,90 +0,0 @@ -snow = {} - -snow.particles_count = 25 -snow.init_done = false - --- calculates coordinates and draw particles for snow weather -snow.add_rain_particles = function(player) - rain.last_rp_count = 0 - for i=snow.particles_count, 1,-1 do - local random_pos_x, random_pos_y, random_pos_z = weather.get_random_pos_by_player_look_dir(player) - random_pos_y = math.random() + math.random(player:getpos().y - 1, player:getpos().y + 7) - if minetest.get_node_light({x=random_pos_x, y=random_pos_y, z=random_pos_z}, 0.5) == 15 and not minetest.find_node_near({x=random_pos_x, y=random_pos_y, z=random_pos_z}, 5, {"default:desert_sand", "default:sand"}) then - rain.last_rp_count = rain.last_rp_count + 1 - minetest.add_particle({ - pos = {x=random_pos_x, y=random_pos_y, z=random_pos_z}, - velocity = {x = math.random(-1,-0.5), y = math.random(-2,-1), z = math.random(-1,-0.5)}, - acceleration = {x = math.random(-1,-0.5), y=-0.5, z = math.random(-1,-0.5)}, - expirationtime = 2.0, - size = math.random(0.5, 2), - collisiondetection = true, - collision_removal = true, - vertical = true, - texture = snow.get_texture(), - playername = player:get_player_name() - }) - end - end -end - -snow.set_sky_box = function() - skycolor.add_layer( - "weather-pack-snow-sky", - {{r=200, g=200, b=255}, - {r=200, g=200, b=255}, - {r=0, g=0, b=0}} - ) - skycolor.active = true -end - -snow.clear = function() - skycolor.remove_layer("weather-pack-snow-sky") - snow.init_done = false -end - --- Simple random texture getter -snow.get_texture = function() - local texture_name - local random_number = math.random() - if random_number > 0.5 then - texture_name = "weather_pack_snow_snowflake1.png" - else - texture_name = "weather_pack_snow_snowflake2.png" - end - return texture_name; -end - -local timer = 0 -minetest.register_globalstep(function(dtime) - if weather.state ~= "snow" then - return false - end - - timer = timer + dtime; - if timer >= 0.5 then - timer = 0 - else - return - end - - if snow.init_done == false then - snow.set_sky_box() - snow.init_done = true - end - - for _, player in ipairs(minetest.get_connected_players()) do - if (weather.is_underwater(player)) then - return false - end - snow.add_rain_particles(player) - end -end) - --- register snow weather -if weather.reg_weathers.snow == nil then - weather.reg_weathers.snow = { - chance = 10, - clear = snow.clear - } -end - diff --git a/mods/weather_pack/sounds/weather_rain.ogg b/mods/weather_pack/sounds/weather_rain.ogg deleted file mode 100644 index ba2ea27..0000000 Binary files a/mods/weather_pack/sounds/weather_rain.ogg and /dev/null differ diff --git a/mods/weather_pack/textures/weather_pack_rain_raindrop_1.png b/mods/weather_pack/textures/weather_pack_rain_raindrop_1.png deleted file mode 100644 index 8c3edf5..0000000 Binary files a/mods/weather_pack/textures/weather_pack_rain_raindrop_1.png and /dev/null differ diff --git a/mods/weather_pack/textures/weather_pack_rain_raindrop_2.png b/mods/weather_pack/textures/weather_pack_rain_raindrop_2.png deleted file mode 100644 index 556ac26..0000000 Binary files a/mods/weather_pack/textures/weather_pack_rain_raindrop_2.png and /dev/null differ diff --git a/mods/weather_pack/textures/weather_pack_rain_raindrop_3.png b/mods/weather_pack/textures/weather_pack_rain_raindrop_3.png deleted file mode 100644 index 0ca202c..0000000 Binary files a/mods/weather_pack/textures/weather_pack_rain_raindrop_3.png and /dev/null differ diff --git a/mods/weather_pack/textures/weather_pack_snow_snowflake1.png b/mods/weather_pack/textures/weather_pack_snow_snowflake1.png deleted file mode 100644 index b2efdd7..0000000 Binary files a/mods/weather_pack/textures/weather_pack_snow_snowflake1.png and /dev/null differ diff --git a/mods/weather_pack/textures/weather_pack_snow_snowflake2.png b/mods/weather_pack/textures/weather_pack_snow_snowflake2.png deleted file mode 100644 index 4ac46f1..0000000 Binary files a/mods/weather_pack/textures/weather_pack_snow_snowflake2.png and /dev/null differ diff --git a/mods/weather_pack/thunder.lua b/mods/weather_pack/thunder.lua deleted file mode 100644 index 3ff6453..0000000 --- a/mods/weather_pack/thunder.lua +++ /dev/null @@ -1,37 +0,0 @@ --- turn off lightning mod 'auto mode' -lightning.auto = false - -thunder = { - next_strike = 0, - min_delay = 3, - max_delay = 12, -} - -minetest.register_globalstep(function(dtime) - if weather.state ~= "thunder" then - return false - end - - rain.make_weather() - - if (thunder.next_strike <= os.time()) then - lightning.strike() - local delay = math.random(thunder.min_delay, thunder.max_delay) - thunder.next_strike = os.time() + delay - end - -end) - -thunder.clear = function() - rain.clear() -end - --- register thunderstorm weather -if weather.reg_weathers.thunder == nil then - weather.reg_weathers.thunder = { - chance = 5, - clear = thunder.clear, - min_duration = 120, - max_duration = 600, - } -end \ No newline at end of file diff --git a/mods/weather_pack/weather_core.lua b/mods/weather_pack/weather_core.lua deleted file mode 100644 index 66466be..0000000 --- a/mods/weather_pack/weather_core.lua +++ /dev/null @@ -1,175 +0,0 @@ -weather = { - -- weather states, 'none' is default, other states depends from active mods - state = "none", - - -- player list for saving player meta info - players = {}, - - -- time when weather should be re-calculated - next_check = 0, - - -- default weather recalculation interval - check_interval = 300, - - -- weather min duration - min_duration = 240, - - -- weather max duration - max_duration = 3600, - - -- weather calculated end time - end_time = nil, - - -- registered weathers - reg_weathers = {}, - - -- automaticly calculates intervals and swap weathers - auto_mode = true, - - -- global flag to disable/enable ABM logic. - allow_abm = true, -} - -weather.get_rand_end_time = function(min_duration, max_duration) - if min_duration ~= nil and max_duration ~= nil then - return os.time() + math.random(min_duration, max_duration); - else - return os.time() + math.random(weather.min_duration, weather.max_duration); - end -end - -weather.is_outdoor = function(pos) - if minetest.get_node_light({x=pos.x, y=pos.y + 1, z=pos.z}, 0.5) == 15 then - return true - end - return false -end - --- checks if player is undewater. This is needed in order to --- turn off weather particles generation. -weather.is_underwater = function(player) - local ppos = player:getpos() - local offset = player:get_eye_offset() - local player_eye_pos = {x = ppos.x + offset.x, - y = ppos.y + offset.y + 1.5, - z = ppos.z + offset.z} - local node_level = minetest.get_node_level(player_eye_pos) - if node_level == 8 or node_level == 7 then - return true - end - return false -end - --- trying to locate position for particles by player look direction for performance reason. --- it is costly to generate many particles around player so goal is focus mainly on front view. -weather.get_random_pos_by_player_look_dir = function(player) - local look_dir = player:get_look_dir() - local player_pos = player:getpos() - - local random_pos_x = 0 - local random_pos_y = 0 - local random_pos_z = 0 - - if look_dir.x > 0 then - if look_dir.z > 0 then - random_pos_x = math.random() + math.random(player_pos.x - 2.5, player_pos.x + 5) - random_pos_z = math.random() + math.random(player_pos.z - 2.5, player_pos.z + 5) - else - random_pos_x = math.random() + math.random(player_pos.x - 2.5, player_pos.x + 5) - random_pos_z = math.random() + math.random(player_pos.z - 5, player_pos.z + 2.5) - end - else - if look_dir.z > 0 then - random_pos_x = math.random() + math.random(player_pos.x - 5, player_pos.x + 2.5) - random_pos_z = math.random() + math.random(player_pos.z - 2.5, player_pos.z + 5) - else - random_pos_x = math.random() + math.random(player_pos.x - 5, player_pos.x + 2.5) - random_pos_z = math.random() + math.random(player_pos.z - 5, player_pos.z + 2.5) - end - end - - random_pos_y = math.random() + math.random(player_pos.y + 1, player_pos.y + 3) - return random_pos_x, random_pos_y, random_pos_z -end - -minetest.register_globalstep(function(dtime) - if weather.auto_mode == false then - return 0 - end - - -- recalculate weather only when there aren't currently any - if (weather.state ~= "none") then - if (weather.end_time ~= nil and weather.end_time <= os.time()) then - weather.reg_weathers[weather.state].clear() - weather.state = "none" - end - elseif (weather.next_check <= os.time()) then - for weather_name, weather_meta in pairs(weather.reg_weathers) do - weather.set_random_weather(weather_name, weather_meta) - end - -- fallback next_check set, weather 'none' will be. - weather.next_check = os.time() + weather.check_interval - end -end) - --- sets random weather (which could be 'regular' (no weather)). -weather.set_random_weather = function(weather_name, weather_meta) - if weather.next_check > os.time() then return 0 end - - if (weather_meta ~= nil and weather_meta.chance ~= nil) then - local random_roll = math.random(0,100) - if (random_roll <= weather_meta.chance) then - weather.state = weather_name - weather.end_time = weather.get_rand_end_time(weather_meta.min_duration, weather_meta.max_duration) - weather.next_check = os.time() + weather.check_interval - end - end -end - -minetest.register_privilege("weather_manager", { - description = "Gives ability to control weather", - give_to_singleplayer = false -}) - --- Weather command definition. Set -minetest.register_chatcommand("set_weather", { - params = "", - description = "Changes weather by given param, parameter none will remove weather.", - privs = {weather_manager = true}, - func = function(name, param) - if (param == "none") then - if (weather.state ~= nil and weather.reg_weathers[weather.state] ~= nil) then - weather.reg_weathers[weather.state].clear() - weather.state = param - end - weather.state = "none" - end - - if (weather.reg_weathers ~= nil and weather.reg_weathers[param] ~= nil) then - if (weather.state ~= nil and weather.state ~= "none" and weather.reg_weathers[weather.state] ~= nil) then - weather.reg_weathers[weather.state].clear() - end - weather.state = param - end - end -}) - --- Configuration setting which allows user to disable ABM for weathers (if they use it). --- Weather mods expected to be use this flag before registering ABM. -local weather_allow_abm = minetest.setting_getbool("weather_allow_abm") -if weather_allow_abm ~= nil and weather_allow_abm == false then - weather.allow_abm = false -end - --- Overrides nodes 'sunlight_propagates' attribute for efficient indoor check (e.g. for glass roof). --- Controlled from minetest.conf setting and by default it is disabled. --- To enable set weather_allow_override_nodes to true. --- Only new nodes will be effected (glass roof needs to be rebuilded). -if minetest.setting_getbool("weather_allow_override_nodes") then - if minetest.registered_nodes["default:glass"] then - minetest.override_item("default:glass", {sunlight_propagates = false}) - end - if minetest.registered_nodes["default:meselamp"] then - minetest.override_item("default:meselamp", {sunlight_propagates = false}) - end -end \ No newline at end of file diff --git a/mods/xdecor/crafts.lua b/mods/xdecor/crafts.lua index 6755e01..7514f61 100644 --- a/mods/xdecor/crafts.lua +++ b/mods/xdecor/crafts.lua @@ -392,7 +392,7 @@ minetest.register_craft({ output = "xdecor:worktable", recipe = { {"group:wood", "group:wood", "group:wood"}, - {"group:wood", "", ""}, + {"group:wood", "default:steel_ingot", "group:wood"}, } }) diff --git a/mods/xdecor/nodes.lua b/mods/xdecor/nodes.lua index 2b86c03..ba2ab9c 100644 --- a/mods/xdecor/nodes.lua +++ b/mods/xdecor/nodes.lua @@ -120,7 +120,7 @@ xdecor.register("cobweb", { liquid_range = 0, walkable = false, selection_box = {type = "regular"}, - groups = {dig_immediate=3, liquid=3, flammable=3}, + groups = {oddly_breakable_by_hand=1, liquid=3, flammable=3}, sounds = default.node_sound_leaves_defaults() })