Skip to content

Commit

Permalink
Use adaptation modpack.
Browse files Browse the repository at this point in the history
  • Loading branch information
sfence committed Oct 25, 2022
1 parent d5111e2 commit 5f2d365
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 79 deletions.
18 changes: 18 additions & 0 deletions adaptation.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

chair_lift.adaptation = {}
local adaptation = chair_lift.adaptation

-- items
adaptation.empty_spool = adaptation_lib.get_item({"spool_empty"})
adaptation.steel_gear = adaptation_lib.get_item({"gear_steel"})
adaptation.steel_wire = adaptation_lib.get_item({"wire_stainless_steel","wire_steel"})
adaptation.steel_block = adaptation_lib.get_item({"block_carbon_steel","block_steel", "block_iron"})
adaptation.wheel_ingot = adaptation_lib.get_item({"ingot_stainless_steel_ingot","ingot_steel", "ingot_iron"})
adaptation.seat_block = adaptation_lib.get_item({"block_carbon_steel","block_steel", "block_iron"})
adaptation.seat_ingot = adaptation_lib.get_item({"ingot_carbon_steel","ingot_steel", "block_iron"})
adaptation.seat_glass = adaptation_lib.get_item({"glass"})

-- mods
adaptation.player_mod = adaptation_lib.get_mod("player")
adaptation.screwdriver_mod = adaptation_lib.get_mod("screwdriver") or {}

25 changes: 8 additions & 17 deletions chair_lift_entity.lua
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@

local S = chair_lift.translator

local player_set_animation = nil
local player_set_attached = nil
local player_mod = chair_lift.adaptation.player_mod

if minetest.get_modpath("player_api") then
player_set_animation = player_api.set_animation
player_set_attached = function(name, value)
player_api.player_attached[name] = value
end
elseif minetest.get_modpath("hades_player") then
player_set_animation = hades_player.player_set_animation
player_set_attached = function(name, value)
hades_player.player_attached[name] = value
end
if (not adaptation_lib.check_keys_aviable("[chair_lift] chair lift entity:", chair_lift.adaptation, {"player_mod"})) then
return
end

local chair_pos_offset = vector.new(0, -2.5+3/16, 0)
Expand Down Expand Up @@ -80,11 +71,11 @@ function chair_entity:on_rightclick(clicker)
if self.driver==nil then
-- attach
clicker:set_attach(self.object, "", {x=0,y=0,z=0},{x=0,y=0,z=0})
player_set_attached(player_name, true)
player_mod.attach_player(player_name, true)
minetest.after(0.2, function()
local player = minetest.get_player_by_name(player_name)
if player then
player_set_animation(player, "sit")
player_mod.set_animation(player, "sit")
end
end)
self.driver = player_name
Expand All @@ -93,8 +84,8 @@ function chair_entity:on_rightclick(clicker)
-- detach
clicker:set_detach()
self.driver = nil
player_set_attached(player_name, nil)
player_set_animation(clicker, "stand")
player_mod.deattach_player(player_name, nil)
player_mod.set_animation(clicker, "stand")
end
end
end
Expand All @@ -120,7 +111,7 @@ function chair_entity:cause_fall(pos)
local player = minetest.get_player_by_name(self.driver)
if player then
player:set_detach()
minetest.after(0.1, function() player_set_animation(player, "stand") end)
minetest.after(0.1, function() player_mod.set_animation(player, "stand") end)
end
self.driver = nil
end
Expand Down
83 changes: 26 additions & 57 deletions crafting.lua
Original file line number Diff line number Diff line change
@@ -1,73 +1,42 @@

local items = {
empty_spool = "basic_materials:empty_spool",
steel_gear = "basic_materials:gear_steel",
steel_wire = "basic_materials:steel_wire",
steel_block = "default:steelblock",
wheel_ingot = "default:steel_ingot",
seat_block = "default:steelblock",
seat_ingot = "default:steel_ingot",
seat_glass = "default:glass",
}
local adaptation = chair_lift.adaptation

if minetest.get_modpath("hades_core") then
items.steel_block = "hades_core:steelblock"
items.wheel_ingot = "hades_core:steel_ingot"
items.seat_block = "hades_core:steelblock"
items.seat_ingot = "hades_core:steel_ingot"
items.seat_glass = "hades_core:glass"
end
local N = adaptation_lib.get_item_name

if minetest.get_modpath("technic") then
items.steel_block = "technic:carbon_steel_block"
items.wheel_ingot = "technic:stainless_steel_ingot"
items.seat_block = "technic:carbon_steel_block"
items.seat_ingot = "technic:carbon_steel_ingot"

items.steel_wire = "basic_materials:stainless_steel_wire"
end

if minetest.get_modpath("hades_technic") then
items.steel_block = "hades_technic:carbon_steel_block"
items.wheel_ingot = "hades_technic:stainless_steel_ingot"
items.seat_block = "hades_technic:carbon_steel_block"
items.seat_ingot = "hades_technic:carbon_steel_ingot"

items.steel_wire = "basic_materials:stainless_steel_wire"
end
adaptation_lib.check_keys_aviable("[chair_lift] Crafting: ", adaptation, {"steel_wire", "empty_spool", "steel_block", "steel_gear", "wheel_ingot", "seat_ingot", "seat_block", "seat_glass"})

minetest.register_craft({
output = "chair_lift:steel_rope 2",
recipe = {
{items.steel_wire,items.steel_wire},
{items.steel_wire,items.steel_wire},
{items.steel_wire,items.steel_wire},
{N(adaptation.steel_wire),N(adaptation.steel_wire)},
{N(adaptation.steel_wire),N(adaptation.steel_wire)},
{N(adaptation.steel_wire),N(adaptation.steel_wire)},
},
replacements = {
{items.steel_wire,items.empty_spool},
{items.steel_wire,items.empty_spool},
{items.steel_wire,items.empty_spool},
{items.steel_wire,items.empty_spool},
{items.steel_wire,items.empty_spool},
{items.steel_wire,items.empty_spool},
{N(adaptation.steel_wire),N(adaptation.empty_spool)},
{N(adaptation.steel_wire),N(adaptation.empty_spool)},
{N(adaptation.steel_wire),N(adaptation.empty_spool)},
{N(adaptation.steel_wire),N(adaptation.empty_spool)},
{N(adaptation.steel_wire),N(adaptation.empty_spool)},
{N(adaptation.steel_wire),N(adaptation.empty_spool)},
},
})

minetest.register_craft({
output = "chair_lift:pole_body 9",
recipe = {
{items.steel_block, items.steel_block},
{items.steel_block, items.steel_block},
{items.steel_block, items.steel_block},
{N(adaptation.steel_block), N(adaptation.steel_block)},
{N(adaptation.steel_block), N(adaptation.steel_block)},
{N(adaptation.steel_block), N(adaptation.steel_block)},
},
})

minetest.register_craft({
output = "chair_lift:pole_arm 9",
recipe = {
{items.steel_block},
{items.steel_block},
{items.steel_block},
{N(adaptation.steel_block)},
{N(adaptation.steel_block)},
{N(adaptation.steel_block)},
},
})

Expand All @@ -81,17 +50,17 @@ minetest.register_craft({
minetest.register_craft({
output = "chair_lift:wheel_part",
recipe = {
{"",items.wheel_ingot,""},
{items.wheel_ingot,"",items.wheel_ingot},
{"",items.wheel_ingot,""},
{"",N(adaptation.wheel_ingot),""},
{N(adaptation.wheel_ingot),"",N(adaptation.wheel_ingot)},
{"",N(adaptation.wheel_ingot),""},
},
})

minetest.register_craft({
output = "chair_lift:rope_wheel",
recipe = {
{"chair_lift:wheel_part"},
{items.wheel_ingot},
{N(adaptation.wheel_ingot)},
{"chair_lift:wheel_part"},
},
})
Expand All @@ -108,17 +77,17 @@ minetest.register_craft({
output = "chair_lift:wheel_powered",
recipe = {
{"","chair_lift:pole_arm",""},
{items.steel_gear,"power_generators:shaft",items.steel_gear},
{N(adaptation.steel_gear),"power_generators:shaft",N(adaptation.steel_gear)},
{"","chair_lift:rope_wheel",""},
},
})

minetest.register_craft({
output = "chair_lift:seat",
recipe = {
{"chair_lift:rope_wheel",items.seat_ingot,"chair_lift:rope_wheel"},
{items.seat_ingot,"power_generators:shaft",""},
{items.seat_block,items.seat_glass,""},
{"chair_lift:rope_wheel",N(adaptation.seat_ingot),"chair_lift:rope_wheel"},
{N(adaptation.seat_ingot),"power_generators:shaft",""},
{N(adaptation.seat_block),N(adaptation.seat_glass),""},
},
})

2 changes: 2 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ chair_lift = {

local modpath = minetest.get_modpath(minetest.get_current_modname())

dofile(modpath.."/adaptation.lua")

dofile(modpath.."/functions.lua")

dofile(modpath.."/chair_lift.lua")
Expand Down
2 changes: 1 addition & 1 deletion mod.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = chair_lift
title = Chair lift
description = Add craftable and usable chair lift.
depends = appliances, power_generators, basic_materials
depends = appliances, power_generators, basic_materials, adaptation_lib, adaptation_minetest_game, adaptation_hades_revisited, adaptation_farlands_reloaded, adaptation_mineclone, adaptation_basic_materials, adaptation_technic
optional_depends = default, player_api, hades_core, hades_sounds, hades_player, screwdriver, sounds, technic, hades_technic
10 changes: 6 additions & 4 deletions steel_rope.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

local S = chair_lift.translator

local adaptation = chair_lift.adaptation

local metal_sounds = nil
if minetest.get_modpath("sounds") then
metal_sounds = sounds.node_metal()
Expand Down Expand Up @@ -123,7 +125,7 @@ minetest.register_node("chair_lift:steel_rope", {

node_placement_prediction = "",

on_rotate = screwdriver.disallow,
on_rotate = adaptation.screwdriver_mod.disallow,
on_place = function(itemstack, placer, pointed_thing)
local pos = pointed_thing.under
local node = minetest.get_node(pos)
Expand Down Expand Up @@ -266,7 +268,7 @@ minetest.register_node("chair_lift:steel_rope_ver", {
_I = 2,
_friction = 0.02,

on_rotate = screwdriver.disallow,
on_rotate = adaptation.screwdriver_mod.disallow,
})
minetest.register_node("chair_lift:steel_rope_hor", {
description = S("Steel Rope Horizontal"),
Expand Down Expand Up @@ -322,7 +324,7 @@ minetest.register_node("chair_lift:steel_rope_hor", {
_I = 2,
_friction = 0.01,

on_rotate = screwdriver.disallow,
on_rotate = adaptation.screwdriver_mod.disallow,
})
minetest.register_node("chair_lift:steel_rope_hor_2", {
description = S("Steel Rope Horizontal 2"),
Expand Down Expand Up @@ -370,6 +372,6 @@ minetest.register_node("chair_lift:steel_rope_hor_2", {
_I = 2,
_friction = 0.01,

on_rotate = screwdriver.disallow,
on_rotate = adaptation.screwdriver_mod.disallow,
})

0 comments on commit 5f2d365

Please sign in to comment.