diff --git a/mods/ip_cops/init.lua b/mods/ip_cops/init.lua index 7af1e60..7dfa48a 100644 --- a/mods/ip_cops/init.lua +++ b/mods/ip_cops/init.lua @@ -2,7 +2,7 @@ cops = {} cops.copsSpawned = 0 -- Pig spawner -minetest.register_node("cops:pig_spawner", { +minetest.register_node(":cops:pig_spawner", { walkable = false; drawtype = "glasslike", paramtype = "light", @@ -18,6 +18,43 @@ minetest.register_node("cops:pig_spawner", { end,]] }) + +-- Items +minetest.register_craftitem(":cops:handcuffs", { + description = "Handcuffs", + wield_image = "cops_handcuffs.png", + inventory_image = "cops_handcuffs.png", +}) + +minetest.register_craftitem(":cops:badge", { + description = "Police Badge", + wield_image = "cops_badge.png", + inventory_image = "cops_badge.png", +}) + +minetest.register_craftitem(":cops:baton", { + type = "none", + description = "Baton", + wield_image = "cops_baton.png", + inventory_image = "cops_baton.png", + tool_capabilities = { + max_drop_level = 0, + full_punch_interval = 0.4, + + groupcaps = + { + cracky = {times={[4]=.1}, uses=0, maxlevel=4}, + }, + damage_groups = {fleshy = 5, snappy = 4}, + } +}) + +minetest.register_craftitem(":cops:electric_weapon_broken", { + description = "Broken Electric Weapon", + wield_image = "cops_electric_weapon_broken.png", + inventory_image = "cops_electric_weapon_broken.png", +}) + --[[ minetest.register_abm({ nodenames = {"cops:pig_spawner"}, @@ -61,7 +98,7 @@ minetest.register_abm({ end}) -- Cops -mobs:register_mob("cops:cop_regular_female", { +mobs:register_mob(":cops:cop_regular_female", { type = "monster", passive = false, attack_type = "dogfight", @@ -98,6 +135,7 @@ mobs:register_mob("cops:cop_regular_female", { fall_damage = true, drops = { + {name = "cops:baton", chance = 2, min = 0, max = 1}, {name = "cops:badge", chance = 4, min = 0, max = 1}, {name = "cops:handcuffs", chance = 3, min = 0, max = 1}, {name = "cops:electric_weapon_broken", chance = 3, min = 0, max = 1} @@ -118,7 +156,7 @@ mobs:register_mob("cops:cop_regular_female", { }, }) -mobs:register_mob("cops:cop_regular_male", { +mobs:register_mob(":cops:cop_regular_male", { type = "monster", passive = false, attack_type = "dogfight", @@ -155,7 +193,8 @@ mobs:register_mob("cops:cop_regular_male", { fall_damage = true, drops = { - {name = "cops:badge", chance = 4, min = 0, max = 1}, + {name = "cops:baton", chance = 2, min = 0, max = 1}, + {name = "cops:badge", chance = 4, min = 1, max = 1}, {name = "cops:handcuffs", chance = 3, min = 0, max = 1}, {name = "cops:electric_weapon_broken", chance = 3, min = 0, max = 1} }, @@ -175,7 +214,7 @@ mobs:register_mob("cops:cop_regular_male", { }, }) -mobs:register_mob("cops:cop_armedthug", { +mobs:register_mob(":cops:cop_armedthug", { type = "monster", passive = false, attack_type = "dogfight", @@ -233,4 +272,4 @@ mobs:register_mob("cops:cop_armedthug", { onCopDie = function() cops.copsSpawned = cops.copsSpawned - 1 -end \ No newline at end of file +end diff --git a/mods/ip_cops/mod.conf b/mods/ip_cops/mod.conf index 94cbe59..7449ec1 100644 --- a/mods/ip_cops/mod.conf +++ b/mods/ip_cops/mod.conf @@ -1,2 +1,2 @@ -name = cops +name = ip_cops depends = mobs \ No newline at end of file diff --git a/mods/ip_destruction_counter/init.lua b/mods/ip_destruction_counter/init.lua index ff85126..2781d26 100644 --- a/mods/ip_destruction_counter/init.lua +++ b/mods/ip_destruction_counter/init.lua @@ -1,4 +1,4 @@ -local modpath = minetest.get_modpath("destruction_counter") +local modpath = minetest.get_modpath("ip_destruction_counter") destruction_counter = {} destruction_counter.nodesDestroyed = 0 diff --git a/mods/ip_destruction_counter/mod.conf b/mods/ip_destruction_counter/mod.conf index 2edf341..2fecadd 100644 --- a/mods/ip_destruction_counter/mod.conf +++ b/mods/ip_destruction_counter/mod.conf @@ -1,4 +1,4 @@ -name = destruction_counter +name = ip_destruction_counter description = Adds a HUD counter that shows how much shit you've destroyed. author = MCL title = Destruction Counter diff --git a/mods/ip_explosives/init.lua b/mods/ip_explosives/init.lua index fd63db7..d3c495c 100644 --- a/mods/ip_explosives/init.lua +++ b/mods/ip_explosives/init.lua @@ -417,7 +417,7 @@ function explosives.boom(pos, def) end -minetest.register_node("explosives:gunpowder", { +minetest.register_node(":explosives:gunpowder", { description = "Gun Powder", drawtype = "raillike", paramtype = "light", @@ -456,7 +456,7 @@ minetest.register_node("explosives:gunpowder", { end, }) -minetest.register_node("explosives:gunpowder_burning", { +minetest.register_node(":explosives:gunpowder_burning", { drawtype = "raillike", paramtype = "light", sunlight_propagates = true, @@ -537,7 +537,7 @@ minetest.register_node("explosives:gunpowder_burning", { -minetest.register_craftitem("explosives:dynamite_stick", { +minetest.register_craftitem(":explosives:dynamite_stick", { description = "Dynamite Stick", inventory_image = "tnt_tnt_stick.png", groups = {flammable = 5}, @@ -548,7 +548,7 @@ minetest.register_craftitem("explosives:dynamite_stick", { function explosives.register_tnt(def) local name if not def.name:find(':') then - name = "explosives:" .. def.name + name = ":explosives:" .. def.name else name = def.name def.name = def.name:match(":([%w_]+)") @@ -556,8 +556,8 @@ function explosives.register_tnt(def) if not def.tiles then def.tiles = {} end if not def.damage_radius then def.damage_radius = def.radius * 2 end - if enable_tnt then - minetest.register_node(":" .. name, { + + minetest.register_node(name, { description = def.description, tiles = {"tnt_side.png"}, drawtype = "nodebox", @@ -613,48 +613,12 @@ function explosives.register_tnt(def) minetest.registered_nodes[name .. "_burning"].on_construct(pos) end, }) - end + - minetest.register_node(":" .. name .. "_burning", { - tiles = { - "tnt_side" - }, - - drawtype = "nodebox", - paramtype = "light", - node_box = - { - type = "fixed", - fixed = - { - {-0.375, -0.5, -0.375, 0.375, 0.0625, 0.375}, - {-0.3125, 0.0625, -0.3125, 0.3125, 0.25, 0.3125}, - {-0.25, 0.25, -0.25, -0.125, 0.5, 0.3125}, - {-0.125, 0.25, -0.25, 0.25, 0.5, -0.125}, - {-0.125, 0.25, 0.1875, 0.25, 0.5, 0.3125}, - {0.125, 0.25, -0.125, 0.25, 0.3125, 0.1875}, - {-0.0625, 0.25, -0.0625, 0.0625, 0.4375, 0.125}, - } - }, - light_source = 5, - drop = "", - --sounds = default.node_sound_wood_defaults(), - groups = {falling_node = 1, not_in_creative_inventory = 1}, - on_timer = function(pos, elapsed) - explosives.boom(pos, def) - end, - -- unaffected by explosions - on_blast = function() end, - on_construct = function(pos) - minetest.sound_play("tnt_ignite", {pos = pos}, true) - minetest.get_node_timer(pos):start(4) - minetest.check_for_falling(pos) - end, - }) end explosives.register_tnt({ - name = "explosives:propane_tank", + name = "propane_tank", description = "Propane Tank", radius = explosion_radius, }) diff --git a/mods/ip_explosives/mod.conf b/mods/ip_explosives/mod.conf index eac7dd0..2c52081 100644 --- a/mods/ip_explosives/mod.conf +++ b/mods/ip_explosives/mod.conf @@ -1,3 +1,3 @@ -name = explosives +name = ip_explosives description = Explosives mod for Insane Protestor; derivative work of the TNT (tnt) mod from Minetest Game -depends = fire, destruction_counter +depends = fire, ip_destruction_counter diff --git a/mods/ip_extinguisher/init.lua b/mods/ip_extinguisher/init.lua index 0c561d7..e65eb3c 100644 --- a/mods/ip_extinguisher/init.lua +++ b/mods/ip_extinguisher/init.lua @@ -162,7 +162,7 @@ local function eexpl(pos) end -minetest.register_node("extinguisher:foam", { +minetest.register_node(":extinguisher:foam", { drawtype = "nodebox", paramtype = "light", node_box = { @@ -201,7 +201,7 @@ minetest.register_abm({ end, }) -minetest.register_node("extinguisher:automatic", { +minetest.register_node(":extinguisher:automatic", { description = "Extinguisher", tiles = {"extinguisher_top.png", "extinguisher_bottom.png", "extinguisher.png", "extinguisher.png^[transformFX", @@ -247,7 +247,7 @@ minetest.register_node("extinguisher:automatic", { end, }) -minetest.register_node("extinguisher:destroyed", { +minetest.register_node(":extinguisher:destroyed", { description = "Destroyed Extinguisher", tiles = {"extinguisher_top.png", "extinguisher_bottom.png", "extinguisher.png", "extinguisher.png^[transformFX", @@ -295,52 +295,6 @@ minetest.register_globalstep(function(dtime) end end) -minetest.register_craftitem("extinguisher:foam_ingredient_1", { - description = "Foam Ingredient", - inventory_image = "extinguisher_essence_1.png", -}) - -minetest.register_craftitem("extinguisher:foam_ingredient_2", { - description = "Foam Ingredient", - inventory_image = "extinguisher_essence_2.png", -}) - -minetest.register_craftitem("extinguisher:foam_bucket", { - description = "Foam", - inventory_image = "extinguisher_foam_bucket.png", -}) - -if minetest.registered_items["poisonivy:climbing"] then - minetest.register_craft({ - output = "extinguisher:foam_ingredient_1 2", - recipe = { - {"default:stone"}, - {"poisonivy:climbing"}, - {"default:stone"}, - }, - replacements = {{"default:stone", "default:stone"}, {"default:stone", "default:stone"}}, - }) - - minetest.register_craft({ - output = "extinguisher:foam_ingredient_2", - recipe = { - {"default:stone"}, - {"poisonivy:seedling"}, - {"default:stone"}, - }, - replacements = {{"default:stone", "default:stone"}, {"default:stone", "default:stone"}}, - }) - - minetest.register_craft({ - output = "extinguisher:foam_ingredient_2 3", - recipe = { - {"default:stone"}, - {"poisonivy:sproutling"}, - {"default:stone"}, - }, - replacements = {{"default:stone", "default:stone"}, {"default:stone", "default:stone"}}, - }) -end diff --git a/mods/ip_extinguisher/mod.conf b/mods/ip_extinguisher/mod.conf index a93c003..a02087c 100644 --- a/mods/ip_extinguisher/mod.conf +++ b/mods/ip_extinguisher/mod.conf @@ -1,3 +1,3 @@ -name = extinguisher +name = ip_extinguisher description = Extinguisher mod adapted for Insane Protestor diff --git a/mods/ip_literal_trash/init.lua b/mods/ip_literal_trash/init.lua index 9da244b..cdc9a88 100644 --- a/mods/ip_literal_trash/init.lua +++ b/mods/ip_literal_trash/init.lua @@ -1,4 +1,4 @@ -minetest.register_node("literal_trash:disc",{ +minetest.register_node(":literal_trash:disc",{ description = "Optical Disc", drawtype = "signlike", tiles = {"literal_trash_disc.png"}, @@ -18,7 +18,7 @@ minetest.register_node("literal_trash:disc",{ }, }) -minetest.register_node("literal_trash:vhs",{ +minetest.register_node(":literal_trash:vhs",{ description = "VHS Tape", drawtype = "signlike", tiles = {"literal_trash_vhs.png"}, @@ -38,7 +38,7 @@ minetest.register_node("literal_trash:vhs",{ }, }) -minetest.register_node("literal_trash:bloodstain",{ +minetest.register_node(":literal_trash:bloodstain",{ description = "Blood Stain", drawtype = "signlike", tiles = {"literal_trash_bloodstain.png"}, @@ -58,7 +58,7 @@ minetest.register_node("literal_trash:bloodstain",{ }, }) -minetest.register_node("literal_trash:vodka", { +minetest.register_node(":literal_trash:vodka", { description = "Vodka Bottle", drawtype = "plantlike", tiles = {"literal_trash_vodka.png"}, @@ -75,7 +75,7 @@ minetest.register_node("literal_trash:vodka", { sounds = default.node_sound_glass_defaults(), }) -minetest.register_node("literal_trash:beer_bottle", { +minetest.register_node(":literal_trash:beer_bottle", { description = "Beer Bottle", drawtype = "plantlike", tiles = {"literal_trash_beer_bottle.png"}, @@ -92,7 +92,7 @@ minetest.register_node("literal_trash:beer_bottle", { sounds = default.node_sound_glass_defaults(), }) -minetest.register_node("literal_trash:beer_bottle_empty", { +minetest.register_node(":literal_trash:beer_bottle_empty", { description = "Empty Beer Bottle", drawtype = "plantlike", tiles = {"literal_trash_beer_bottle_empty.png"}, @@ -112,7 +112,7 @@ minetest.register_node("literal_trash:beer_bottle_empty", { -minetest.register_node("literal_trash:empty_beer_bottles", { +minetest.register_node(":literal_trash:empty_beer_bottles", { description = "Empty Beer Bottles", drawtype = "plantlike", tiles = {"literal_trash_empty_beer_bottles.png"}, diff --git a/mods/ip_literal_trash/mod.conf b/mods/ip_literal_trash/mod.conf index e8a6365..0b91567 100644 --- a/mods/ip_literal_trash/mod.conf +++ b/mods/ip_literal_trash/mod.conf @@ -1,4 +1,4 @@ -name = literal_trash +name = ip_literal_trash title = Literal Trash description = Adds literal trash diff --git a/mods/main/craftitems.lua b/mods/ip_main/craftitems.lua similarity index 100% rename from mods/main/craftitems.lua rename to mods/ip_main/craftitems.lua diff --git a/mods/main/init.lua b/mods/ip_main/init.lua similarity index 86% rename from mods/main/init.lua rename to mods/ip_main/init.lua index 3ebe22a..c5b233f 100644 --- a/mods/main/init.lua +++ b/mods/ip_main/init.lua @@ -1,4 +1,4 @@ -local modpath = minetest.get_modpath("main") +local modpath = minetest.get_modpath("ip_main") local formspec = { "formspec_version[4]", @@ -22,9 +22,7 @@ local formspec = dofile(modpath.."/nodes.lua") -dofile(modpath.."/craftitems.lua") -dofile(modpath.."/recipes.lua") -dofile(modpath.."/mapgen.lua") +--dofile(modpath.."/craftitems.lua") dofile(modpath.."/tools.lua") diff --git a/mods/main/license.txt b/mods/ip_main/license.txt similarity index 100% rename from mods/main/license.txt rename to mods/ip_main/license.txt diff --git a/mods/main/mapgen.lua b/mods/ip_main/mapgen.lua similarity index 100% rename from mods/main/mapgen.lua rename to mods/ip_main/mapgen.lua diff --git a/mods/ip_main/mod.conf b/mods/ip_main/mod.conf new file mode 100644 index 0000000..c08971d --- /dev/null +++ b/mods/ip_main/mod.conf @@ -0,0 +1 @@ +name = ip_main \ No newline at end of file diff --git a/mods/main/nodes.lua b/mods/ip_main/nodes.lua similarity index 82% rename from mods/main/nodes.lua rename to mods/ip_main/nodes.lua index 9269bd6..23e876a 100644 --- a/mods/main/nodes.lua +++ b/mods/ip_main/nodes.lua @@ -1,5 +1,8 @@ + + + --Naturally generating nodes -minetest.register_node("main:stone", +minetest.register_node(":main:stone", { description = "Stone", tiles = {"main_stone.png"}, @@ -8,7 +11,7 @@ minetest.register_node("main:stone", legacy_mineral = true, }) -minetest.register_node("main:cobble", +minetest.register_node(":main:cobble", { description = "Cobble", tiles = {"main_cobble.png"}, @@ -17,7 +20,7 @@ minetest.register_node("main:cobble", legacy_mineral = true, }) -minetest.register_node("main:rock", +minetest.register_node(":main:rock", { description = "Rock", tiles = {"main_cobble.png"}, @@ -34,26 +37,26 @@ minetest.register_node("main:rock", } }) -minetest.register_node("main:dirt", +minetest.register_node(":main:dirt", { description = "Dirt", tiles = {"main_dirt.png"}, groups = {crumbly = 3, soil = 1}, }) -minetest.register_node("main:dirt_frozen", { +minetest.register_node(":main:dirt_frozen", { description = "Frozen Dirt", tiles = {"main_dirt_frozen.png"}, groups = {cracky = 1}, }) -minetest.register_node("main:snow", { +minetest.register_node(":main:snow", { description = "Snow", tiles = {"main_snow.png"}, groups = {crumbly = 3}, }) -minetest.register_node("main:ice_thin", { +minetest.register_node(":main:ice_thin", { drawtype = "allfaces", paramtype = "light", light_propagates = true, @@ -64,13 +67,13 @@ minetest.register_node("main:ice_thin", { groups = {cracky = 3, slippery = 3}, }) -minetest.register_node("main:ice_thick", { +minetest.register_node(":main:ice_thick", { description = "Thick Ice", tiles = {"main_ice_thick.png"}, groups = {cracky = 1}, }) -minetest.register_node("main:dirt_with_grass", +minetest.register_node(":main:dirt_with_grass", { description = "Dirt with Grass", tiles = {"main_grass.png", "main_dirt.png", @@ -80,7 +83,7 @@ minetest.register_node("main:dirt_with_grass", drop = 'main:dirt', }) -minetest.register_node("main:dirt_with_swamp_grass", +minetest.register_node(":main:dirt_with_swamp_grass", { description = "Dirt with Swamp Grass", tiles = {"main_swamp_grass.png", "main_dirt.png", @@ -90,14 +93,14 @@ minetest.register_node("main:dirt_with_swamp_grass", drop = 'main:dirt', }) -minetest.register_node("main:sand", +minetest.register_node(":main:sand", { description = "Sand", tiles = {"main_sand.png"}, groups = {crumbly = 3, falling_node = 1, sand = 1}, }) -minetest.register_node("main:twig", +minetest.register_node(":main:twig", { description = "Twig", tiles = {"main_log_maple.png"}, @@ -118,7 +121,7 @@ minetest.register_node("main:twig", }) --Player made nodes -minetest.register_node("main:torch", +minetest.register_node(":main:torch", { description = "Torch", tiles = {"main_lump_coal.png"}, @@ -126,28 +129,28 @@ minetest.register_node("main:torch", groups = {choppy = 3, oddly_breakable_by_hand = 3}, }) -minetest.register_node("main:bricks_red", +minetest.register_node(":main:bricks_red", { description = "Red Bricks", tiles = {"main_bricks_red.png"}, groups = {cracky = 2}, }) -minetest.register_node("main:bricks_stone", +minetest.register_node(":main:bricks_stone", { description = "Stone Bricks", tiles = {"main_bricks_stone.png"}, groups = {cracky = 2}, }) -minetest.register_node("main:bricks_cobble", +minetest.register_node(":main:bricks_cobble", { description = "Cobble Bricks", tiles = {"main_bricks_cobble.png"}, groups = {cracky = 2}, }) -minetest.register_node("main:glass", +minetest.register_node(":main:glass", { description = "Glass", drawtype = "glasslike_framed_optional", @@ -161,28 +164,28 @@ minetest.register_node("main:glass", }) --Ores -minetest.register_node("main:coal_ore", +minetest.register_node(":main:coal_ore", { description = "Coal Ore", tiles = {"main_stone.png^main_coal_ore.png"}, groups = {cracky = 1}, }) -minetest.register_node("main:iron_ore", +minetest.register_node(":main:iron_ore", { description = "Iron Ore", tiles = {"main_stone.png^main_iron_ore.png"}, groups = {cracky = 3}, }) -minetest.register_node("main:sulfur_ore", +minetest.register_node(":main:sulfur_ore", { description = "Sulfur Ore", tiles = {"main_stone.png^main_sulfur_ore.png"}, groups = {cracky = 2}, }) -minetest.register_node("main:salt_ore", +minetest.register_node(":main:salt_ore", { description = "Salt Ore", tiles = {"main_stone.png^main_salt_ore.png"}, @@ -190,7 +193,7 @@ minetest.register_node("main:salt_ore", drop = 'main:salt_crystals', }) -minetest.register_node("main:cinnabar_ore", +minetest.register_node(":main:cinnabar_ore", { description = "Cinnabar", tiles = {"main_stone.png^main_cinnabar_ore.png"}, @@ -198,20 +201,20 @@ minetest.register_node("main:cinnabar_ore", }) --Diamond Ores -minetest.register_node("main:diamond_ore_lowdens", { +minetest.register_node(":main:diamond_ore_lowdens", { description = "Low Density Diamond ore", tiles = {"main_stone.png^main_diamond_ore_lowdensity.png"}, groups = {cracky = 3}, }) -minetest.register_node("main:diamond_ore_hidens", { +minetest.register_node(":main:diamond_ore_hidens", { description = "High Density Diamond Ore", tiles = {"main_stone.png^main_diamond_ore.png"}, groups = {cracky = 3}, }) --Iron Block -minetest.register_node("main:block_iron", { +minetest.register_node(":main:block_iron", { description = "Block Of Iron", tiles = {"main_block_iron.png"}, groups = {cracky = 3}, @@ -219,28 +222,28 @@ minetest.register_node("main:block_iron", { }) --Copper Block -minetest.register_node("main:block_copper", { +minetest.register_node(":main:block_copper", { description = "Block Of Copper", tiles = {"main_block_copper.png"}, groups = {cracky = 3}, }) --Brass Block -minetest.register_node("main:block_brass", { +minetest.register_node(":main:block_brass", { description = "Block Of Brass", tiles = {"main_block_brass.png"}, groups = {cracky = 3}, }) --Gold Block -minetest.register_node("main:block_gold", { +minetest.register_node(":main:block_gold", { description = "Block Of Gold", tiles = {"main_block_gold.png"}, groups = {cracky = 3}, }) --Planks -minetest.register_node("main:planks_oak", { +minetest.register_node(":main:planks_oak", { description = "Planks", tiles = {"main_planks_oak.png"}, groups = {choppy = 3}, @@ -252,7 +255,7 @@ minetest.register_node("main:planks_oak", { -- --Red Apple -minetest.register_node("main:apple_red", { +minetest.register_node(":main:apple_red", { description = "Red Apple", tiles = {"main_apple_red.png"}, groups = {fleshy = 3, oddly_breakable_by_hand = 3}, @@ -260,7 +263,7 @@ minetest.register_node("main:apple_red", { }) --Orange -minetest.register_node("main:orange", { +minetest.register_node(":main:orange", { description = "Orange", tiles = {"main_orange.png"}, groups = {fleshy = 3, oddly_breakable_by_hand = 3}, @@ -270,14 +273,14 @@ minetest.register_node("main:orange", { --Oak Log -minetest.register_node("main:log_oak", { +minetest.register_node(":main:log_oak", { description = "Oak Log", tiles = {"main_log_oak.png"}, groups = {choppy = 2, logs = 1}, }) --Oak Leaves -minetest.register_node("main:leaves_oak", { +minetest.register_node(":main:leaves_oak", { paramtype = "light", light_propagates = true, sunlight_propagates = true, @@ -291,7 +294,7 @@ minetest.register_node("main:leaves_oak", { }) --Apple Tree Log -minetest.register_node("main:log_apple", { +minetest.register_node(":main:log_apple", { description = "Apple Tree Log", tiles = {"main_log_apple.png"}, groups = {choppy = 3, logs = 1}, @@ -299,7 +302,7 @@ minetest.register_node("main:log_apple", { }) --Apple Tree Leaves -minetest.register_node("main:leaves_apple", { +minetest.register_node(":main:leaves_apple", { paramtype = "light", light_propagates = true, sunlight_propagates = true, @@ -317,7 +320,7 @@ minetest.register_node("main:leaves_apple", { -- --Fresh water -minetest.register_node("main:water_source", { +minetest.register_node(":main:water_source", { description = "Fresh Water Source", drawtype = "liquid", paramtype = "light", @@ -354,7 +357,7 @@ minetest.register_node("main:water_source", { groups = {liquid = 3, water = 1}, }) -minetest.register_node("main:water_flowing", { +minetest.register_node(":main:water_flowing", { description = "Flowing Water", drawtype = "flowingliquid", paramtype = "light", @@ -429,4 +432,8 @@ stairs.register_stair_and_slab( "Oak Log Slab", default.node_sound_wood_defaults(), true -) \ No newline at end of file +) + + + + \ No newline at end of file diff --git a/mods/main/recipes.lua b/mods/ip_main/recipes.lua similarity index 100% rename from mods/main/recipes.lua rename to mods/ip_main/recipes.lua diff --git a/mods/main/schematics/main_rock_cobble_small.mts b/mods/ip_main/schematics/main_rock_cobble_small.mts similarity index 100% rename from mods/main/schematics/main_rock_cobble_small.mts rename to mods/ip_main/schematics/main_rock_cobble_small.mts diff --git a/mods/main/schematics/main_rock_small.mts b/mods/ip_main/schematics/main_rock_small.mts similarity index 100% rename from mods/main/schematics/main_rock_small.mts rename to mods/ip_main/schematics/main_rock_small.mts diff --git a/mods/main/schematics/main_tree_apple.mts b/mods/ip_main/schematics/main_tree_apple.mts similarity index 100% rename from mods/main/schematics/main_tree_apple.mts rename to mods/ip_main/schematics/main_tree_apple.mts diff --git a/mods/main/schematics/main_tree_oak.mts b/mods/ip_main/schematics/main_tree_oak.mts similarity index 100% rename from mods/main/schematics/main_tree_oak.mts rename to mods/ip_main/schematics/main_tree_oak.mts diff --git a/mods/main/schematics/main_tree_oak_tall.mts b/mods/ip_main/schematics/main_tree_oak_tall.mts similarity index 100% rename from mods/main/schematics/main_tree_oak_tall.mts rename to mods/ip_main/schematics/main_tree_oak_tall.mts diff --git a/mods/main/schematics/main_tree_oak_tall_dead.mts b/mods/ip_main/schematics/main_tree_oak_tall_dead.mts similarity index 100% rename from mods/main/schematics/main_tree_oak_tall_dead.mts rename to mods/ip_main/schematics/main_tree_oak_tall_dead.mts diff --git a/mods/main/textures/bubble.png b/mods/ip_main/textures/bubble.png similarity index 100% rename from mods/main/textures/bubble.png rename to mods/ip_main/textures/bubble.png diff --git a/mods/main/textures/character.png b/mods/ip_main/textures/character.png similarity index 100% rename from mods/main/textures/character.png rename to mods/ip_main/textures/character.png diff --git a/mods/main/textures/crack_anylength.png b/mods/ip_main/textures/crack_anylength.png similarity index 100% rename from mods/main/textures/crack_anylength.png rename to mods/ip_main/textures/crack_anylength.png diff --git a/mods/main/textures/gui_hotbar.png b/mods/ip_main/textures/gui_hotbar.png similarity index 100% rename from mods/main/textures/gui_hotbar.png rename to mods/ip_main/textures/gui_hotbar.png diff --git a/mods/main/textures/gui_hotbar_selected.png b/mods/ip_main/textures/gui_hotbar_selected.png similarity index 100% rename from mods/main/textures/gui_hotbar_selected.png rename to mods/ip_main/textures/gui_hotbar_selected.png diff --git a/mods/main/textures/hand.png b/mods/ip_main/textures/hand.png similarity index 100% rename from mods/main/textures/hand.png rename to mods/ip_main/textures/hand.png diff --git a/mods/main/textures/heart.png b/mods/ip_main/textures/heart.png similarity index 100% rename from mods/main/textures/heart.png rename to mods/ip_main/textures/heart.png diff --git a/mods/main/textures/leaves_grey.png b/mods/ip_main/textures/leaves_grey.png similarity index 100% rename from mods/main/textures/leaves_grey.png rename to mods/ip_main/textures/leaves_grey.png diff --git a/mods/main/textures/main_apple_red.png b/mods/ip_main/textures/main_apple_red.png similarity index 100% rename from mods/main/textures/main_apple_red.png rename to mods/ip_main/textures/main_apple_red.png diff --git a/mods/main/textures/main_berry_straw.png b/mods/ip_main/textures/main_berry_straw.png similarity index 100% rename from mods/main/textures/main_berry_straw.png rename to mods/ip_main/textures/main_berry_straw.png diff --git a/mods/main/textures/main_block_brass.png b/mods/ip_main/textures/main_block_brass.png similarity index 100% rename from mods/main/textures/main_block_brass.png rename to mods/ip_main/textures/main_block_brass.png diff --git a/mods/main/textures/main_block_copper.png b/mods/ip_main/textures/main_block_copper.png similarity index 100% rename from mods/main/textures/main_block_copper.png rename to mods/ip_main/textures/main_block_copper.png diff --git a/mods/main/textures/main_block_gold.png b/mods/ip_main/textures/main_block_gold.png similarity index 100% rename from mods/main/textures/main_block_gold.png rename to mods/ip_main/textures/main_block_gold.png diff --git a/mods/main/textures/main_block_iron.png b/mods/ip_main/textures/main_block_iron.png similarity index 100% rename from mods/main/textures/main_block_iron.png rename to mods/ip_main/textures/main_block_iron.png diff --git a/mods/main/textures/main_bricks_cobble.png b/mods/ip_main/textures/main_bricks_cobble.png similarity index 100% rename from mods/main/textures/main_bricks_cobble.png rename to mods/ip_main/textures/main_bricks_cobble.png diff --git a/mods/main/textures/main_bricks_red.png b/mods/ip_main/textures/main_bricks_red.png similarity index 100% rename from mods/main/textures/main_bricks_red.png rename to mods/ip_main/textures/main_bricks_red.png diff --git a/mods/main/textures/main_bricks_stone.png b/mods/ip_main/textures/main_bricks_stone.png similarity index 100% rename from mods/main/textures/main_bricks_stone.png rename to mods/ip_main/textures/main_bricks_stone.png diff --git a/mods/main/textures/main_cinnabar_ore.png b/mods/ip_main/textures/main_cinnabar_ore.png similarity index 100% rename from mods/main/textures/main_cinnabar_ore.png rename to mods/ip_main/textures/main_cinnabar_ore.png diff --git a/mods/main/textures/main_coal_ore.png b/mods/ip_main/textures/main_coal_ore.png similarity index 100% rename from mods/main/textures/main_coal_ore.png rename to mods/ip_main/textures/main_coal_ore.png diff --git a/mods/main/textures/main_cobble.png b/mods/ip_main/textures/main_cobble.png similarity index 100% rename from mods/main/textures/main_cobble.png rename to mods/ip_main/textures/main_cobble.png diff --git a/mods/main/textures/main_copper_ore.png b/mods/ip_main/textures/main_copper_ore.png similarity index 100% rename from mods/main/textures/main_copper_ore.png rename to mods/ip_main/textures/main_copper_ore.png diff --git a/mods/main/textures/main_diamond_ore.png b/mods/ip_main/textures/main_diamond_ore.png similarity index 100% rename from mods/main/textures/main_diamond_ore.png rename to mods/ip_main/textures/main_diamond_ore.png diff --git a/mods/main/textures/main_diamond_ore_lowdensity.png b/mods/ip_main/textures/main_diamond_ore_lowdensity.png similarity index 100% rename from mods/main/textures/main_diamond_ore_lowdensity.png rename to mods/ip_main/textures/main_diamond_ore_lowdensity.png diff --git a/mods/main/textures/main_dirt.png b/mods/ip_main/textures/main_dirt.png similarity index 100% rename from mods/main/textures/main_dirt.png rename to mods/ip_main/textures/main_dirt.png diff --git a/mods/main/textures/main_dirt_frozen.png b/mods/ip_main/textures/main_dirt_frozen.png similarity index 100% rename from mods/main/textures/main_dirt_frozen.png rename to mods/ip_main/textures/main_dirt_frozen.png diff --git a/mods/main/textures/main_glass.png b/mods/ip_main/textures/main_glass.png similarity index 100% rename from mods/main/textures/main_glass.png rename to mods/ip_main/textures/main_glass.png diff --git a/mods/main/textures/main_glass_frame.png b/mods/ip_main/textures/main_glass_frame.png similarity index 100% rename from mods/main/textures/main_glass_frame.png rename to mods/ip_main/textures/main_glass_frame.png diff --git a/mods/main/textures/main_grass.png b/mods/ip_main/textures/main_grass.png similarity index 100% rename from mods/main/textures/main_grass.png rename to mods/ip_main/textures/main_grass.png diff --git a/mods/main/textures/main_grass_side.png b/mods/ip_main/textures/main_grass_side.png similarity index 100% rename from mods/main/textures/main_grass_side.png rename to mods/ip_main/textures/main_grass_side.png diff --git a/mods/main/textures/main_ice_thick.png b/mods/ip_main/textures/main_ice_thick.png similarity index 100% rename from mods/main/textures/main_ice_thick.png rename to mods/ip_main/textures/main_ice_thick.png diff --git a/mods/main/textures/main_ice_thin.png b/mods/ip_main/textures/main_ice_thin.png similarity index 100% rename from mods/main/textures/main_ice_thin.png rename to mods/ip_main/textures/main_ice_thin.png diff --git a/mods/main/textures/main_iron_ore.png b/mods/ip_main/textures/main_iron_ore.png similarity index 100% rename from mods/main/textures/main_iron_ore.png rename to mods/ip_main/textures/main_iron_ore.png diff --git a/mods/main/textures/main_knife_stone_simple.png b/mods/ip_main/textures/main_knife_stone_simple.png similarity index 100% rename from mods/main/textures/main_knife_stone_simple.png rename to mods/ip_main/textures/main_knife_stone_simple.png diff --git a/mods/main/textures/main_leaves_apple.png b/mods/ip_main/textures/main_leaves_apple.png similarity index 100% rename from mods/main/textures/main_leaves_apple.png rename to mods/ip_main/textures/main_leaves_apple.png diff --git a/mods/main/textures/main_leaves_oak.png b/mods/ip_main/textures/main_leaves_oak.png similarity index 100% rename from mods/main/textures/main_leaves_oak.png rename to mods/ip_main/textures/main_leaves_oak.png diff --git a/mods/main/textures/main_log_apple.png b/mods/ip_main/textures/main_log_apple.png similarity index 100% rename from mods/main/textures/main_log_apple.png rename to mods/ip_main/textures/main_log_apple.png diff --git a/mods/main/textures/main_log_birch.png b/mods/ip_main/textures/main_log_birch.png similarity index 100% rename from mods/main/textures/main_log_birch.png rename to mods/ip_main/textures/main_log_birch.png diff --git a/mods/main/textures/main_log_maple.png b/mods/ip_main/textures/main_log_maple.png similarity index 100% rename from mods/main/textures/main_log_maple.png rename to mods/ip_main/textures/main_log_maple.png diff --git a/mods/main/textures/main_log_oak.png b/mods/ip_main/textures/main_log_oak.png similarity index 100% rename from mods/main/textures/main_log_oak.png rename to mods/ip_main/textures/main_log_oak.png diff --git a/mods/main/textures/main_lump_coal.png b/mods/ip_main/textures/main_lump_coal.png similarity index 100% rename from mods/main/textures/main_lump_coal.png rename to mods/ip_main/textures/main_lump_coal.png diff --git a/mods/main/textures/main_lump_copper.png b/mods/ip_main/textures/main_lump_copper.png similarity index 100% rename from mods/main/textures/main_lump_copper.png rename to mods/ip_main/textures/main_lump_copper.png diff --git a/mods/main/textures/main_lump_iron.png b/mods/ip_main/textures/main_lump_iron.png similarity index 100% rename from mods/main/textures/main_lump_iron.png rename to mods/ip_main/textures/main_lump_iron.png diff --git a/mods/main/textures/main_lump_sulfur.png b/mods/ip_main/textures/main_lump_sulfur.png similarity index 100% rename from mods/main/textures/main_lump_sulfur.png rename to mods/ip_main/textures/main_lump_sulfur.png diff --git a/mods/main/textures/main_muddywater.png b/mods/ip_main/textures/main_muddywater.png similarity index 100% rename from mods/main/textures/main_muddywater.png rename to mods/ip_main/textures/main_muddywater.png diff --git a/mods/main/textures/main_orange.png b/mods/ip_main/textures/main_orange.png similarity index 100% rename from mods/main/textures/main_orange.png rename to mods/ip_main/textures/main_orange.png diff --git a/mods/main/textures/main_pickaxe_steel.png b/mods/ip_main/textures/main_pickaxe_steel.png similarity index 100% rename from mods/main/textures/main_pickaxe_steel.png rename to mods/ip_main/textures/main_pickaxe_steel.png diff --git a/mods/main/textures/main_pickaxe_stone.png b/mods/ip_main/textures/main_pickaxe_stone.png similarity index 100% rename from mods/main/textures/main_pickaxe_stone.png rename to mods/ip_main/textures/main_pickaxe_stone.png diff --git a/mods/main/textures/main_planks_oak.png b/mods/ip_main/textures/main_planks_oak.png similarity index 100% rename from mods/main/textures/main_planks_oak.png rename to mods/ip_main/textures/main_planks_oak.png diff --git a/mods/main/textures/main_rope.png b/mods/ip_main/textures/main_rope.png similarity index 100% rename from mods/main/textures/main_rope.png rename to mods/ip_main/textures/main_rope.png diff --git a/mods/main/textures/main_salt_crystals.png b/mods/ip_main/textures/main_salt_crystals.png similarity index 100% rename from mods/main/textures/main_salt_crystals.png rename to mods/ip_main/textures/main_salt_crystals.png diff --git a/mods/main/textures/main_salt_ore.png b/mods/ip_main/textures/main_salt_ore.png similarity index 100% rename from mods/main/textures/main_salt_ore.png rename to mods/ip_main/textures/main_salt_ore.png diff --git a/mods/main/textures/main_sand.png b/mods/ip_main/textures/main_sand.png similarity index 100% rename from mods/main/textures/main_sand.png rename to mods/ip_main/textures/main_sand.png diff --git a/mods/main/textures/main_sandstone.png b/mods/ip_main/textures/main_sandstone.png similarity index 100% rename from mods/main/textures/main_sandstone.png rename to mods/ip_main/textures/main_sandstone.png diff --git a/mods/main/textures/main_shelf_empty.png b/mods/ip_main/textures/main_shelf_empty.png similarity index 100% rename from mods/main/textures/main_shelf_empty.png rename to mods/ip_main/textures/main_shelf_empty.png diff --git a/mods/main/textures/main_snow.png b/mods/ip_main/textures/main_snow.png similarity index 100% rename from mods/main/textures/main_snow.png rename to mods/ip_main/textures/main_snow.png diff --git a/mods/main/textures/main_stick.png b/mods/ip_main/textures/main_stick.png similarity index 100% rename from mods/main/textures/main_stick.png rename to mods/ip_main/textures/main_stick.png diff --git a/mods/main/textures/main_stone.png b/mods/ip_main/textures/main_stone.png similarity index 100% rename from mods/main/textures/main_stone.png rename to mods/ip_main/textures/main_stone.png diff --git a/mods/main/textures/main_sulfur_ore.png b/mods/ip_main/textures/main_sulfur_ore.png similarity index 100% rename from mods/main/textures/main_sulfur_ore.png rename to mods/ip_main/textures/main_sulfur_ore.png diff --git a/mods/main/textures/main_swamp_grass.png b/mods/ip_main/textures/main_swamp_grass.png similarity index 100% rename from mods/main/textures/main_swamp_grass.png rename to mods/ip_main/textures/main_swamp_grass.png diff --git a/mods/main/textures/main_swamp_grass_side.png b/mods/ip_main/textures/main_swamp_grass_side.png similarity index 100% rename from mods/main/textures/main_swamp_grass_side.png rename to mods/ip_main/textures/main_swamp_grass_side.png diff --git a/mods/main/textures/main_toxicwater.png b/mods/ip_main/textures/main_toxicwater.png similarity index 100% rename from mods/main/textures/main_toxicwater.png rename to mods/ip_main/textures/main_toxicwater.png diff --git a/mods/main/textures/main_toxicwater_animated.png b/mods/ip_main/textures/main_toxicwater_animated.png similarity index 100% rename from mods/main/textures/main_toxicwater_animated.png rename to mods/ip_main/textures/main_toxicwater_animated.png diff --git a/mods/main/textures/main_twig.png b/mods/ip_main/textures/main_twig.png similarity index 100% rename from mods/main/textures/main_twig.png rename to mods/ip_main/textures/main_twig.png diff --git a/mods/main/textures/main_water.png b/mods/ip_main/textures/main_water.png similarity index 100% rename from mods/main/textures/main_water.png rename to mods/ip_main/textures/main_water.png diff --git a/mods/main/textures/main_water_flowing_animated.png b/mods/ip_main/textures/main_water_flowing_animated.png similarity index 100% rename from mods/main/textures/main_water_flowing_animated.png rename to mods/ip_main/textures/main_water_flowing_animated.png diff --git a/mods/main/textures/main_water_source_animated.png b/mods/ip_main/textures/main_water_source_animated.png similarity index 100% rename from mods/main/textures/main_water_source_animated.png rename to mods/ip_main/textures/main_water_source_animated.png diff --git a/mods/main/textures/player.png b/mods/ip_main/textures/player.png similarity index 100% rename from mods/main/textures/player.png rename to mods/ip_main/textures/player.png diff --git a/mods/main/textures/player_back.png b/mods/ip_main/textures/player_back.png similarity index 100% rename from mods/main/textures/player_back.png rename to mods/ip_main/textures/player_back.png diff --git a/mods/main/tools.lua b/mods/ip_main/tools.lua similarity index 91% rename from mods/main/tools.lua rename to mods/ip_main/tools.lua index 71d5fc6..1575b77 100644 --- a/mods/main/tools.lua +++ b/mods/ip_main/tools.lua @@ -15,7 +15,7 @@ minetest.register_item(":", { } }) -minetest.register_item("main:pickaxe_steel", { +minetest.register_item(":main:pickaxe_steel", { type = "none", wield_image = "main_pickaxe_steel.png", inventory_image = "main_pickaxe_steel.png", @@ -32,7 +32,7 @@ minetest.register_item("main:pickaxe_steel", { } }) -minetest.register_item("main:pickaxe_stone", { +minetest.register_item(":main:pickaxe_stone", { type = "none", wield_image = "main_pickaxe_stone.png", inventory_image = "main_pickaxe_stone.png", @@ -49,7 +49,7 @@ minetest.register_item("main:pickaxe_stone", { } }) -minetest.register_item("main:knife_stone_simple", { +minetest.register_item(":main:knife_stone_simple", { type = "none", wield_image = "main_knife_stone_simple.png", inventory_image = "main_knife_stone_simple.png", diff --git a/mods/ip_mobs_redo/api.lua b/mods/ip_mobs_redo/api.lua index 6ff43be..d63f1c9 100644 --- a/mods/ip_mobs_redo/api.lua +++ b/mods/ip_mobs_redo/api.lua @@ -768,7 +768,7 @@ end function mob_class:item_drop() -- no drops if disabled by setting or mob is child - if not mobs_drop_items or self.child then return end + local pos = self.object:get_pos() @@ -780,27 +780,7 @@ function mob_class:item_drop() return end - -- was mob killed by player? - local death_by_player = self.cause_of_death - and self.cause_of_death.puncher - and self.cause_of_death.puncher:is_player() - - -- check for tool 'looting_level' under tool_capabilities as default, or use - -- meta string 'looting_level' if found (max looting level is 3). - local looting = 0 - - if death_by_player then - - local wield_stack = self.cause_of_death.puncher:get_wielded_item() - local wield_name = wield_stack:get_name() - local wield_stack_meta = wield_stack:get_meta() - local item_def = minetest.registered_items[wield_name] - local item_looting = item_def and item_def.tool_capabilities and - item_def.tool_capabilities.looting_level or 0 - - looting = tonumber(wield_stack_meta:get_string("looting_level")) or item_looting - looting = min(looting, 3) - end + --print("--- looting level", looting) @@ -813,21 +793,11 @@ function mob_class:item_drop() num = random(self.drops[n].min or 0, self.drops[n].max or 1) item = self.drops[n].name - -- cook items on a hot death - if self.cause_of_death.hot 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 - - -- only drop rare items (drops.min = 0) if killed by player - if death_by_player or self.drops[n].min ~= 0 then - obj = minetest.add_item(pos, ItemStack(item .. " " .. (num + looting))) - end + + obj = minetest.add_item(pos, ItemStack(item .. " " .. (num))) + if obj and obj:get_luaentity() then @@ -1198,7 +1168,7 @@ end -- jump if facing a solid node (not fences or gates) function mob_class:do_jump() - +--[[ if not self.jump or self.jump_height == 0 or self.fly @@ -1235,14 +1205,18 @@ function mob_class:do_jump() pos.y = pos.y + self.collisionbox[2] -- what is in front of mob and above? + + --This piece of code was causing random crashes + local nod = node_ok({x = pos.x + dir_x, y = pos.y + 0.5, z = pos.z + dir_z}) - local nodt = node_ok({x = pos.x + dir_x, y = pos.y + 1.5, z = pos.z + dir_z}) + [local nodt = node_ok({x = pos.x + dir_x, y = pos.y + 1.5, z = pos.z + dir_z}) local blocked = minetest.registered_nodes[nodt.name].walkable -- are we facing a fence or wall if nod.name:find("fence") or nod.name:find("gate") or nod.name:find("wall") then self.facing_fence = true end +]] --[[ print("on: " .. self.standing_on @@ -1252,7 +1226,7 @@ print("on: " .. self.standing_on .. ", fence: " .. (self.facing_fence and "yes" or "no") ) ]] - +--[[ -- if mob can leap then remove blockages and let them try if self.can_leap == true then blocked = false @@ -1309,7 +1283,7 @@ print("on: " .. self.standing_on end end - return false + return false]] end diff --git a/mods/ip_more_fire/init.lua b/mods/ip_more_fire/init.lua index 5c7a053..ee88d01 100644 --- a/mods/ip_more_fire/init.lua +++ b/mods/ip_more_fire/init.lua @@ -7,7 +7,7 @@ default.gui_slots = 'listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]' more_fire = {} -dofile(minetest.get_modpath('more_fire')..'/molotov.lua') -dofile(minetest.get_modpath('more_fire')..'/pipebomb.lua') -dofile(minetest.get_modpath('more_fire')..'/smokebomb.lua') +dofile(minetest.get_modpath('ip_more_fire')..'/molotov.lua') +dofile(minetest.get_modpath('ip_more_fire')..'/pipebomb.lua') +--dofile(minetest.get_modpath('ip_more_fire')..'/smokebomb.lua') diff --git a/mods/ip_more_fire/mod.conf b/mods/ip_more_fire/mod.conf index a8a8495..841302a 100644 --- a/mods/ip_more_fire/mod.conf +++ b/mods/ip_more_fire/mod.conf @@ -1,6 +1,6 @@ -name = more_fire +name = ip_more_fire title = More Fire -depends = explosives, fire, vessels -description = This is a Minetest mod that adds more/better fire related stuff. -author = Nathan, Napiophelios +depends = ip_explosives, fire, ip_vessels +description = Derivative of the More Fire mod by Nathan Salapat +author = Nathan, Napiophelios, MCL optional_depends = ethereal diff --git a/mods/ip_more_fire/molotov.lua b/mods/ip_more_fire/molotov.lua index 204115c..0746c71 100644 --- a/mods/ip_more_fire/molotov.lua +++ b/mods/ip_more_fire/molotov.lua @@ -5,7 +5,7 @@ local MOD_NAME = minetest.get_current_modname() local MOD_PATH = minetest.get_modpath(MOD_NAME) local Vec3 = dofile(MOD_PATH..'/lib/Vec3_1-0.lua') -minetest.register_craftitem('more_fire:molotov_cocktail', { +minetest.register_craftitem(':more_fire:molotov_cocktail', { description = 'Throwable Firebomb', inventory_image = 'more_fire_molotov_cocktail.png', on_place = function(itemstack, user, pointed_thing) @@ -219,7 +219,7 @@ MORE_FIRE_MOLOTOV_ENTITY.on_step = function(self, dtime) self.lastpos={x=pos.x, y=pos.y, z=pos.z} end -minetest.register_entity('more_fire:molotov_entity', MORE_FIRE_MOLOTOV_ENTITY) +minetest.register_entity(':more_fire:molotov_entity', MORE_FIRE_MOLOTOV_ENTITY) minetest.override_item('more_fire:molotov_cocktail', {on_use = throw_cocktail}) @@ -276,10 +276,3 @@ minetest.register_craft( { {'vessels:glass_bottle'}, } }) - --- fuel recipes -minetest.register_craft({ - type = 'fuel', - recipe = 'more_fire:molotov_cocktail', - burntime = 5, -}) diff --git a/mods/ip_more_fire/pipebomb.lua b/mods/ip_more_fire/pipebomb.lua index cafb98a..120622a 100644 --- a/mods/ip_more_fire/pipebomb.lua +++ b/mods/ip_more_fire/pipebomb.lua @@ -6,7 +6,7 @@ local MOD_PATH = minetest.get_modpath(MOD_NAME) local Vec3 = dofile(MOD_PATH..'/lib/Vec3_1-0.lua') local playerWhoThrewObject = minetest.get_player_by_name("singleplayer") -minetest.register_craftitem('more_fire:pipebomb', { +minetest.register_craftitem(':more_fire:pipebomb', { description = 'Pipe Bomb', inventory_image = 'more_fire_pipebomb.png', @@ -120,7 +120,7 @@ MORE_FIRE_PIPEBOMB_ENTITY.on_step = function(self, dtime) end end -minetest.register_entity('more_fire:pipebomb_entity', MORE_FIRE_PIPEBOMB_ENTITY) +minetest.register_entity(':more_fire:pipebomb_entity', MORE_FIRE_PIPEBOMB_ENTITY) minetest.override_item('more_fire:pipebomb', {on_use = throw_pipebomb}) diff --git a/mods/ip_more_fire/smokebomb.lua b/mods/ip_more_fire/smokebomb.lua index 52a2e1b..5f28874 100644 --- a/mods/ip_more_fire/smokebomb.lua +++ b/mods/ip_more_fire/smokebomb.lua @@ -5,7 +5,7 @@ local MOD_PATH = minetest.get_modpath(MOD_NAME) local Vec3 = dofile(MOD_PATH..'/lib/Vec3_1-0.lua') -minetest.register_craftitem('more_fire:smokebomb', { +minetest.register_craftitem(':more_fire:smokebomb', { description = 'Smoke Bomb', inventory_image = 'more_fire_smokebomb.png', on_place = function(itemstack, user, pointed_thing) diff --git a/mods/ip_terumet/init.lua b/mods/ip_terumet/init.lua index f033a70..af3576f 100644 --- a/mods/ip_terumet/init.lua +++ b/mods/ip_terumet/init.lua @@ -36,7 +36,7 @@ terumet = {} terumet.version = {major=3, minor=0, patch=0} local ver = terumet.version terumet.version_text = ver.major .. '.' .. ver.minor .. '.' .. ver.patch -terumet.mod_name = "terumet" +terumet.mod_name = ":terumet" -- this isn't the suggested way to check for game version but... it works for my purposes terumet.legacy = minetest.get_version().string:find('0.4') @@ -162,7 +162,7 @@ function terumet.format_time(t) end function terumet.do_lua_file(name) - dofile(minetest.get_modpath(terumet.mod_name) .. '/' .. name .. '.lua') + dofile(minetest.get_modpath("ip_terumet") .. '/' .. name .. '.lua') end -- create a copy of node groups from an unlit machine for lit version of machine @@ -216,10 +216,12 @@ function terumet.tex(id) -- accepts both base ids (assuming this mod) and full mod ids -- ex: terumet.tex('ingot_raw') -> 'terumet_ingot_raw.png' -- terumet.tex('default:cobble') -> 'default_cobble.png' + if id:match(':') then + id = id:sub(2) return string.format('%s.png', id:gsub(':', '_')) else - return string.format('%s_%s.png', terumet.mod_name, id) + return string.format('%s_%s.png', "terumet", id) end end diff --git a/mods/ip_terumet/mod.conf b/mods/ip_terumet/mod.conf index a267a91..56a0555 100644 --- a/mods/ip_terumet/mod.conf +++ b/mods/ip_terumet/mod.conf @@ -1,4 +1,4 @@ -name=terumet +name=ip_terumet description=Terumetal v3.0 - Make life easier with alloys and heat machinery! depends=walls, stairs, doors, dye optional_depends=unified_inventory,tubelib,stairs,doors,tnt,mesecons,dungeon_loot,bushes,dryplants,vines,mobs_animal,main,extra diff --git a/mods/ip_vessels/init.lua b/mods/ip_vessels/init.lua index 0ee24f4..2ed232f 100644 --- a/mods/ip_vessels/init.lua +++ b/mods/ip_vessels/init.lua @@ -52,10 +52,10 @@ local vessels_shelf_def = { end, } --default.set_inventory_action_loggers(vessels_shelf_def, "vessels shelf") -minetest.register_node("vessels:shelf", vessels_shelf_def) +minetest.register_node(":vessels:shelf", vessels_shelf_def) -minetest.register_node("vessels:glass_bottle", { +minetest.register_node(":vessels:glass_bottle", { description = "Empty Glass Bottle", drawtype = "plantlike", tiles = {"vessels_glass_bottle.png"}, @@ -73,7 +73,7 @@ minetest.register_node("vessels:glass_bottle", { }) -minetest.register_node("vessels:drinking_glass", { +minetest.register_node(":vessels:drinking_glass", { description = "Empty Drinking Glass", drawtype = "plantlike", tiles = {"vessels_drinking_glass.png"}, @@ -91,7 +91,7 @@ minetest.register_node("vessels:drinking_glass", { }) -minetest.register_node("vessels:steel_bottle", { +minetest.register_node(":vessels:steel_bottle", { description = "Empty Heavy Steel Bottle", drawtype = "plantlike", tiles = {"vessels_steel_bottle.png"}, @@ -112,7 +112,7 @@ minetest.register_node("vessels:steel_bottle", { -- Glass and steel recycling -minetest.register_craftitem("vessels:glass_fragments", { +minetest.register_craftitem(":vessels:glass_fragments", { description = "Glass Fragments", inventory_image = "vessels_glass_fragments.png", }) diff --git a/mods/ip_vessels/mod.conf b/mods/ip_vessels/mod.conf index 49700bc..08054c5 100644 --- a/mods/ip_vessels/mod.conf +++ b/mods/ip_vessels/mod.conf @@ -1,3 +1,3 @@ -name = vessels -description = Vessels mod from MTG modified for Adsurv -depends = main +name = ip_vessels +description = Vessels mod from MTG modified for Insane Protestor +depends = ip_main diff --git a/mods/ip_waterworks/crafting.lua b/mods/ip_waterworks/crafting.lua deleted file mode 100644 index 2271c94..0000000 --- a/mods/ip_waterworks/crafting.lua +++ /dev/null @@ -1,92 +0,0 @@ ---"waterworks:pipe" -if minetest.get_modpath("pipeworks") then -minetest.register_craft( { - output = "waterworks:pipe 12", - recipe = { - { "default:steel_ingot", "", "default:steel_ingot" }, - { "default:steel_ingot", "", "default:steel_ingot" }, - { "default:steel_ingot", "", "default:steel_ingot" } - }, -}) -else -minetest.register_craft( { - output = "waterworks:pipe 12", - recipe = { - { "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" }, - { "", "", "" }, - { "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" } - }, -}) -end - ---"waterworks:valve_on" -minetest.register_craft( { - output = "waterworks:valve_on", - recipe = { - { "default:steel_ingot", "", "default:steel_ingot" }, - { "", "waterworks:pipe", "" }, - { "default:steel_ingot", "", "default:steel_ingot" } - }, -}) - ---"waterworks:inlet" -minetest.register_craft( { - output = "waterworks:inlet", - recipe = { - { "default:steel_ingot", "", "" }, - { "", "waterworks:pipe", "" }, - { "default:steel_ingot", "", "" } - }, -}) ---"waterworks:pumped_inlet" -minetest.register_craft( { - output = "waterworks:pumped_inlet", - recipe = { - { "default:steel_ingot", "", "" }, - { "default:mese_crystal_fragment", "waterworks:pipe", "" }, - { "default:steel_ingot", "", "" } - }, -}) -minetest.register_craft( { - output = "waterworks:pumped_inlet", - recipe = { - { "default:mese_crystal_fragment", "waterworks:inlet"}, - }, -}) - ---"waterworks:outlet" -minetest.register_craft( { - output = "waterworks:outlet", - recipe = { - { "", "", "default:steel_ingot" }, - { "", "waterworks:pipe", "" }, - { "", "", "default:steel_ingot" } - }, -}) - ---"waterworks:grate" -minetest.register_craft( { - output = "waterworks:grate", - recipe = { - { "", "default:steel_ingot", "" }, - { "", "waterworks:pipe", "" }, - { "", "default:steel_ingot", "" } - }, -}) - --- Allow the basic connectors to be cycled through -minetest.register_craft( { - output = "waterworks:inlet", - type = "shapeless", - recipe = { "waterworks:outlet"}, -}) -minetest.register_craft( { - output = "waterworks:outlet", - type = "shapeless", - recipe = {"waterworks:grate"}, -}) -minetest.register_craft( { - output = "waterworks:grate", - type = "shapeless", - recipe = {"waterworks:inlet"}, -}) \ No newline at end of file diff --git a/mods/ip_waterworks/init.lua b/mods/ip_waterworks/init.lua index ab2b149..60a6e28 100644 --- a/mods/ip_waterworks/init.lua +++ b/mods/ip_waterworks/init.lua @@ -2,11 +2,9 @@ waterworks = {} local modpath = minetest.get_modpath(minetest.get_current_modname()) -dofile(modpath .. "/globalstep.lua") -dofile(modpath .. "/network.lua") + dofile(modpath .. "/execute.lua") dofile(modpath .. "/nodes.lua") -dofile(modpath .. "/crafting.lua") if minetest.settings:get_bool("waterworks_make_default_water_non_renewable") then local override_def = {liquid_renewable = false} diff --git a/mods/ip_waterworks/mod.conf b/mods/ip_waterworks/mod.conf index a3f46df..8f2726e 100644 --- a/mods/ip_waterworks/mod.conf +++ b/mods/ip_waterworks/mod.conf @@ -1,3 +1,3 @@ -name = waterworks -description = Provides pipes, pumps, and valves for moving water over long distances +name = ip_waterworks +description = Waterworks mod adapted for Insane Protestor optional_dependencies = default \ No newline at end of file diff --git a/mods/ip_waterworks/network.lua b/mods/ip_waterworks/network.lua deleted file mode 100644 index fd2fbf4..0000000 --- a/mods/ip_waterworks/network.lua +++ /dev/null @@ -1,386 +0,0 @@ -local pipe_networks = waterworks.pipe_networks - -local invalidate_cache = function(pipe_network) - pipe_network.cache_valid = false - waterworks.dirty_data = true -end - -local cardinal_dirs = { - {x= 0, y=0, z= 1}, - {x= 1, y=0, z= 0}, - {x= 0, y=0, z=-1}, - {x=-1, y=0, z= 0}, - {x= 0, y=-1, z= 0}, - {x= 0, y=1, z= 0}, -} --- Mapping from facedir value to index in cardinal_dirs. -local facedir_to_dir_map = { - [0]=1, 2, 3, 4, - 5, 2, 6, 4, - 6, 2, 5, 4, - 1, 5, 3, 6, - 1, 6, 3, 5, - 1, 4, 3, 2, -} - --- Turn the cardinal directions into a set of integers you can add to a hash to step in that direction. -local cardinal_dirs_hash = {} -for i, dir in ipairs(cardinal_dirs) do - cardinal_dirs_hash[i] = minetest.hash_node_position(dir) - minetest.hash_node_position({x=0, y=0, z=0}) -end - -local facedir_to_dir_index = function(param2) - return facedir_to_dir_map[param2 % 32] -end - -local facedir_to_cardinal_hash = function(dir_index) - return cardinal_dirs_hash[dir_index] -end - -waterworks.facedir_to_hash = function(param2) - return facedir_to_cardinal_hash(facedir_to_dir_index(param2)) -end - -local init_new_network = function(hash_pos) - waterworks.dirty_data = true - return {pipes = {[hash_pos] = true}, connected = {}, cache_valid = false} -end - -local get_neighbor_pipes = function(pos) - local neighbor_pipes = {} - local neighbor_connected = {} - for _, dir in ipairs(cardinal_dirs) do - local potential_pipe_pos = vector.add(pos, dir) - local neighbor = minetest.get_node(potential_pipe_pos) - if minetest.get_item_group(neighbor.name, "waterworks_pipe") > 0 then - table.insert(neighbor_pipes, potential_pipe_pos) - elseif minetest.get_item_group(neighbor.name, "waterworks_connected") > 0 then - table.insert(neighbor_connected, potential_pipe_pos) - end - end - return neighbor_pipes, neighbor_connected -end - -local merge_networks = function(index_list) - table.sort(index_list) - local first_index = table.remove(index_list, 1) - local merged_network = pipe_networks[first_index] - -- remove in reverse order so that indices of earlier tables to remove don't get disrupted - for i = #index_list, 1, -1 do - local index = index_list[i] - local net_to_merge = pipe_networks[index] - for pipe_hash, _ in pairs(net_to_merge.pipes) do - merged_network.pipes[pipe_hash] = true - end - for item_type, item_list in pairs(net_to_merge.connected) do - merged_network.connected[item_type] = merged_network.connected[item_type] or {} - for connection_hash, connection_data in pairs(item_list) do - merged_network.connected[item_type][connection_hash] = connection_data - end - end - table.remove(pipe_networks, index) - end - invalidate_cache(merged_network) - return first_index -end - -local handle_connected = function(connected_positions) - for _, pos in ipairs(connected_positions) do - local node = minetest.get_node(pos) - local node_def = minetest.registered_nodes[node.name] - if node_def._waterworks_update_connected then - node_def._waterworks_update_connected(pos) - else - minetest.log("error", "[waterworks] Node def for " .. node.name .. " had no _waterworks_update_connected defined") - end - end -end - - --- When placing a pipe at pos, identifies what pipe network to add it to and updates the network map. --- Note that this can result in fusing multiple networks together into one network. -waterworks.place_pipe = function(pos) - local hash_pos = minetest.hash_node_position(pos) - local neighbor_pipes, neighbor_connected = get_neighbor_pipes(pos) - local neighbor_count = #neighbor_pipes - - if neighbor_count == 0 then - -- this newly-placed pipe has no other pipes next to it, so make a new network for it. - local new_net = init_new_network(hash_pos) - table.insert(pipe_networks, new_net) - handle_connected(neighbor_connected) - return #pipe_networks - elseif neighbor_count == 1 then - -- there's only one pipe neighbor. Look up what network it belongs to and add this pipe to it too. - local neighbor_pos_hash = minetest.hash_node_position(neighbor_pipes[1]) - for i, net in ipairs(pipe_networks) do - local pipes = net.pipes - if pipes[neighbor_pos_hash] then - pipes[hash_pos] = true - invalidate_cache(net) - handle_connected(neighbor_connected) - return i - end - end - else - local neighbor_index_set = {} -- set of indices for networks that neighbors belong to - local neighbor_index_list = {} -- list version of above - for _, neighbor_pos in ipairs(neighbor_pipes) do - local neighbor_hash = minetest.hash_node_position(neighbor_pos) - for i, net in ipairs(pipe_networks) do - if net.pipes[neighbor_hash] then - if not neighbor_index_set[i] then - table.insert(neighbor_index_list, i) - neighbor_index_set[i] = true - end - end - end - end - - if #neighbor_index_list == 1 then -- all neighbors belong to one network. Add this node to that network. - local target_network_index = neighbor_index_list[1] - pipe_networks[target_network_index]["pipes"][hash_pos] = true - invalidate_cache(pipe_networks[target_network_index]) - handle_connected(neighbor_connected) - return target_network_index - end - - -- The most complicated case, this new pipe segment bridges multiple networks. - if #neighbor_index_list > 1 then - local new_index = merge_networks(neighbor_index_list) - pipe_networks[new_index]["pipes"][hash_pos] = true - handle_connected(neighbor_connected) - return new_index - end - end - - -- if we get here we're in a strange state - there are neighbor pipe nodes but none are registered in a network. - -- We could be trying to recover from corruption, so pretend the neighbors don't exist and start a new network. - -- The unregistered neighbors may join it soon. - local new_net = init_new_network(hash_pos) - table.insert(pipe_networks, new_net) - handle_connected(neighbor_connected) - return #pipe_networks - -end - -waterworks.remove_pipe = function(pos) - local hash_pos = minetest.hash_node_position(pos) - local neighbor_pipes = get_neighbor_pipes(pos) - local neighbor_count = #neighbor_pipes - - if neighbor_count == 0 then - -- no neighbors, so this is the last of its network. - for i, net in ipairs(pipe_networks) do - if net.pipes[hash_pos] then - table.remove(pipe_networks, i) - waterworks.dirty_data = true - return i - end - end - - minetest.log("error", "[waterworks] pipe removed from pos " .. minetest.pos_to_string(pos) .. - " didn't belong to any networks. Something went wrong to get to this state.") - return -1 - elseif neighbor_count == 1 then - -- there's only one pipe neighbor. This pipe is at the end of a line, so just remove it. - for i, net in ipairs(pipe_networks) do - local pipes = net.pipes - if pipes[hash_pos] then - pipes[hash_pos] = nil - invalidate_cache(net) - -- If there's anything connected to the pipe here, remove it from the network too - for _, connected_items in pairs(net.connected) do - connected_items[hash_pos] = nil - end - return i - end - end - minetest.log("error", "[waterworks] pipe removed from pos " .. minetest.pos_to_string(pos) .. - " didn't belong to any networks, despite being neighbor to one at " .. - minetest.pos_to_string(neighbor_pipes[1]) .. - ". Something went wrong to get to this state.") - return -1 - else - -- we may be splitting networks. This is complicated. - -- find the network we currently belong to. Remove ourselves from it. - local old_net - local old_pipes - local old_connected - local old_index - for i, net in ipairs(pipe_networks) do - local pipes = net.pipes - if pipes[hash_pos] then - old_connected = net.connected - old_net = net - old_pipes = pipes - old_index = i - old_pipes[hash_pos] = nil - -- if there's anything connected to the pipe here, remove it - for _, connected_items in pairs(old_connected) do - connected_items[hash_pos] = nil - end - end - end - if old_index == nil then - minetest.log("error", "[waterworks] pipe removed from pos " .. minetest.pos_to_string(pos) .. - " didn't belong to any networks, despite being neighbor to several. Something went wrong to get to this state.") - return -1 - end - - -- get the hashes of the neighbor positions. - -- We're maintaining a set as well as a list because they're - -- efficient for different purposes. The list is easy to count, - -- the set is easy to test membership of. - local neighbor_hashes_list = {} - local neighbor_hashes_set = {} - for i, neighbor_pos in ipairs(neighbor_pipes) do - local neighbor_hash = minetest.hash_node_position(neighbor_pos) - neighbor_hashes_list[i] = neighbor_hash - neighbor_hashes_set[neighbor_hash] = true - end - - -- We're going to need to traverse through the old network, starting from each of our neighbors, - -- to establish what's still connected. - local to_visit = {} - local visited = {[hash_pos] = true} -- set of hashes we've visited already. We know the starting point is not valid. - local new_nets = {} -- this will be where we put new sets of connected nodes. - while #neighbor_hashes_list > 0 do - local current_neighbor = table.remove(neighbor_hashes_list) -- pop neighbor hash and push it into the to_visit list. - neighbor_hashes_set[current_neighbor] = nil - table.insert(to_visit, current_neighbor) -- file that neighbor hash as our starting point. - local new_net = init_new_network(current_neighbor) -- we know that hash is in old_net, so initialize the new_net with it. - local new_pipes = new_net.pipes - while #to_visit > 0 do - local current_hash = table.remove(to_visit) - for _, cardinal_hash in ipairs(cardinal_dirs_hash) do - local test_hash = cardinal_hash + current_hash - if not visited[test_hash] then - if old_pipes[test_hash] then - -- we've traversed to a node that was in the old network - old_pipes[test_hash] = nil -- remove from old network - new_pipes[test_hash] = true -- add to one we're building - table.insert(to_visit, test_hash) -- flag it as next one to traverse from - if neighbor_hashes_set[test_hash] then - --we've encountered another neighbor while traversing - --eliminate it from future consideration as a starting point. - neighbor_hashes_set[test_hash] = nil - for i, neighbor_hash_in_list in ipairs(neighbor_hashes_list) do - if neighbor_hash_in_list == test_hash then - table.remove(neighbor_hashes_list, i) - break - end - end - if #neighbor_hashes_list == 0 then - --Huzzah! We encountered all neighbors. The rest of the nodes in old_net should belong to new_net. - --We can skip all remaining pathfinding flood-fill and connected testing - for remaining_hash, _ in pairs(old_pipes) do - new_pipes[remaining_hash] = true - to_visit = {} - end - break - end - end - end - end - end - visited[current_hash] = true - end - table.insert(new_nets, new_net) - end - - -- distribute connected items to the new nets - if #new_nets == 1 then - -- net didn't split, just keep the old stuff - new_nets[1].connected = old_connected - else - for _, new_net in ipairs(new_nets) do - local new_pipes = new_net.pipes - for item_type, item_list in pairs(old_connected) do - new_net.connected[item_type] = new_net.connected[item_type] or {} - for connection_hash, connection_data in pairs(item_list) do - if new_pipes[connection_hash] then - new_net.connected[item_type][connection_hash] = connection_data - end - end - end - end - end - - -- replace the old net with one of the new nets - pipe_networks[old_index] = table.remove(new_nets) - -- if there are any additional nets left, add those as brand new ones. - for _, new_net in ipairs(new_nets) do - table.insert(pipe_networks, new_net) - end - return old_index - end -end - -waterworks.place_connected = function(pos, item_type, data) - local node = minetest.get_node(pos) - local dir_index = facedir_to_dir_index(node.param2) - local dir_hash = facedir_to_cardinal_hash(dir_index) - local pos_hash = minetest.hash_node_position(pos) - local connection_hash = pos_hash + dir_hash - - for i, net in ipairs(pipe_networks) do - if net.pipes[connection_hash] then - net.connected[item_type] = net.connected[item_type] or {} - net.connected[item_type][connection_hash] = net.connected[item_type][connection_hash] or {} - net.connected[item_type][connection_hash][dir_index] = data - invalidate_cache(net) - return i - end - end - - return -1 -end - -waterworks.remove_connected = function(pos, item_type) - local node = minetest.get_node(pos) - local dir_index = facedir_to_dir_index(node.param2) - local dir_hash = facedir_to_cardinal_hash(dir_index) - local pos_hash = minetest.hash_node_position(pos) - local connection_hash = pos_hash + dir_hash - - for i, net in ipairs(pipe_networks) do - if net.pipes[connection_hash] then - local item_list = net.connected[item_type] - if item_list then - if item_list[connection_hash] ~= nil then - local connected_items = item_list[connection_hash] - connected_items[dir_index] = nil - local count = 0 - for _, data in pairs(connected_items) do - count = count + 1 - end - if count == 0 then - item_list[connection_hash] = nil - end - count = 0 - for _, item in pairs(item_list) do - count = count + 1 - end - if count == 0 then - net.connected[item_type] = nil - end - invalidate_cache(net) - return i - end - end - break -- If we get here, we didn't find the connected node even though we should have. - end - end - - return -1 -end - -waterworks.find_network_for_pipe_hash = function(hash) - for i, net in ipairs(pipe_networks) do - if net.pipes[hash] then - return i - end - end - return -1 -end \ No newline at end of file diff --git a/mods/ip_waterworks/nodes.lua b/mods/ip_waterworks/nodes.lua index 365bd14..b71fea4 100644 --- a/mods/ip_waterworks/nodes.lua +++ b/mods/ip_waterworks/nodes.lua @@ -1,5 +1,5 @@ -minetest.register_node("waterworks:pipe", { +minetest.register_node(":waterworks:pipe", { description = "Waterworks Pipe", tiles = { {name="waterworks_pipe.png^waterworks_pipe_rivets_offset.png", scale=4, align_style="world"}, @@ -38,7 +38,7 @@ minetest.register_node("waterworks:pipe", { ----------------------------------------------------------------- -minetest.register_node("waterworks:valve_on", { +minetest.register_node(":waterworks:valve_on", { description = "Waterworks Valve (open)", tiles = {"waterworks_metal.png^waterworks_valve_seam.png^waterworks_valve_on.png",}, connects_to = {"group:waterworks_pipe", "group:waterworks_connected", "group:waterworks_inert"}, @@ -71,7 +71,7 @@ minetest.register_node("waterworks:valve_on", { end, }) -minetest.register_node("waterworks:valve_off", { +minetest.register_node(":waterworks:valve_off", { description = "Waterworks Valve (closed)", tiles = {"waterworks_metal.png^waterworks_valve_seam.png^waterworks_valve_off.png",}, connects_to = {"group:waterworks_pipe", "group:waterworks_connected", "group:waterworks_inert"}, @@ -109,7 +109,7 @@ local place_inlet = function(pos) local meta = minetest.get_meta(pos) meta:set_string("infotext", "Inlet elevation " .. tostring(target.y)) end -minetest.register_node("waterworks:inlet", { +minetest.register_node(":waterworks:inlet", { description = "Waterworks Inlet", tiles = { "waterworks_metal.png", @@ -153,7 +153,7 @@ local place_pumped_inlet = function(pos) local meta = minetest.get_meta(pos) meta:set_string("infotext", "Pump effective elevation " .. tostring(target.y + 100)) end -minetest.register_node("waterworks:pumped_inlet", { +minetest.register_node(":waterworks:pumped_inlet", { description = "Waterworks Pumped Inlet", tiles = { "waterworks_turbine_base.png", @@ -193,7 +193,7 @@ local place_outlet = function(pos) local meta = minetest.get_meta(pos) meta:set_string("infotext", "Outlet elevation " .. tostring(target.y)) end -minetest.register_node("waterworks:outlet", { +minetest.register_node(":waterworks:outlet", { description = "Waterworks Outlet", tiles = { "waterworks_metal.png", @@ -239,7 +239,7 @@ local place_grate = function(pos) local meta = minetest.get_meta(pos) meta:set_string("infotext", "Grate elevation " .. tostring(target.y)) end -minetest.register_node("waterworks:grate", { +minetest.register_node(":waterworks:grate", { description = "Waterworks Grate", tiles = { "waterworks_metal.png", diff --git a/mods/ip_xdecor/handlers/registration.lua b/mods/ip_xdecor/handlers/registration.lua index c421b86..379eab8 100644 --- a/mods/ip_xdecor/handlers/registration.lua +++ b/mods/ip_xdecor/handlers/registration.lua @@ -65,7 +65,7 @@ function xdecor.register(name, def) local inventory = def.inventory - minetest.register_node("xdecor:" .. name, def) + minetest.register_node(":xdecor:" .. name, def) local workbench = minetest.settings:get_bool("enable_xdecor_workbench") diff --git a/mods/ip_xdecor/init.lua b/mods/ip_xdecor/init.lua index 98867f0..98ddc1a 100644 --- a/mods/ip_xdecor/init.lua +++ b/mods/ip_xdecor/init.lua @@ -1,7 +1,7 @@ --local t = os.clock() xdecor = {} -local modpath = minetest.get_modpath("xdecor") +local modpath = minetest.get_modpath("ip_xdecor") dofile(modpath .. "/handlers/animations.lua") dofile(modpath .. "/handlers/helpers.lua") @@ -12,8 +12,6 @@ dofile(modpath .. "/src/nodes.lua") local subpart = { - "cooking", - "itemframe", "mailbox", "mechanisms", "rope", diff --git a/mods/ip_xdecor/mod.conf b/mods/ip_xdecor/mod.conf index 17a11a1..aef9e6f 100644 --- a/mods/ip_xdecor/mod.conf +++ b/mods/ip_xdecor/mod.conf @@ -1,4 +1,4 @@ -name = xdecor +name = ip_xdecor description = A decoration mod meant to be simple and well-featured. depends = doors, stairs, xpanes optional_depends = fire, oresplus, moreblocks, mesecons diff --git a/mods/ip_xdecor/src/cooking.lua b/mods/ip_xdecor/src/cooking.lua deleted file mode 100644 index 8abcb14..0000000 --- a/mods/ip_xdecor/src/cooking.lua +++ /dev/null @@ -1,267 +0,0 @@ -local cauldron, sounds = {}, {} -local S = minetest.get_translator("xdecor") - --- Add more ingredients here that make a soup. -local ingredients_list = { - "apple", "mushroom", "honey", "pumpkin", "egg", "bread", "meat", - "chicken", "carrot", "potato", "melon", "rhubarb", "cucumber", - "corn", "beans", "berries", "grapes", "tomato", "wheat" -} - -cauldron.cbox = { - {0, 0, 0, 16, 16, 0}, - {0, 0, 16, 16, 16, 0}, - {0, 0, 0, 0, 16, 16}, - {16, 0, 0, 0, 16, 16}, - {0, 0, 0, 16, 8, 16} -} - -function cauldron.stop_sound(pos) - local spos = minetest.hash_node_position(pos) - if sounds[spos] then - minetest.sound_stop(sounds[spos]) - end -end - -function cauldron.idle_construct(pos) - local timer = minetest.get_node_timer(pos) - timer:start(10.0) - cauldron.stop_sound(pos) -end - -function cauldron.boiling_construct(pos) - local spos = minetest.hash_node_position(pos) - sounds[spos] = minetest.sound_play("xdecor_boiling_water", { - pos = pos, - max_hear_distance = 5, - gain = 0.8, - loop = true - }) - - local meta = minetest.get_meta(pos) - meta:set_string("infotext", S("Cauldron (active) - Drop foods inside to make a soup")) - - local timer = minetest.get_node_timer(pos) - timer:start(5.0) -end - -function cauldron.filling(pos, node, clicker, itemstack) - local inv = clicker:get_inventory() - local wield_item = clicker:get_wielded_item():get_name() - - if wield_item:sub(1,7) == "bucket:" then - if wield_item:sub(-6) == "_empty" and not (node.name:sub(-6) == "_empty") then - if itemstack:get_count() > 1 then - if inv:room_for_item("main", "bucket:bucket_water 1") then - itemstack:take_item() - inv:add_item("main", "bucket:bucket_water 1") - else - minetest.chat_send_player(clicker:get_player_name(), - S("No room in your inventory to add a bucket of water.")) - return itemstack - end - else - itemstack:replace("bucket:bucket_water") - end - minetest.set_node(pos, {name = "xdecor:cauldron_empty", param2 = node.param2}) - - elseif wield_item:sub(-6) == "_water" and node.name:sub(-6) == "_empty" then - minetest.set_node(pos, {name = "xdecor:cauldron_idle", param2 = node.param2}) - itemstack:replace("bucket:bucket_empty") - end - - return itemstack - end -end - -function cauldron.idle_timer(pos) - local below_node = {x = pos.x, y = pos.y - 1, z = pos.z} - if not minetest.get_node(below_node).name:find("fire") then - return true - end - - local node = minetest.get_node(pos) - minetest.set_node(pos, {name = "xdecor:cauldron_boiling", param2 = node.param2}) - return true -end - --- Ugly hack to determine if an item has the function `minetest.item_eat` in its definition. -local function eatable(itemstring) - local item = itemstring:match("[%w_:]+") - local on_use_def = minetest.registered_items[item].on_use - if not on_use_def then return end - - return string.format("%q", string.dump(on_use_def)):find("item_eat") -end - -function cauldron.boiling_timer(pos) - local node = minetest.get_node(pos) - local objs = minetest.get_objects_inside_radius(pos, 0.5) - - if not next(objs) then - return true - end - - local ingredients = {} - for _, obj in pairs(objs) do - if obj and not obj:is_player() and obj:get_luaentity().itemstring then - local itemstring = obj:get_luaentity().itemstring - local food = itemstring:match(":([%w_]+)") - - for _, ingredient in ipairs(ingredients_list) do - if food and (eatable(itemstring) or food:find(ingredient)) then - ingredients[#ingredients + 1] = food - break - end - end - end - end - - if #ingredients >= 2 then - for _, obj in pairs(objs) do - obj:remove() - end - - minetest.set_node(pos, {name = "xdecor:cauldron_soup", param2 = node.param2}) - end - - local node_under = {x = pos.x, y = pos.y - 1, z = pos.z} - - if not minetest.get_node(node_under).name:find("fire") then - minetest.set_node(pos, {name = "xdecor:cauldron_idle", param2 = node.param2}) - end - - return true -end - -function cauldron.take_soup(pos, node, clicker, itemstack) - local inv = clicker:get_inventory() - local wield_item = clicker:get_wielded_item() - local item_name = wield_item:get_name() - - if item_name == "xdecor:bowl" or item_name == "farming:bowl" then - if wield_item:get_count() > 1 then - if inv:room_for_item("main", "xdecor:bowl_soup 1") then - itemstack:take_item() - inv:add_item("main", "xdecor:bowl_soup 1") - else - minetest.chat_send_player(clicker:get_player_name(), - S("No room in your inventory to add a bowl of soup.")) - return itemstack - end - else - itemstack:replace("xdecor:bowl_soup 1") - end - - minetest.set_node(pos, {name = "xdecor:cauldron_empty", param2 = node.param2}) - end - - return itemstack -end - -xdecor.register("cauldron_empty", { - description = S("Cauldron"), - groups = {cracky=2, oddly_breakable_by_hand=1}, - on_rotate = screwdriver.rotate_simple, - tiles = {"xdecor_cauldron_top_empty.png", "xdecor_cauldron_sides.png"}, - infotext = S("Cauldron (empty)"), - collision_box = xdecor.pixelbox(16, cauldron.cbox), - on_rightclick = cauldron.filling, - on_construct = function(pos) - cauldron.stop_sound(pos) - end, -}) - -xdecor.register("cauldron_idle", { - description = S("Cauldron (idle)"), - groups = {cracky=2, oddly_breakable_by_hand=1, not_in_creative_inventory=1}, - on_rotate = screwdriver.rotate_simple, - tiles = {"xdecor_cauldron_top_idle.png", "xdecor_cauldron_sides.png"}, - drop = "xdecor:cauldron_empty", - infotext = S("Cauldron (idle)"), - collision_box = xdecor.pixelbox(16, cauldron.cbox), - on_rightclick = cauldron.filling, - on_construct = cauldron.idle_construct, - on_timer = cauldron.idle_timer, -}) - -xdecor.register("cauldron_boiling", { - description = S("Cauldron (active)"), - groups = {cracky=2, oddly_breakable_by_hand=1, not_in_creative_inventory=1}, - on_rotate = screwdriver.rotate_simple, - drop = "xdecor:cauldron_empty", - infotext = S("Cauldron (active) - Drop foods inside to make a soup"), - damage_per_second = 2, - tiles = { - { - name = "xdecor_cauldron_top_anim_boiling_water.png", - animation = {type = "vertical_frames", length = 3.0} - }, - "xdecor_cauldron_sides.png" - }, - collision_box = xdecor.pixelbox(16, cauldron.cbox), - on_rightclick = cauldron.filling, - on_construct = cauldron.boiling_construct, - on_timer = cauldron.boiling_timer, - on_destruct = function(pos) - cauldron.stop_sound(pos) - end, -}) - -xdecor.register("cauldron_soup", { - description = S("Cauldron (active)"), - groups = {cracky = 2, oddly_breakable_by_hand = 1, not_in_creative_inventory = 1}, - on_rotate = screwdriver.rotate_simple, - drop = "xdecor:cauldron_empty", - infotext = S("Cauldron (active) - Use a bowl to eat the soup"), - damage_per_second = 2, - tiles = { - { - name = "xdecor_cauldron_top_anim_soup.png", - animation = {type = "vertical_frames", length = 3.0} - }, - "xdecor_cauldron_sides.png" - }, - collision_box = xdecor.pixelbox(16, cauldron.cbox), - on_rightclick = cauldron.take_soup, - on_destruct = function(pos) - cauldron.stop_sound(pos) - end, -}) - --- Craft items - -minetest.register_craftitem("xdecor:bowl", { - description = S("Bowl"), - inventory_image = "xdecor_bowl.png", - wield_image = "xdecor_bowl.png", - groups = {food_bowl = 1, flammable = 2}, -}) - -minetest.register_craftitem("xdecor:bowl_soup", { - description = S("Bowl of soup"), - inventory_image = "xdecor_bowl_soup.png", - wield_image = "xdecor_bowl_soup.png", - groups = {not_in_creative_inventory=1}, - stack_max = 1, - on_use = minetest.item_eat(30, "xdecor:bowl") -}) - --- Recipes - -minetest.register_craft({ - output = "xdecor:bowl 3", - recipe = { - {"group:wood", "", "group:wood"}, - {"", "group:wood", ""} - } -}) - -minetest.register_craft({ - output = "xdecor:cauldron_empty", - recipe = { - {"default:iron_lump", "", "default:iron_lump"}, - {"default:iron_lump", "", "default:iron_lump"}, - {"default:iron_lump", "default:iron_lump", "default:iron_lump"} - } -}) diff --git a/mods/ip_xdecor/src/enchanting.lua b/mods/ip_xdecor/src/enchanting.lua deleted file mode 100644 index fd07336..0000000 --- a/mods/ip_xdecor/src/enchanting.lua +++ /dev/null @@ -1,336 +0,0 @@ -screwdriver = screwdriver or {} -local S = minetest.get_translator("xdecor") -local FS = function(...) return minetest.formspec_escape(S(...)) end -local ceil, abs, random = math.ceil, math.abs, math.random -local reg_tools = minetest.registered_tools - --- Cost in Mese crystal(s) for enchanting. -local mese_cost = 1 - --- Force of the enchantments. -local enchanting = { - uses = 1.2, -- Durability - times = 0.1, -- Efficiency - damages = 1, -- Sharpness -} - -local function cap(str) return - str:gsub("^%l", string.upper) -end - -local function to_percent(orig_value, final_value) - return abs(ceil(((final_value - orig_value) / orig_value) * 100)) -end - -function enchanting:get_tooltip(enchant, orig_caps, fleshy) - local bonus = {durable = 0, efficiency = 0, damages = 0} - - if orig_caps then - bonus.durable = to_percent(orig_caps.uses, orig_caps.uses * enchanting.uses) - local sum_caps_times = 0 - for i=1, #orig_caps.times do - sum_caps_times = sum_caps_times + orig_caps.times[i] - end - local average_caps_time = sum_caps_times / #orig_caps.times - bonus.efficiency = to_percent(average_caps_time, average_caps_time - - enchanting.times) - end - - if fleshy then - bonus.damages = to_percent(fleshy, fleshy + enchanting.damages) - end - - local specs = { -- not finished, to complete - durable = {"#00baff", " (+" .. bonus.durable .. "%)"}, - fast = {"#74ff49", " (+" .. bonus.efficiency .. "%)"}, - sharp = {"#ffff00", " (+" .. bonus.damages .. "%)"}, - } - - local enchant_loc = { - fast = S("Efficiency"), - durable = S("Durability"), - sharp = S("Sharpness"), - } - - return minetest.colorize and minetest.colorize(specs[enchant][1], - "\n" .. enchant_loc[enchant] .. specs[enchant][2]) or - "\n" .. enchant_loc[enchant] .. specs[enchant][2] -end - -local enchant_buttons = { - "image_button[3.9,0.85;4,0.92;bg_btn.png;fast;"..FS("Efficiency").."]" .. - "image_button[3.9,1.77;4,1.12;bg_btn.png;durable;"..FS("Durability").."]", - "image_button[3.9,2.9;4,0.92;bg_btn.png;sharp;"..FS("Sharpness").."]", -} - -function enchanting.formspec(pos, num) - local meta = minetest.get_meta(pos) - local formspec = [[ - size[9,8.6;] - no_prepend[] - bgcolor[#080808BB;true] - listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF] - background9[0,0;9,9;ench_ui.png;6] - list[context;tool;0.9,2.9;1,1;] - list[context;mese;2,2.9;1,1;] - list[current_player;main;0.55,4.5;8,4;] - listring[current_player;main] - listring[context;tool] - listring[current_player;main] - listring[context;mese] - image[2,2.9;1,1;mese_layout.png] - ]] - .."tooltip[sharp;"..FS("Your weapon inflicts more damages").."]" - .."tooltip[durable;"..FS("Your tool last longer").."]" - .."tooltip[fast;"..FS("Your tool digs faster").."]" - ..default.gui_slots .. default.get_hotbar_bg(0.55, 4.5) - - formspec = formspec .. (enchant_buttons[num] or "") - meta:set_string("formspec", formspec) -end - -function enchanting.on_put(pos, listname, _, stack) - if listname == "tool" then - local stackname = stack:get_name() - local tool_groups = { - "axe, pick, shovel", - "sword", - } - - for idx, tools in ipairs(tool_groups) do - if tools:find(stackname:match(":(%w+)")) then - enchanting.formspec(pos, idx) - end - end - end -end - -function enchanting.fields(pos, _, fields, sender) - if not next(fields) or fields.quit then return end - local inv = minetest.get_meta(pos):get_inventory() - local tool = inv:get_stack("tool", 1) - local mese = inv:get_stack("mese", 1) - local orig_wear = tool:get_wear() - local mod, name = tool:get_name():match("(.*):(.*)") - local enchanted_tool = (mod or "") .. ":enchanted_" .. (name or "") .. "_" .. next(fields) - - if mese:get_count() >= mese_cost and reg_tools[enchanted_tool] then - minetest.sound_play("xdecor_enchanting", { - to_player = sender:get_player_name(), - gain = 0.8 - }) - - tool:replace(enchanted_tool) - tool:add_wear(orig_wear) - mese:take_item(mese_cost) - inv:set_stack("mese", 1, mese) - inv:set_stack("tool", 1, tool) - end -end - -function enchanting.dig(pos) - local inv = minetest.get_meta(pos):get_inventory() - return inv:is_empty("tool") and inv:is_empty("mese") -end - -local function allowed(tool) - if not tool then return end - - for item in pairs(reg_tools) do - if item:find("enchanted_" .. tool) then - return true - end - end -end - -function enchanting.put(_, listname, _, stack) - local stackname = stack:get_name() - if listname == "mese" and (stackname == "default:mese_crystal" or - stackname == "imese:industrial_mese_crystal") then - return stack:get_count() - elseif listname == "tool" and allowed(stackname:match("[^:]+$")) then - return 1 - end - - return 0 -end - -function enchanting.on_take(pos, listname) - if listname == "tool" then - enchanting.formspec(pos) - end -end - -function enchanting.construct(pos) - local meta = minetest.get_meta(pos) - meta:set_string("infotext", S("Enchantment Table")) - enchanting.formspec(pos) - - local inv = meta:get_inventory() - inv:set_size("tool", 1) - inv:set_size("mese", 1) - - minetest.add_entity({x = pos.x, y = pos.y + 0.85, z = pos.z}, "xdecor:book_open") - local timer = minetest.get_node_timer(pos) - timer:start(0.5) -end - -function enchanting.destruct(pos) - for _, obj in pairs(minetest.get_objects_inside_radius(pos, 0.9)) do - if obj and obj:get_luaentity() and - obj:get_luaentity().name == "xdecor:book_open" then - obj:remove() - break - end - end -end - -function enchanting.timer(pos) - local minp = {x = pos.x - 2, y = pos.y, z = pos.z - 2} - local maxp = {x = pos.x + 2, y = pos.y + 1, z = pos.z + 2} - - local bookshelves = minetest.find_nodes_in_area(minp, maxp, "default:bookshelf") - if #bookshelves == 0 then - return true - end - - local bookshelf_pos = bookshelves[random(1, #bookshelves)] - local x = pos.x - bookshelf_pos.x - local y = bookshelf_pos.y - pos.y - local z = pos.z - bookshelf_pos.z - - if tostring(x .. z):find(2) then - minetest.add_particle({ - pos = bookshelf_pos, - velocity = {x = x, y = 2 - y, z = z}, - acceleration = {x = 0, y = -2.2, z = 0}, - expirationtime = 1, - size = 1.5, - glow = 5, - texture = "xdecor_glyph" .. random(1,18) .. ".png" - }) - end - - return true -end - -xdecor.register("enchantment_table", { - description = S("Enchantment Table"), - tiles = { - "xdecor_enchantment_top.png", "xdecor_enchantment_bottom.png", - "xdecor_enchantment_side.png", "xdecor_enchantment_side.png", - "xdecor_enchantment_side.png", "xdecor_enchantment_side.png" - }, - groups = {cracky = 1, level = 1}, - light_source = 6, - sounds = default.node_sound_stone_defaults(), - on_rotate = screwdriver.rotate_simple, - can_dig = enchanting.dig, - on_timer = enchanting.timer, - on_construct = enchanting.construct, - on_destruct = enchanting.destruct, - on_receive_fields = enchanting.fields, - on_metadata_inventory_put = enchanting.on_put, - on_metadata_inventory_take = enchanting.on_take, - allow_metadata_inventory_put = enchanting.put, - allow_metadata_inventory_move = function() - return 0 - end, -}) - -minetest.register_entity("xdecor:book_open", { - visual = "sprite", - visual_size = {x=0.75, y=0.75}, - collisionbox = {0}, - physical = false, - textures = {"xdecor_book_open.png"}, - static_save = false, -}) - -minetest.register_lbm({ - label = "recreate book entity", - name = "xdecor:create_book_entity", - nodenames = {"xdecor:enchantment_table"}, - run_at_every_load = true, - action = function(pos, node) - local objs = minetest.get_objects_inside_radius(pos, 0.9) - - for _, obj in ipairs(objs) do - local e = obj:get_luaentity() - if e and e.name == "xdecor:book_open" then - return - end - end - - minetest.add_entity({x = pos.x, y = pos.y + 0.85, z = pos.z}, "xdecor:book_open") - end, -}) - -function enchanting:register_tools(mod, def) - for tool in pairs(def.tools) do - for material in def.materials:gmatch("[%w_]+") do - for enchant in def.tools[tool].enchants:gmatch("[%w_]+") do - local original_tool = reg_tools[mod .. ":" .. tool .. "_" .. material] - if not original_tool then break end - local original_toolcaps = original_tool.tool_capabilities - - if original_toolcaps then - local original_damage_groups = original_toolcaps.damage_groups - local original_groupcaps = original_toolcaps.groupcaps - local groupcaps = table.copy(original_groupcaps) - local fleshy = original_damage_groups.fleshy - local full_punch_interval = original_toolcaps.full_punch_interval - local max_drop_level = original_toolcaps.max_drop_level - local group = next(original_groupcaps) - - if enchant == "durable" then - groupcaps[group].uses = ceil(original_groupcaps[group].uses * - enchanting.uses) - elseif enchant == "fast" then - for i, time in pairs(original_groupcaps[group].times) do - groupcaps[group].times[i] = time - enchanting.times - end - elseif enchant == "sharp" then - fleshy = fleshy + enchanting.damages - end - - minetest.register_tool(":" .. mod .. ":enchanted_" .. tool .. "_" .. material .. "_" .. enchant, { - description = S("Enchanted @1 @2 @3", - def.material_desc[material] or cap(material), def.tools[tool].desc or cap(tool), - self:get_tooltip(enchant, original_groupcaps[group], fleshy)), - inventory_image = original_tool.inventory_image .. "^[colorize:violet:50", - wield_image = original_tool.wield_image, - groups = {not_in_creative_inventory = 1}, - tool_capabilities = { - groupcaps = groupcaps, damage_groups = {fleshy = fleshy}, - full_punch_interval = full_punch_interval, - max_drop_level = max_drop_level - } - }) - end - end - end - end -end - -enchanting:register_tools("default", { - materials = "steel, bronze, mese, diamond", - material_desc = {steel = S("Steel"), bronze = S("Bronze"), mese = S("Mese"), diamond = S("Diamond")}, - tools = { - axe = {enchants = "durable, fast", desc = S("Axe")}, - pick = {enchants = "durable, fast", desc = S("Pickaxe")}, - shovel = {enchants = "durable, fast", desc = S("Shovel")}, - sword = {enchants = "sharp", desc = S("Sword")} - }, -}) - --- Recipes - -minetest.register_craft({ - output = "xdecor:enchantment_table", - recipe = { - {"", "default:book", ""}, - {"default:diamond", "default:obsidian", "default:diamond"}, - {"default:obsidian", "default:obsidian", "default:obsidian"} - } -}) diff --git a/mods/ip_xdecor/src/hive.lua b/mods/ip_xdecor/src/hive.lua deleted file mode 100644 index 2aa9910..0000000 --- a/mods/ip_xdecor/src/hive.lua +++ /dev/null @@ -1,108 +0,0 @@ -local hive = {} -local S = minetest.get_translator("xdecor") -local FS = function(...) return minetest.formspec_escape(S(...)) end -local honey_max = 16 - -function hive.construct(pos) - local meta = minetest.get_meta(pos) - local inv = meta:get_inventory() - - local formspec = "size[8,6;]" - .."label[0.5,0;"..FS("Bees are busy making honey…").."]" - ..[[ image[6,1;1,1;hive_bee.png] - image[5,1;1,1;hive_layout.png] - list[context;honey;5,1;1,1;] - list[current_player;main;0,2.35;8,4;] - listring[current_player;main] - listring[context;honey] ]] .. - xbg .. default.get_hotbar_bg(0,2.35) - - meta:set_string("formspec", formspec) - meta:set_string("infotext", S("Artificial Hive")) - inv:set_size("honey", 1) - - local timer = minetest.get_node_timer(pos) - timer:start(math.random(64, 128)) -end - -function hive.timer(pos) - local time = (minetest.get_timeofday() or 0) * 24000 - if time < 5500 or time > 18500 then - return true - end - - local inv = minetest.get_meta(pos):get_inventory() - local honeystack = inv:get_stack("honey", 1) - local honey = honeystack:get_count() - - local radius = 4 - local minp = vector.add(pos, -radius) - local maxp = vector.add(pos, radius) - local flowers = minetest.find_nodes_in_area_under_air(minp, maxp, "group:flower") - - if #flowers > 2 and honey < honey_max then - inv:add_item("honey", "xdecor:honey") - elseif honey == honey_max then - local timer = minetest.get_node_timer(pos) - timer:stop() - return true - end - - return true -end - -xdecor.register("hive", { - description = S("Artificial Hive"), - tiles = {"xdecor_hive_top.png", "xdecor_hive_top.png", - "xdecor_hive_side.png", "xdecor_hive_side.png", - "xdecor_hive_side.png", "xdecor_hive_front.png"}, - groups = {choppy=3, oddly_breakable_by_hand=2, flammable=1}, - on_construct = hive.construct, - on_timer = hive.timer, - - can_dig = function(pos) - local inv = minetest.get_meta(pos):get_inventory() - return inv:is_empty("honey") - end, - - on_punch = function(_, _, puncher) - puncher:set_hp(puncher:get_hp() - 2) - end, - - allow_metadata_inventory_put = function() - return 0 - end, - - on_metadata_inventory_take = function(pos, _, _, stack) - if stack:get_count() == honey_max then - local timer = minetest.get_node_timer(pos) - timer:start(math.random(64, 128)) - end - end -}) - --- Craft items - -minetest.register_craftitem("xdecor:honey", { - description = S("Honey"), - inventory_image = "xdecor_honey.png", - wield_image = "xdecor_honey.png", - on_use = minetest.item_eat(2), - groups = { - food_honey = 1, - food_sugar = 1, - flammable = 2, - not_in_creative_inventory = 1, - }, -}) - --- Recipes - -minetest.register_craft({ - output = "xdecor:hive", - recipe = { - {"group:stick", "group:stick", "group:stick"}, - {"default:paper", "default:paper", "default:paper"}, - {"group:stick", "group:stick", "group:stick"} - } -}) diff --git a/mods/ip_xdecor/src/itemframe.lua b/mods/ip_xdecor/src/itemframe.lua deleted file mode 100644 index 38dcc0a..0000000 --- a/mods/ip_xdecor/src/itemframe.lua +++ /dev/null @@ -1,186 +0,0 @@ -local itemframe, tmp = {}, {} -local S = minetest.get_translator("xdecor") -screwdriver = screwdriver or {} - -local function remove_item(pos, node) - local objs = minetest.get_objects_inside_radius(pos, 0.5) - if not objs then return end - - for _, obj in pairs(objs) do - local ent = obj:get_luaentity() - if obj and ent and ent.name == "xdecor:f_item" then - obj:remove() break - end - end -end - -local facedir = { - [0] = {x = 0, y = 0, z = 1}, - {x = 1, y = 0, z = 0}, - {x = 0, y = 0, z = -1}, - {x = -1, y = 0, z = 0} -} - -local function update_item(pos, node) - remove_item(pos, node) - local meta = minetest.get_meta(pos) - local itemstring = meta:get_string("item") - local posad = facedir[node.param2] - if not posad or itemstring == "" then return end - - pos = vector.add(pos, vector.multiply(posad, 6.5/16)) - tmp.nodename = node.name - tmp.texture = ItemStack(itemstring):get_name() - - local entity = minetest.add_entity(pos, "xdecor:f_item") - local yaw = (math.pi * 2) - node.param2 * (math.pi / 2) - entity:set_yaw(yaw) - - local timer = minetest.get_node_timer(pos) - timer:start(15.0) -end - -local function drop_item(pos, node) - local meta = minetest.get_meta(pos) - local item = meta:get_string("item") - if item == "" then return end - - minetest.add_item(pos, item) - meta:set_string("item", "") - remove_item(pos, node) - - local timer = minetest.get_node_timer(pos) - timer:stop() -end - -function itemframe.after_place(pos, placer, itemstack) - local meta = minetest.get_meta(pos) - local name = placer:get_player_name() - meta:set_string("owner", name) - meta:set_string("infotext", S("@1 (owned by @2)", S("Item Frame"), name)) -end - -function itemframe.timer(pos) - local node = minetest.get_node(pos) - local meta = minetest.get_meta(pos) - local num = #minetest.get_objects_inside_radius(pos, 0.5) - - if num == 0 and meta:get_string("item") ~= "" then - update_item(pos, node) - end - - return true -end - -function itemframe.rightclick(pos, node, clicker, itemstack) - local meta = minetest.get_meta(pos) - local player_name = clicker:get_player_name() - local owner = meta:get_string("owner") - local admin = minetest.check_player_privs(player_name, "protection_bypass") - - if not admin and (player_name ~= owner or not itemstack) then - return itemstack - end - - drop_item(pos, node) - local itemstring = itemstack:take_item():to_string() - meta:set_string("item", itemstring) - update_item(pos, node) - if itemstring == "" then - meta:set_string("infotext", S("@1 (owned by @2)", S("Item Frame"), owner)) - else - meta:set_string("infotext", S("@1 (owned by @2)", itemstring, owner)) - end - return itemstack -end - -function itemframe.punch(pos, node, puncher) - local meta = minetest.get_meta(pos) - local player_name = puncher:get_player_name() - local owner = meta:get_string("owner") - local admin = minetest.check_player_privs(player_name, "protection_bypass") - - if admin and player_name == owner then - drop_item(pos, node) - end -end - -function itemframe.dig(pos, player) - if not player then return end - local meta = minetest.get_meta(pos) - local player_name = player and player:get_player_name() - local owner = meta:get_string("owner") - local admin = minetest.check_player_privs(player_name, "protection_bypass") - - return admin or player_name == owner -end - -xdecor.register("itemframe", { - description = S("Item Frame"), - groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3}, - sounds = default.node_sound_wood_defaults(), - on_rotate = screwdriver.disallow, - sunlight_propagates = true, - inventory_image = "xdecor_itemframe.png", - node_box = xdecor.nodebox.slab_z(0.9375), - tiles = { - "xdecor_wood.png", "xdecor_wood.png", "xdecor_wood.png", - "xdecor_wood.png", "xdecor_wood.png", "xdecor_itemframe.png" - }, - after_place_node = itemframe.after_place, - on_timer = itemframe.timer, - on_rightclick = itemframe.rightclick, - on_punch = itemframe.punch, - can_dig = itemframe.dig, - after_destruct = remove_item -}) - -minetest.register_entity("xdecor:f_item", { - visual = "wielditem", - visual_size = {x = 0.33, y = 0.33}, - collisionbox = {0}, - physical = false, - textures = {"air"}, - on_activate = function(self, staticdata) - local pos = self.object:get_pos() - if minetest.get_node(pos).name ~= "xdecor:itemframe" then - self.object:remove() - end - - if tmp.nodename and tmp.texture then - self.nodename = tmp.nodename - tmp.nodename = nil - self.texture = tmp.texture - tmp.texture = nil - elseif staticdata and staticdata ~= "" then - local data = staticdata:split(";") - if data and data[1] and data[2] then - self.nodename = data[1] - self.texture = data[2] - end - end - if self.texture then - self.object:set_properties({ - textures = {self.texture} - }) - end - end, - get_staticdata = function(self) - if self.nodename and self.texture then - return self.nodename .. ";" .. self.texture - end - - return "" - end -}) - --- Recipes - -minetest.register_craft({ - output = "xdecor:itemframe", - recipe = { - {"group:stick", "group:stick", "group:stick"}, - {"group:stick", "default:paper", "group:stick"}, - {"group:stick", "group:stick", "group:stick"} - } -}) diff --git a/mods/ip_xdecor/src/nodes.lua b/mods/ip_xdecor/src/nodes.lua index f4d9308..8d9a92d 100644 --- a/mods/ip_xdecor/src/nodes.lua +++ b/mods/ip_xdecor/src/nodes.lua @@ -705,7 +705,7 @@ xdecor.register("woodframed_glass", { sounds = default.node_sound_glass_defaults() }) -minetest.register_node("xdecor:toilet", { +minetest.register_node(":xdecor:toilet", { description = "Toilet", tiles = { "soviet_machine.png",