This commit is contained in:
minertestdude 2020-04-11 11:30:53 +02:00 committed by GitHub
commit 62464a7f27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 55 additions and 122 deletions

17
.gitattributes vendored
View file

@ -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

47
.gitignore vendored
View file

@ -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

113
init.lua
View file

@ -1,26 +1,40 @@
-- internationalization boilerplate
local S = minetest.get_translator("pontoons") 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 = {} local moditems = {}
if core.get_modpath("mcl_core") and mcl_core then -- means MineClone 2 is loaded, this is its core mod if mineclone_path then -- means MineClone 2 is loaded, this is its core mod
moditems.IRON_ITEM = "mcl_core:iron_ingot" -- MCL iron moditems.iron_item = "mcl_core:iron_ingot" -- MCL iron
else -- fallback, assume default (MineTest Game) is loaded, otherwise it will error anyway here. moditems.sounds_wood = mcl_sounds.node_sound_wood_defaults
moditems.IRON_ITEM = "default:steel_ingot" -- MCL iron 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 end
-- load settings from minetest
local pontoons_override_logs = minetest.settings:get_bool("pontoons_override_logs") -- default false 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 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") local pontoons_wood_pontoons = minetest.settings:get_bool("pontoons_wood_pontoons") -- default true
if pontoons_wood_pontoons == nil then pontoons_wood_pontoons = true end -- default true if pontoons_wood_pontoons == nil then pontoons_wood_pontoons = true end
local pontoons_steel_pontoons = minetest.settings:get_bool("pontoons_steel_pontoons") local pontoons_steel_pontoons = minetest.settings:get_bool("pontoons_steel_pontoons") -- default true
if pontoons_steel_pontoons == nil then pontoons_steel_pontoons = true end -- 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 if pontoons_override_logs or pontoons_override_wood then
local override_def = {liquids_pointable = true} local override_def = {liquids_pointable = true}
@ -36,16 +50,8 @@ if pontoons_override_logs or pontoons_override_wood then
end end
if pontoons_wood_pontoons then if pontoons_wood_pontoons then
local default_sound local wood_burn_time = minetest.get_craft_result({method="fuel", width=1, items={ItemStack("group:wood")}}).time
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
if not wood_burn_time then wood_burn_time = 7 end if not wood_burn_time then wood_burn_time = 7 end
minetest.register_node("pontoons:wood_pontoon", { minetest.register_node("pontoons:wood_pontoon", {
@ -56,8 +62,10 @@ if pontoons_wood_pontoons then
place_param2 = 0, place_param2 = 0,
is_ground_content = false, is_ground_content = false,
liquids_pointable = true, liquids_pointable = true,
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1}, groups = moditems.wood_block_group,
sounds = default_sound, 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. -- modify recipe, if "airtank" mod is loaded as it has similar recipe and conflicts with pontoons.
@ -91,49 +99,38 @@ end
end end
if pontoons_steel_pontoons then 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", { minetest.register_node("pontoons:steel_pontoon", {
description = S("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."), _doc_items_longdesc = S("A hollow steel block designed to be built on the surface of liquids. Magma-safe."),
is_ground_content = false, is_ground_content = false,
tiles = {"pontoon_steel.png"}, tiles = {"pontoon_steel.png"},
liquids_pointable = true, liquids_pointable = true,
is_ground_content = false, groups = moditems.metal_block_group,
groups = {cracky = 1, level = 2}, sounds = moditems.sounds_metal(),
sounds = default_sound, _mcl_blast_resistance = 30,
_mcl_hardness = 5,
}) })
if default_modpath then
if core.get_modpath("airtanks") and airtanks then if core.get_modpath("airtanks") and airtanks then
minetest.register_craft({ minetest.register_craft({
output = 'pontoons:steel_pontoon', output = 'pontoons:steel_pontoon',
recipe = { recipe = {
{"",moditems.IRON_ITEM,""}, {"",moditems.iron_item,""},
{moditems.IRON_ITEM,"",moditems.IRON_ITEM}, {moditems.iron_item,"",moditems.iron_item},
{"","",moditems.IRON_ITEM}, {"","",moditems.iron_item},
} }
}) })
else else
minetest.register_craft({ minetest.register_craft({
output = 'pontoons:steel_pontoon', output = 'pontoons:steel_pontoon',
recipe = { recipe = {
{"",moditems.IRON_ITEM,""}, {"",moditems.iron_item,""},
{moditems.IRON_ITEM,"",moditems.IRON_ITEM}, {moditems.iron_item,"",moditems.iron_item},
{"",moditems.IRON_ITEM,""}, {"",moditems.iron_item,""},
} }
}) })
end
end end
end end