diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index bdb0cab..0000000 --- a/.gitattributes +++ /dev/null @@ -1,17 +0,0 @@ -# Auto detect text files and perform LF normalization -* text=auto - -# Custom for Visual Studio -*.cs diff=csharp - -# Standard to msysgit -*.doc diff=astextplain -*.DOC diff=astextplain -*.docx diff=astextplain -*.DOCX diff=astextplain -*.dot diff=astextplain -*.DOT diff=astextplain -*.pdf diff=astextplain -*.PDF diff=astextplain -*.rtf diff=astextplain -*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore deleted file mode 100644 index cd2946a..0000000 --- a/.gitignore +++ /dev/null @@ -1,47 +0,0 @@ -# Windows image file caches -Thumbs.db -ehthumbs.db - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msm -*.msp - -# Windows shortcuts -*.lnk - -# ========================= -# Operating System Files -# ========================= - -# OSX -# ========================= - -.DS_Store -.AppleDouble -.LSOverride - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk diff --git a/init.lua b/init.lua index a2fdab7..30b7d3a 100644 --- a/init.lua +++ b/init.lua @@ -1,26 +1,40 @@ +-- internationalization boilerplate local S = minetest.get_translator("pontoons") +local default_modpath = core.get_modpath("default") and default +local mineclone_path = core.get_modpath("mcl_core") and mcl_core --- MCL2 compatibility +-- compatibility layer local moditems = {} -if core.get_modpath("mcl_core") and mcl_core then -- means MineClone 2 is loaded, this is its core mod - moditems.IRON_ITEM = "mcl_core:iron_ingot" -- MCL iron -else -- fallback, assume default (MineTest Game) is loaded, otherwise it will error anyway here. - moditems.IRON_ITEM = "default:steel_ingot" -- MCL iron +if mineclone_path then -- means MineClone 2 is loaded, this is its core mod + moditems.iron_item = "mcl_core:iron_ingot" -- MCL iron + moditems.sounds_wood = mcl_sounds.node_sound_wood_defaults + moditems.sounds_metal = mcl_sounds.node_sound_metal_defaults + moditems.wood_block_group = {pickaxey=1,axey=1,swordy=1,handy=1,flammable=1,destroy_by_lava_flow=1,dig_by_water=0 } + moditems.metal_block_group = {pickaxey=1,axey=1,swordy=1,handy=1,flammable=0,destroy_by_lava_flow=0,dig_by_water=0 } + +elseif default_modpath then -- fallback, assume default (MineTest Game) is loaded, otherwise it will error anyway here. + moditems.iron_item = "default:steel_ingot" -- default iron + moditems.sounds_wood = default.node_sound_wood_defaults + moditems.sounds_metal = default.node_sound_metal_defaults + moditems.wood_block_group = { choppy=2, oddly_breakable_by_hand=2, flammable=2, wood=1} + moditems.metal_block_group = { cracky=1, level= 2} end +-- load settings from minetest local pontoons_override_logs = minetest.settings:get_bool("pontoons_override_logs") -- default false +if pontoons_override_logs == nil then pontoons_override_logs = false end local pontoons_override_wood = minetest.settings:get_bool("pontoons_override_wood") -- default false +if pontoons_override_wood == nil then pontoons_override_wood = false end -local pontoons_wood_pontoons = minetest.settings:get_bool("pontoons_wood_pontoons") -if pontoons_wood_pontoons == nil then pontoons_wood_pontoons = true end -- default true +local pontoons_wood_pontoons = minetest.settings:get_bool("pontoons_wood_pontoons") -- default true +if pontoons_wood_pontoons == nil then pontoons_wood_pontoons = true end -local pontoons_steel_pontoons = minetest.settings:get_bool("pontoons_steel_pontoons") -if pontoons_steel_pontoons == nil then pontoons_steel_pontoons = true end -- default true +local pontoons_steel_pontoons = minetest.settings:get_bool("pontoons_steel_pontoons") -- default true +if pontoons_steel_pontoons == nil then pontoons_steel_pontoons = true end -local default_modpath = minetest.get_modpath("default") if pontoons_override_logs or pontoons_override_wood then local override_def = {liquids_pointable = true} @@ -36,16 +50,8 @@ if pontoons_override_logs or pontoons_override_wood then end if pontoons_wood_pontoons then - local default_sound - local wood_burn_time - if default_modpath then - if mcl_sounds then - default_sound = mcl_sounds.node_sound_wood_defaults() - else - default_sound = default.node_sound_wood_defaults() - end - wood_burn_time = minetest.get_craft_result({method="fuel", width=1, items={ItemStack("group:wood")}}).time - end + local wood_burn_time = minetest.get_craft_result({method="fuel", width=1, items={ItemStack("group:wood")}}).time + if not wood_burn_time then wood_burn_time = 7 end minetest.register_node("pontoons:wood_pontoon", { @@ -56,8 +62,10 @@ if pontoons_wood_pontoons then place_param2 = 0, is_ground_content = false, liquids_pointable = true, - groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1}, - sounds = default_sound, + groups = moditems.wood_block_group, + sounds = moditems.sounds_wood(), + _mcl_blast_resistance = 5, + _mcl_hardness = 30, }) -- modify recipe, if "airtank" mod is loaded as it has similar recipe and conflicts with pontoons. @@ -91,49 +99,38 @@ end end if pontoons_steel_pontoons then - local default_sound - if default_modpath then - if mcl_sounds then - default_sound = mcl_sounds.node_sound_metal_defaults() - else - if default.node_sound_metal_defaults then - default_sound = default.node_sound_metal_defaults() - else - default_sound = default.node_sound_wood_defaults() - end - end - end - + minetest.register_node("pontoons:steel_pontoon", { description = S("Steel Pontoon"), _doc_items_longdesc = S("A hollow steel block designed to be built on the surface of liquids. Magma-safe."), is_ground_content = false, tiles = {"pontoon_steel.png"}, liquids_pointable = true, - is_ground_content = false, - groups = {cracky = 1, level = 2}, - sounds = default_sound, + groups = moditems.metal_block_group, + sounds = moditems.sounds_metal(), + _mcl_blast_resistance = 30, + _mcl_hardness = 5, }) - if default_modpath then - if core.get_modpath("airtanks") and airtanks then - minetest.register_craft({ - output = 'pontoons:steel_pontoon', - recipe = { - {"",moditems.IRON_ITEM,""}, - {moditems.IRON_ITEM,"",moditems.IRON_ITEM}, - {"","",moditems.IRON_ITEM}, - } - }) - else - minetest.register_craft({ - output = 'pontoons:steel_pontoon', - recipe = { - {"",moditems.IRON_ITEM,""}, - {moditems.IRON_ITEM,"",moditems.IRON_ITEM}, - {"",moditems.IRON_ITEM,""}, - } - }) - end + + if core.get_modpath("airtanks") and airtanks then + minetest.register_craft({ + output = 'pontoons:steel_pontoon', + recipe = { + {"",moditems.iron_item,""}, + {moditems.iron_item,"",moditems.iron_item}, + {"","",moditems.iron_item}, + } + }) + else + minetest.register_craft({ + output = 'pontoons:steel_pontoon', + recipe = { + {"",moditems.iron_item,""}, + {moditems.iron_item,"",moditems.iron_item}, + {"",moditems.iron_item,""}, + } + }) end + end