Add recipes.

This commit is contained in:
SFENCE 2022-02-13 21:52:53 +01:00
parent 6670bd23bc
commit eb4eb919d0
8 changed files with 122 additions and 10 deletions

View File

@ -14,3 +14,8 @@ CC BY-SA 4.0 - check LICENSE file
Copyright (c) 2022 SFENCE (CC BY-SA 4.0):
All textures not mentioned below.
Copyright (c) 2022 Sinki (CC BY-SA 4.0):
* chair_lift_seet.we
* chair_lift_seet_inv.png

View File

@ -28,7 +28,7 @@ local chair_entity = {
visual = "mesh",
mesh = "chair_lift_seat.obj",
visual_size = {x=1,y=1,z=1},
textures = {"chair_lift_chair.png"},
textures = {"chair_lift_seet.png"},
},
driver = nil,
prev_pos = nil,
@ -80,7 +80,7 @@ end
function chair_entity:on_punch(puncher)
if self.driver==nil then
local inv = puncher:get_inventory()
inv:add_item("main", ItemStack("chair_lift:chair"))
inv:add_item("main", ItemStack("chair_lift:seet"))
self.object:remove()
end
end
@ -237,11 +237,11 @@ function chair_entity:on_step(dtime)
end
end
minetest.register_entity("chair_lift:chair", chair_entity)
minetest.register_entity("chair_lift:seet", chair_entity)
minetest.register_craftitem("chair_lift:chair", {
description = S("Chair Lift Chair"),
inventory_image = "chair_lift_chair_inv.png",
minetest.register_craftitem("chair_lift:seet", {
description = S("Chair Lift Seet"),
inventory_image = "chair_lift_seet_inv.png",
on_place = function (itemstack, placer, pointed_thing)
if pointed_thing.type~="node" then
@ -256,8 +256,8 @@ minetest.register_craftitem("chair_lift:chair", {
end
pos = vector.add(pos, chair_pos_offset)
print("Chair to pos: "..minetest.pos_to_string(pos))
minetest.add_entity(pos, "chair_lift:chair")
--print("Chair to pos: "..minetest.pos_to_string(pos))
minetest.add_entity(pos, "chair_lift:seet")
itemstack:take_item()
return itemstack

92
crafting.lua Normal file
View File

@ -0,0 +1,92 @@
local items = {
steel_wire = "basic_materials:steel_wire",
empty_spool = "basic_materials:empty_spool",
steel_block = "default:steelblock",
wheel_ingot = "default:steel_ingot",
}
if minetest.get_modpath("technic") then
items.steel_block = "technic:carbon_steel_block"
items.wheel_ingot = "technic:stainless_steel_ingot"
end
if minetest.get_modpath("hades_extramaterials") then
items.steel_wire = "hades_extramaterials: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"
end
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},
},
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},
},
})
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},
},
})
minetest.register_craft({
output = "chair_lift:pole_arm 9",
recipe = {
{items.steel_block},
{items.steel_block},
{items.steel_block},
},
})
minetest.register_craft({
output = "chair_lift:wheel_part",
recipe = {
{"",items.wheel_ingot,""},
{items.wheel_ingot,"",items.wheel_ingot},
{"",items.wheel_ingot,""},
},
})
minetest.register_craft({
output = "chair_lift:rope_wheel",
recipe = {
{"chair_lift:wheel_part"},
{items.wheel_ingot},
{"chair_lift:wheel_part"},
},
})
minetest.register_craft({
output = "chair_lift:pole_arm_end",
recipe = {
{"","chair_lift:pole_arm",""},
{"chair_lift:rope_wheel","power_generators:shaft","chair_lift:rope_wheel"}
},
})
minetest.register_craft({
output = "chair_lift:wheel_powered",
recipe = {
{"chair_lift:pole_arm"},
{"power_generators:shaft"},
{"chair_lift:rope_wheel"},
},
})

12
craftitems.lua Normal file
View File

@ -0,0 +1,12 @@
local S = chair_lift.translator
minetest.register_craftitem("chair_lift:wheel_part", {
description = S("Part of Wheel for Steel Rope"),
inventory_image = "chair_lift_wheel_part.png",
})
minetest.register_craftitem("chair_lift:rope_wheel", {
description = S("Wheel for Steel Rope"),
inventory_image = "chair_lift_rope_wheel.png",
})

View File

@ -12,3 +12,6 @@ dofile(modpath.."/steel_rope.lua")
dofile(modpath.."/powered_wheel.lua")
dofile(modpath.."/chair_lift_entity.lua")
dofile(modpath.."/craftitems.lua")
dofile(modpath.."/crafting.lua")

View File

@ -1,5 +1,5 @@
name = chair_lift
title = Chair lift
description = Add craftable and usable charit lift.
depends = appliances
optional_depends = default, player_api, hades_core, hades_sounds, hades_player, screwdriver, sounds, technic, hades_technic
depends = appliances, power_generators
optional_depends = default, player_api, hades_core, hades_sounds, hades_player, screwdriver, sounds, basic_materials, hades_extramaterials, technic, hades_technic

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B