1
0
Fork 0

Merge pull request 'Some entity inv / boat fixes' (#2788) from entinv_fixes into master

Reviewed-on: MineClone2/MineClone2#2788
Reviewed-by: epCode <epcode@noreply.git.minetest.land>
This commit is contained in:
epCode 2022-10-14 23:05:04 +00:00
commit cdbcae4b59
3 changed files with 20 additions and 7 deletions

View File

@ -65,9 +65,13 @@ local function set_double_attach(boat)
boat._passenger:set_attach(boat.object, "",
{x = 0, y = 0.42, z = -2.2}, {x = 0, y = 0, z = 0})
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)
if self._driver then
if self._driver and not self._inv_id then
if self._driver:is_player() then
self._passenger = obj
else
@ -77,8 +81,12 @@ local function attach_object(self, obj)
set_double_attach(self)
else
self._driver = obj
if self._inv_id then
set_choat_attach(self)
else
set_attach(self)
end
end
local visual_size = get_visual_size(obj)
local yaw = self.object:get_yaw()
@ -123,8 +131,8 @@ local boat = {
pointable = true,
-- Warning: Do not change the position of the collisionbox top surface,
-- 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},
selectionbox = {-0.7, -0.35, -0.7, 0.7, 0.3, 0.7},
collisionbox = {-0.5, -0.15, -0.5, 0.5, 0.55, 0.5},
selectionbox = {-0.7, -0.15, -0.7, 0.7, 0.55, 0.7},
visual = "mesh",
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"},
@ -417,6 +425,8 @@ local cboat = table.copy(boat)
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._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)
mcl_entity_invs.register_inv("mcl_boats:chest_boat","Boat",27)

View File

@ -102,7 +102,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
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))
minetest.registered_entities[entity_name]._inv_size = size
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
local old_rc = minetest.registered_entities[entity_name].on_rightclick
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
end
end

View File

@ -678,7 +678,7 @@ register_minecart(
"mcl_minecarts_minecart_chest.png",
{"mcl_minecarts:minecart", "mcl_chests:chest"},
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
register_minecart(