MineClone2 support for Elevator mod and few improvements (#13)

* deprecating outdated file

* Add files via upload

* Mineclone2 compatibility, externalization of few settings, inability to break by hand

- integrated full Mineclone2 game compatibility layer
- externalized elevator settings (easier upgrades for server owners)
- turn off the ability to destroy shafts by hand, as this could lead to accidents

* Add mineclone textures

These textures are MIT licensed and motor texture is done by me, likewise MIT. License added.

* Add license about mineclone2 variant of textures

* Update readme with support information about Mineclone2.

* This should finally nail the correct groups for mineclone2. Sorry.
master
minertestdude 2020-04-11 15:02:05 +02:00 committed by GitHub
parent d4bc5f0288
commit db4eca8b73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 136 additions and 61 deletions

View File

@ -13,3 +13,13 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
----
Elevator motor and elevator textures for MCL2 are based on "default_glass.png",
included with MCL2 game, original copyright:
"MIT License.
The textures are taken from the Minecraft resource pack “Faithful 1.11” by
Vattic and xMrVizzy and contributers."
Elevator motor design is (c) minertestdude, redistributed under MIT license.

View File

@ -1,7 +1,7 @@
# Realtime Elevators for Minetest
## Dependencies
This mod has no dependencies other than default, but has recipes designed for use with technic and either homedecor/chains (for chains) or farming redo (for rope) and will detect if those are installed.
This mod has no dependencies other than default, but has recipes designed for use with technic and either homedecor/chains (for chains) or farming redo (for rope) and will detect if those are installed. This mod supports MineClone 2 game.
## Usage
Each shaft begins with a motor, and extends down through shaft and elevator nodes. Each elevator node can be used to travel to any other elevator node below the motor and through an unbroken shaft. Only one player can use each shaft at once.

View File

@ -3,6 +3,10 @@ local phash = elevator.phash
local get_node = elevator.get_node
local homedecor_path = minetest.get_modpath("homedecor")
local mineclone_path = core.get_modpath("mcl_core") and mcl_core
local default_path = core.get_modpath("default") and default
local moditems = {} -- local table to hold substitutes
-- Use homedecor's placeholder if possible.
if homedecor_path then
@ -33,15 +37,36 @@ else
})
end
if mineclone_path then
moditems.el_shaft_groups = {pickaxey=1,axey=1,handy=1,swordy=1,transport=1,dig_by_piston=1}
moditems.el_motor_groups = {pickaxey=1,axey=1,handy=1,swordy=1,transport=1,dig_by_piston=1}
moditems.elevator_groups = {pickaxey=1,axey=1,handy=1,swordy=1,transport=1,dig_by_piston=1}
moditems.elevator_special_groups = {not_in_creative_inventory=1,pickaxey=1,axey=1,handy=1,swordy=1,transport=1,dig_by_piston=1}
moditems.sounds_stone = mcl_sounds.node_sound_stone_defaults
moditems.el_motor_gfx = "elevator_motor_mcl.png"
moditems.el_shaft_gfx = "elevator_shaft_mcl.png"
moditems.el_box_gfx = "elevator_box_mcl.png"
elseif default_path then
moditems.el_shaft_groups = {cracky=2,oddly_breakable_by_hand=0} -- removing ability to destroy by hand to prevent accidental breakage of whole elevators
moditems.el_motor_groups = {cracky=1}
moditems.elevator_groups = {cracky=1,choppy=1,snappy=1}
moditems.elevator_special_groups = {not_in_creative_inventory=1}
moditems.sounds_stone = default.node_sound_stone_defaults
moditems.el_motor_gfx = "elevator_motor.png"
moditems.el_shaft_gfx = "elevator_shaft.png"
moditems.el_box_gfx = "elevator_box.png"
end
minetest.register_node("elevator:shaft", {
description = "Elevator Shaft",
tiles = { "elevator_shaft.png" },
tiles = { moditems.el_shaft_gfx },
drawtype = "nodebox",
paramtype = "light",
on_rotate = screwdriver.disallow,
sunlight_propagates = true,
groups = {cracky=2, oddly_breakable_by_hand=1},
sounds = default.node_sound_stone_defaults(),
groups = moditems.el_shaft_groups,
sounds = moditems.sounds_stone(),
node_box = {
type = "fixed",
fixed = {
@ -68,6 +93,40 @@ minetest.register_node("elevator:shaft", {
-- Remove boxes and deactivate elevators below us.
elevator.unbuild(pos, 1)
end,
_mcl_blast_resistance = 15, -- mineclone2 specific
_mcl_hardness = 5, -- mineclone2 specific
})
minetest.register_node("elevator:motor", {
description = "Elevator Motor",
tiles = {
"default_steel_block.png",
"default_steel_block.png",
moditems.el_motor_gfx,
moditems.el_motor_gfx,
moditems.el_motor_gfx,
moditems.el_motor_gfx,
},
groups = moditems.el_motor_groups,
sounds = moditems.sounds_stone(),
after_place_node = function(pos, placer, itemstack)
-- Set up the motor table.
elevator.motors[phash(pos)] = {
elevators = {},
pnames = {},
labels = {},
}
elevator.save_elevator()
elevator.build_motor(phash(pos))
end,
on_destruct = function(pos)
-- Destroy everything related to this motor.
elevator.boxes[phash(pos)] = nil
elevator.motors[phash(pos)] = nil
elevator.save_elevator()
end,
_mcl_blast_resistance = 15, -- mineclone2 specific
_mcl_hardness = 5, -- mineclone2 specific
})
local box = {
@ -105,44 +164,16 @@ minetest.register_node("elevator:elevator_box", {
tiles = {
"default_steel_block.png",
"default_steel_block.png",
"elevator_box.png",
"elevator_box.png",
"elevator_box.png",
"elevator_box.png",
moditems.el_box_gfx,
moditems.el_box_gfx,
moditems.el_box_gfx,
moditems.el_box_gfx,
},
groups = {not_in_creative_inventory = 1},
groups = moditems.elevator_special_groups,
light_source = 4,
})
minetest.register_node("elevator:motor", {
description = "Elevator Motor",
tiles = {
"default_steel_block.png",
"default_steel_block.png",
"elevator_motor.png",
"elevator_motor.png",
"elevator_motor.png",
"elevator_motor.png",
},
groups = {cracky=1},
sounds = default.node_sound_stone_defaults(),
after_place_node = function(pos, placer, itemstack)
-- Set up the motor table.
elevator.motors[phash(pos)] = {
elevators = {},
pnames = {},
labels = {},
}
elevator.save_elevator()
elevator.build_motor(phash(pos))
end,
on_destruct = function(pos)
-- Destroy everything related to this motor.
elevator.boxes[phash(pos)] = nil
elevator.motors[phash(pos)] = nil
elevator.save_elevator()
end,
_mcl_blast_resistance = 15, -- mineclone2 specific
_mcl_hardness = 5, -- mineclone2 specific
})
for _,mode in ipairs({"on", "off"}) do
@ -201,19 +232,19 @@ for _,mode in ipairs({"on", "off"}) do
tiles = on and {
"default_steel_block.png",
"default_steel_block.png",
"elevator_box.png",
"elevator_box.png",
"elevator_box.png",
"elevator_box.png",
moditems.el_box_gfx,
moditems.el_box_gfx,
moditems.el_box_gfx,
moditems.el_box_gfx,
} or {
"elevator_box.png",
"elevator_box.png",
"elevator_box.png",
"elevator_box.png",
"elevator_box.png",
"elevator_box.png",
moditems.el_box_gfx,
moditems.el_box_gfx,
moditems.el_box_gfx,
moditems.el_box_gfx,
moditems.el_box_gfx,
moditems.el_box_gfx,
},
groups = {cracky=1, choppy=1, snappy=1},
groups = moditems.elevator_groups,
drop = "elevator:elevator_off",
-- Emit a bit of light when active.
@ -327,6 +358,9 @@ for _,mode in ipairs({"on", "off"}) do
minetest.remove_node(p)
end
end,
_mcl_blast_resistance = 15, -- mineclone2 specific
_mcl_hardness = 5, -- mineclone2 specific
})
end

View File

@ -1,8 +1,36 @@
-- Detect optional mods.
local technic_path = minetest.get_modpath("technic")
local chains_path = minetest.get_modpath("chains")
local mineclone_path = core.get_modpath("mcl_core") and mcl_core
if technic_path and chains_path then
if mineclone_path then
minetest.register_craft({
output = "elevator:elevator",
recipe = {
{"mcl_core:iron_ingot", "mcl_core:paper", "mcl_core:iron_ingot"},
{"mcl_core:iron_ingot", "mcl_core:gold_ingot", "mcl_core:iron_ingot"},
{"mcl_core:clay_lump", "group:glass", "mcl_core:clay_lump"},
},
})
minetest.register_craft({
output = "elevator:shaft",
recipe = {
{"mcl_core:iron_ingot", "group:wood"},
{"group:wood", "mcl_core:iron_ingot"},
},
})
minetest.register_craft({
output = "elevator:motor",
recipe = {
{"mcl_core:gold_ingot", "mcl_core:iron_ingot", "mcl_core:gold_ingot"},
{"mcl_core:ironblock", "mcl_furnaces:furnace", "mcl_core:ironblock"},
{"mcl_core:paper", "mcl_core:gold_ingot", "mcl_core:paper"}
},
})
elseif technic_path and chains_path then
minetest.register_craft({
output = "elevator:elevator",
recipe = {

View File

@ -1,5 +0,0 @@
default
technic?
homedecor?
chains?
farming?

View File

@ -5,11 +5,11 @@ local armor_path = minetest.get_modpath("3d_armor")
-- contains .motors loaded from mod storage
-- runtime variables and api functions
elevator = {
SPEED = 10, -- Initial speed of a box.
ACCEL = 0.1, -- Acceleration of a box.
SPEED = minetest.settings:get("elevator_speed") or 10, -- Initial speed of a box.
ACCEL = minetest.settings:get("elevator_accel") or 0.1, -- Acceleration of a box.
VISUAL_INCREASE = 1.75,
VERSION = 8, -- Elevator interface/database version.
PTIMEOUT = 120, -- Maximum time a box can go without players nearby.
PTIMEOUT = minetest.settings:get("elevator_time") or 120, -- Maximum time a box can go without players nearby.
boxes = {}, -- Elevator boxes in action.
lastboxes = {}, -- Player near box timeout.

View File

@ -1,3 +1,3 @@
name = elevator
depends = default
optional_depends = technic, homedecor, chains, farming
description = An entity-based elevator allowing fast realtime travel in Minetest. Supports Minetest Game and MineClone2.
optional_depends = default, technic, homedecor, chains, farming, mcl_core, mcl_sounds

8
settingtypes.txt Normal file
View File

@ -0,0 +1,8 @@
# Initial speed of the box
elevator_speed (Initial elevator speed) float 10
# Acceleration of the box
elevator_accel (Elevator acceleration) float 0.1
# Maximum time a box can go without players nearby.
elevator_time (Maximum idle time without players) int 120

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B