Merge pull request 'Some entity inv / boat fixes' (#2788) from entinv_fixes into master
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/2788 Reviewed-by: epCode <epcode@noreply.git.minetest.land>
This commit is contained in:
commit
cdbcae4b59
|
@ -65,9 +65,13 @@ local function set_double_attach(boat)
|
||||||
boat._passenger:set_attach(boat.object, "",
|
boat._passenger:set_attach(boat.object, "",
|
||||||
{x = 0, y = 0.42, z = -2.2}, {x = 0, y = 0, z = 0})
|
{x = 0, y = 0.42, z = -2.2}, {x = 0, y = 0, z = 0})
|
||||||
end
|
end
|
||||||
|
local function set_choat_attach(boat)
|
||||||
|
boat._driver:set_attach(boat.object, "",
|
||||||
|
{x = 0, y = 0.42, z = 1.8}, {x = 0, y = 0, z = 0})
|
||||||
|
end
|
||||||
|
|
||||||
local function attach_object(self, obj)
|
local function attach_object(self, obj)
|
||||||
if self._driver then
|
if self._driver and not self._inv_id then
|
||||||
if self._driver:is_player() then
|
if self._driver:is_player() then
|
||||||
self._passenger = obj
|
self._passenger = obj
|
||||||
else
|
else
|
||||||
|
@ -77,8 +81,12 @@ local function attach_object(self, obj)
|
||||||
set_double_attach(self)
|
set_double_attach(self)
|
||||||
else
|
else
|
||||||
self._driver = obj
|
self._driver = obj
|
||||||
|
if self._inv_id then
|
||||||
|
set_choat_attach(self)
|
||||||
|
else
|
||||||
set_attach(self)
|
set_attach(self)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local visual_size = get_visual_size(obj)
|
local visual_size = get_visual_size(obj)
|
||||||
local yaw = self.object:get_yaw()
|
local yaw = self.object:get_yaw()
|
||||||
|
@ -123,8 +131,8 @@ local boat = {
|
||||||
pointable = true,
|
pointable = true,
|
||||||
-- Warning: Do not change the position of the collisionbox top surface,
|
-- Warning: Do not change the position of the collisionbox top surface,
|
||||||
-- lowering it causes the boat to fall through the world if underwater
|
-- lowering it causes the boat to fall through the world if underwater
|
||||||
collisionbox = {-0.5, -0.35, -0.5, 0.5, 0.3, 0.5},
|
collisionbox = {-0.5, -0.15, -0.5, 0.5, 0.55, 0.5},
|
||||||
selectionbox = {-0.7, -0.35, -0.7, 0.7, 0.3, 0.7},
|
selectionbox = {-0.7, -0.15, -0.7, 0.7, 0.55, 0.7},
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
mesh = "mcl_boats_boat.b3d",
|
mesh = "mcl_boats_boat.b3d",
|
||||||
textures = {"mcl_boats_texture_oak_boat.png", "mcl_boats_texture_oak_boat.png", "mcl_boats_texture_oak_boat.png", "mcl_boats_texture_oak_boat.png", "mcl_boats_texture_oak_boat.png"},
|
textures = {"mcl_boats_texture_oak_boat.png", "mcl_boats_texture_oak_boat.png", "mcl_boats_texture_oak_boat.png", "mcl_boats_texture_oak_boat.png", "mcl_boats_texture_oak_boat.png"},
|
||||||
|
@ -417,6 +425,8 @@ local cboat = table.copy(boat)
|
||||||
cboat.mesh = "mcl_boats_boat_with_chest.b3d"
|
cboat.mesh = "mcl_boats_boat_with_chest.b3d"
|
||||||
cboat.textures = {"mcl_boats_texture_oak_chest_boat.png", "mcl_boats_texture_oak_chest_boat.png", "mcl_boats_texture_oak_chest_boat.png", "mcl_boats_texture_oak_chest_boat.png", "mcl_boats_texture_oak_chest_boat.png"}
|
cboat.textures = {"mcl_boats_texture_oak_chest_boat.png", "mcl_boats_texture_oak_chest_boat.png", "mcl_boats_texture_oak_chest_boat.png", "mcl_boats_texture_oak_chest_boat.png", "mcl_boats_texture_oak_chest_boat.png"}
|
||||||
cboat._itemstring = "mcl_boats:chest_boat"
|
cboat._itemstring = "mcl_boats:chest_boat"
|
||||||
|
cboat.collisionbox = {-0.5, -0.15, -0.5, 0.5, 0.75, 0.5}
|
||||||
|
cboat.selectionbox = {-0.7, -0.15, -0.7, 0.7, 0.75, 0.7}
|
||||||
|
|
||||||
minetest.register_entity("mcl_boats:chest_boat", cboat)
|
minetest.register_entity("mcl_boats:chest_boat", cboat)
|
||||||
mcl_entity_invs.register_inv("mcl_boats:chest_boat","Boat",27)
|
mcl_entity_invs.register_inv("mcl_boats:chest_boat","Boat",27)
|
||||||
|
|
|
@ -102,7 +102,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
function mcl_entity_invs.register_inv(entity_name,show_name,size,no_on_righclick)
|
function mcl_entity_invs.register_inv(entity_name,show_name,size,no_on_righclick,no_sneak)
|
||||||
assert(minetest.registered_entities[entity_name],"mcl_entity_invs.register_inv called with invalid entity: "..tostring(entity_name))
|
assert(minetest.registered_entities[entity_name],"mcl_entity_invs.register_inv called with invalid entity: "..tostring(entity_name))
|
||||||
minetest.registered_entities[entity_name]._inv_size = size
|
minetest.registered_entities[entity_name]._inv_size = size
|
||||||
minetest.registered_entities[entity_name]._inv_title = show_name
|
minetest.registered_entities[entity_name]._inv_title = show_name
|
||||||
|
@ -125,7 +125,10 @@ function mcl_entity_invs.register_inv(entity_name,show_name,size,no_on_righclick
|
||||||
if not no_on_righclick then
|
if not no_on_righclick then
|
||||||
local old_rc = minetest.registered_entities[entity_name].on_rightclick
|
local old_rc = minetest.registered_entities[entity_name].on_rightclick
|
||||||
minetest.registered_entities[entity_name].on_rightclick = function(self,clicker)
|
minetest.registered_entities[entity_name].on_rightclick = function(self,clicker)
|
||||||
mcl_entity_invs.show_inv_form(self,clicker,show_name)
|
if no_sneak or clicker:get_player_control().sneak then
|
||||||
|
mcl_entity_invs.show_inv_form(self,clicker,"")
|
||||||
|
if not no_sneak then return end
|
||||||
|
end
|
||||||
if old_rc then return old_rc(self,clicker) end
|
if old_rc then return old_rc(self,clicker) end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -678,7 +678,7 @@ register_minecart(
|
||||||
"mcl_minecarts_minecart_chest.png",
|
"mcl_minecarts_minecart_chest.png",
|
||||||
{"mcl_minecarts:minecart", "mcl_chests:chest"},
|
{"mcl_minecarts:minecart", "mcl_chests:chest"},
|
||||||
nil, nil, true)
|
nil, nil, true)
|
||||||
mcl_entity_invs.register_inv("mcl_minecarts:chest_minecart","Minecart",27)
|
mcl_entity_invs.register_inv("mcl_minecarts:chest_minecart","Minecart",27,false,true)
|
||||||
|
|
||||||
-- Minecart with Furnace
|
-- Minecart with Furnace
|
||||||
register_minecart(
|
register_minecart(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user