mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-28 05:43:43 +01:00
Add 5 “Minecart with X” entities
* Minecart with Chest * Minecart with Furnace * Minecart with TNT * Minecart with Hopper * Minecart with Command Block
This commit is contained in:
parent
840fe1fd35
commit
f2ed6f126e
@ -2,5 +2,10 @@ mcl_core
|
||||
mcl_sounds
|
||||
mcl_player
|
||||
mcl_achievements
|
||||
mcl_chests
|
||||
mcl_furnaces
|
||||
mesecons_commandblock
|
||||
mcl_hoppers
|
||||
mcl_tnt
|
||||
mesecons?
|
||||
doc_identifier?
|
||||
|
@ -13,13 +13,15 @@ end
|
||||
dofile(mcl_minecarts.modpath.."/functions.lua")
|
||||
dofile(mcl_minecarts.modpath.."/rails.lua")
|
||||
|
||||
mcl_minecarts.cart = {
|
||||
|
||||
local function register_entity(entity_id, mesh, textures, drop)
|
||||
local cart = {
|
||||
physical = false,
|
||||
collisionbox = {-10/16., -0.5, -10/16, 10/16, 0.25, 10/16},
|
||||
visual = "mesh",
|
||||
mesh = "mcl_minecarts_minecart.b3d",
|
||||
mesh = mesh,
|
||||
visual_size = {x=1, y=1},
|
||||
textures = {"mcl_minecarts_minecart.png"},
|
||||
textures = textures,
|
||||
|
||||
_driver = nil,
|
||||
_punched = false, -- used to re-send _velocity and position
|
||||
@ -29,9 +31,9 @@ mcl_minecarts.cart = {
|
||||
_old_pos = nil,
|
||||
_old_switch = 0,
|
||||
_railtype = nil,
|
||||
}
|
||||
}
|
||||
|
||||
function mcl_minecarts.cart:on_rightclick(clicker)
|
||||
function cart:on_rightclick(clicker)
|
||||
if not clicker or not clicker:is_player() then
|
||||
return
|
||||
end
|
||||
@ -46,13 +48,13 @@ function mcl_minecarts.cart:on_rightclick(clicker)
|
||||
mcl_player.player_attached[player_name] = true
|
||||
clicker:set_attach(self.object, "", {x=0, y=3, z=0}, {x=0, y=0, z=0})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function mcl_minecarts.cart:on_activate(staticdata, dtime_s)
|
||||
function cart:on_activate(staticdata, dtime_s)
|
||||
self.object:set_armor_groups({immortal=1})
|
||||
end
|
||||
end
|
||||
|
||||
function mcl_minecarts.cart:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
|
||||
function cart:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
|
||||
local pos = self.object:getpos()
|
||||
if not self._railtype then
|
||||
local node = minetest.get_node(vector_floor(pos)).name
|
||||
@ -83,7 +85,9 @@ function mcl_minecarts.cart:on_punch(puncher, time_from_last_punch, tool_capabil
|
||||
end
|
||||
|
||||
if not minetest.settings:get_bool("creative_mode") then
|
||||
minetest.add_item(self.object:getpos(), "mcl_minecarts:minecart")
|
||||
for d=1, #drop do
|
||||
minetest.add_item(self.object:getpos(), drop[d])
|
||||
end
|
||||
end
|
||||
self.object:remove()
|
||||
return
|
||||
@ -109,9 +113,9 @@ function mcl_minecarts.cart:on_punch(puncher, time_from_last_punch, tool_capabil
|
||||
self._velocity = vector.multiply(cart_dir, f)
|
||||
self._old_pos = nil
|
||||
self._punched = true
|
||||
end
|
||||
end
|
||||
|
||||
function mcl_minecarts.cart:on_step(dtime)
|
||||
function cart:on_step(dtime)
|
||||
local vel = self.object:getvelocity()
|
||||
local update = {}
|
||||
if self._punched then
|
||||
@ -195,7 +199,7 @@ function mcl_minecarts.cart:on_step(dtime)
|
||||
update.pos = true
|
||||
end
|
||||
|
||||
-- Slow down or speed up..
|
||||
-- Slow down or speed up
|
||||
local acc = dir.y * -1.8
|
||||
|
||||
local speed_mod = tonumber(minetest.get_meta(pos):get_string("cart_acceleration"))
|
||||
@ -268,18 +272,67 @@ function mcl_minecarts.cart:on_step(dtime)
|
||||
self.object:setpos(pos)
|
||||
end
|
||||
update = nil
|
||||
end
|
||||
|
||||
minetest.register_entity(entity_id, cart)
|
||||
end
|
||||
|
||||
minetest.register_entity("mcl_minecarts:minecart", mcl_minecarts.cart)
|
||||
minetest.register_craftitem("mcl_minecarts:minecart", {
|
||||
description = "Minecart",
|
||||
_doc_items_longdesc = "Minecarts can be used for a quick transportion on rails." .. "\n" ..
|
||||
"Minecarts only ride on rails and always follow the tracks. At a T-junction with no straight way ahead, they turn left. The speed is affected by the rail type.",
|
||||
_doc_items_usagehelp = "You can place the minecart on rails. Right-click it to enter it. Punch it to get it moving." .. "\n" ..
|
||||
"To obtain the minecart, punch it while holding down the sneak key.",
|
||||
register_entity("mcl_minecarts:minecart",
|
||||
"mcl_minecarts_minecart.b3d",
|
||||
{"mcl_minecarts_minecart.png"},
|
||||
{"mcl_minecarts:minecart"})
|
||||
register_entity("mcl_minecarts:chest_minecart",
|
||||
"mcl_minecarts_minecart_chest.b3d",
|
||||
{ "mcl_chests_normal.png", "mcl_minecarts_minecart.png" },
|
||||
{"mcl_minecarts:minecart", "mcl_chests:chest"})
|
||||
register_entity("mcl_minecarts:furnace_minecart",
|
||||
"mcl_minecarts_minecart_block.b3d",
|
||||
{
|
||||
"default_furnace_top.png",
|
||||
"default_furnace_top.png",
|
||||
"default_furnace_front.png",
|
||||
"default_furnace_side.png",
|
||||
"default_furnace_side.png",
|
||||
"default_furnace_side.png",
|
||||
"mcl_minecarts_minecart.png",
|
||||
},
|
||||
{"mcl_minecarts:minecart", "mcl_furnaces:furnace"})
|
||||
register_entity("mcl_minecarts:tnt_minecart",
|
||||
"mcl_minecarts_minecart_block.b3d",
|
||||
{
|
||||
"default_tnt_top.png",
|
||||
"default_tnt_bottom.png",
|
||||
"default_tnt_side.png",
|
||||
"default_tnt_side.png",
|
||||
"default_tnt_side.png",
|
||||
"default_tnt_side.png",
|
||||
"mcl_minecarts_minecart.png",
|
||||
},
|
||||
{"mcl_minecarts:minecart", "mcl_tnt:tnt"})
|
||||
register_entity("mcl_minecarts:hopper_minecart",
|
||||
"mcl_minecarts_minecart_hopper.b3d",
|
||||
{
|
||||
"mcl_hoppers_hopper_inside.png",
|
||||
"mcl_minecarts_minecart.png",
|
||||
"mcl_hoppers_hopper_outside.png",
|
||||
"mcl_hoppers_hopper_top.png",
|
||||
},
|
||||
{"mcl_minecarts:minecart", "mcl_hoppers:hopper"})
|
||||
register_entity("mcl_minecarts:command_block_minecart",
|
||||
"mcl_minecarts_minecart_block.b3d",
|
||||
{
|
||||
"jeija_commandblock_off.png^[verticalframe:2:0",
|
||||
"jeija_commandblock_off.png^[verticalframe:2:0",
|
||||
"jeija_commandblock_off.png^[verticalframe:2:0",
|
||||
"jeija_commandblock_off.png^[verticalframe:2:0",
|
||||
"jeija_commandblock_off.png^[verticalframe:2:0",
|
||||
"jeija_commandblock_off.png^[verticalframe:2:0",
|
||||
"mcl_minecarts_minecart.png",
|
||||
},
|
||||
{"mcl_minecarts:minecart"})
|
||||
|
||||
inventory_image = "mcl_minecarts_minecart_normal.png",
|
||||
wield_image = "mcl_minecarts_minecart_normal.png",
|
||||
local register_craftitem = function(itemstring, entity_id, description, longdesc, usagehelp, icon)
|
||||
local def = {
|
||||
stack_max = 1,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if not pointed_thing.type == "node" then
|
||||
@ -302,7 +355,7 @@ minetest.register_craftitem("mcl_minecarts:minecart", {
|
||||
else
|
||||
return
|
||||
end
|
||||
local cart = minetest.add_entity(railpos, "mcl_minecarts:minecart")
|
||||
local cart = minetest.add_entity(railpos, entity_id)
|
||||
local railtype = minetest.get_item_group(node.name, "connect_to_raillike")
|
||||
local cart_dir = mcl_minecarts:get_rail_direction(railpos, {x=1, y=0, z=0}, nil, nil, railtype)
|
||||
cart:setyaw(minetest.dir_to_yaw(cart_dir))
|
||||
@ -313,12 +366,69 @@ minetest.register_craftitem("mcl_minecarts:minecart", {
|
||||
return itemstack
|
||||
end,
|
||||
groups = { minecart = 1, transport = 1},
|
||||
})
|
||||
|
||||
if minetest.get_modpath("doc_identifier") ~= nil then
|
||||
doc.sub.identifier.register_object("mcl_minecarts:minecart", "craftitems", "mcl_minecarts:minecart")
|
||||
}
|
||||
def.description = description
|
||||
def._doc_items_longdec = longdesc
|
||||
def._doc_items_usagehelp = usagehelp
|
||||
def.inventory_image = icon
|
||||
def.wield_image = icon
|
||||
minetest.register_craftitem(itemstring, def)
|
||||
end
|
||||
|
||||
register_craftitem(
|
||||
"mcl_minecarts:minecart",
|
||||
"mcl_minecarts:minecart",
|
||||
"Minecart",
|
||||
"Minecarts can be used for a quick transportion on rails." .. "\n" ..
|
||||
"Minecarts only ride on rails and always follow the tracks. At a T-junction with no straight way ahead, they turn left. The speed is affected by the rail type.",
|
||||
|
||||
"You can place the minecart on rails. Right-click it to enter it. Punch it to get it moving." .. "\n" ..
|
||||
"To obtain the minecart, punch it while holding down the sneak key.",
|
||||
"mcl_minecarts_minecart_normal.png"
|
||||
)
|
||||
|
||||
register_craftitem(
|
||||
"mcl_minecarts:hopper_minecart",
|
||||
"mcl_minecarts:hopper_minecart",
|
||||
"Minecart with Hopper",
|
||||
nil, nil,
|
||||
"mcl_minecarts_minecart_hopper.png"
|
||||
)
|
||||
|
||||
register_craftitem(
|
||||
"mcl_minecarts:tnt_minecart",
|
||||
"mcl_minecarts:tnt_minecart",
|
||||
"Minecart with TNT",
|
||||
nil, nil,
|
||||
"mcl_minecarts_minecart_tnt.png"
|
||||
)
|
||||
|
||||
register_craftitem(
|
||||
"mcl_minecarts:chest_minecart",
|
||||
"mcl_minecarts:chest_minecart",
|
||||
"Minecart with Chest",
|
||||
nil, nil,
|
||||
"mcl_minecarts_minecart_chest.png"
|
||||
)
|
||||
|
||||
register_craftitem(
|
||||
"mcl_minecarts:furnace_minecart",
|
||||
"mcl_minecarts:furnace_minecart",
|
||||
"Minecart with Furnace",
|
||||
nil, nil,
|
||||
"mcl_minecarts_minecart_furnace.png"
|
||||
)
|
||||
|
||||
register_craftitem(
|
||||
"mcl_minecarts:command_block_minecart",
|
||||
"mcl_minecarts:command_block_minecart",
|
||||
"Minecart with Command Block",
|
||||
nil, nil,
|
||||
"mcl_minecarts_minecart_command_block.png"
|
||||
)
|
||||
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_minecarts:minecart",
|
||||
recipe = {
|
||||
@ -326,3 +436,35 @@ minetest.register_craft({
|
||||
{"mcl_core:iron_ingot", "mcl_core:iron_ingot", "mcl_core:iron_ingot"},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_minecarts:hopper_minecart",
|
||||
recipe = {
|
||||
{"mcl_hoppers:hopper"},
|
||||
{"mcl_minecarts:minecart"},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_minecarts:chest_minecart",
|
||||
recipe = {
|
||||
{"mcl_chests:chest"},
|
||||
{"mcl_minecarts:minecart"},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_minecarts:tnt_minecart",
|
||||
recipe = {
|
||||
{"mcl_tnt:tnt"},
|
||||
{"mcl_minecarts:minecart"},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_minecarts:furnace_minecart",
|
||||
recipe = {
|
||||
{"mcl_furnaces:furnace"},
|
||||
{"mcl_minecarts:minecart"},
|
||||
},
|
||||
})
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 271 B |
Binary file not shown.
After Width: | Height: | Size: 243 B |
Binary file not shown.
After Width: | Height: | Size: 271 B |
Binary file not shown.
After Width: | Height: | Size: 236 B |
Binary file not shown.
After Width: | Height: | Size: 249 B |
@ -11,3 +11,4 @@ doc_identifier
|
||||
mobs_mc
|
||||
mcl_paintings
|
||||
mcl_comparators
|
||||
mcl_minecarts
|
||||
|
@ -17,6 +17,11 @@ local wip_items = {
|
||||
"mobs_mc:totem",
|
||||
"mcl_paintings:painting",
|
||||
"mcl_comparators:comparator_off_comp",
|
||||
"mcl_minecarts:hopper_minecart",
|
||||
"mcl_minecarts:command_block_minecart",
|
||||
"mcl_minecarts:chest_minecart",
|
||||
"mcl_minecarts:furnace_minecart",
|
||||
"mcl_minecarts:tnt_minecart",
|
||||
}
|
||||
|
||||
for i=1,#wip_items do
|
||||
|
@ -420,6 +420,11 @@ Source path,Source file,Target path,Target file,xs,ys,xl,yl,xt,yt
|
||||
/assets/minecraft/textures/blocks,rail_normal_turned.png,/mods/ITEMS/mcl_minecarts/textures,default_rail_curved.png,,,,,,
|
||||
/assets/minecraft/textures/blocks,rail_normal.png,/mods/ITEMS/mcl_minecarts/textures,default_rail.png,,,,,,
|
||||
/assets/minecraft/textures/items,minecart_normal.png,/mods/ITEMS/mcl_minecarts/textures,mcl_minecarts_minecart_normal.png,,,,,,
|
||||
/assets/minecraft/textures/items,minecart_chest.png,/mods/ITEMS/mcl_minecarts/textures,mcl_minecarts_minecart_chest.png,,,,,,
|
||||
/assets/minecraft/textures/items,minecart_tnt.png,/mods/ITEMS/mcl_minecarts/textures,mcl_minecarts_minecart_tnt.png,,,,,,
|
||||
/assets/minecraft/textures/items,minecart_command_block.png,/mods/ITEMS/mcl_minecarts/textures,mcl_minecarts_minecart_command_block.png,,,,,,
|
||||
/assets/minecraft/textures/items,minecart_furnace.png,/mods/ITEMS/mcl_minecarts/textures,mcl_minecarts_minecart_furnace.png,,,,,,
|
||||
/assets/minecraft/textures/items,minecart_hopper.png,/mods/ITEMS/mcl_minecarts/textures,mcl_minecarts_minecart_hopper.png,,,,,,
|
||||
/assets/minecraft/textures/blocks,rail_detector.png,/mods/ITEMS/mcl_minecarts/textures,rail_detector.png,,,,,,
|
||||
/assets/minecraft/textures/blocks,rail_detector_powered.png,/mods/ITEMS/mcl_minecarts/textures,rail_detector_powered.png,,,,,,
|
||||
/assets/minecraft/textures/blocks,rail_golden_powered.png,/mods/ITEMS/mcl_minecarts/textures,rail_golden_powered.png,,,,,,
|
||||
|
|
Loading…
Reference in New Issue
Block a user