You can test it yourself by hosting a temporary server on your PC.untiltoday wrote:The idea was born when I didn't know that you can't move inside a wagon. So it was more about a crowd inside a wagon; at least I was wondering about how it looks to ride a train with another player.
I'm not sure.untiltoday wrote:Is it possible to implement walking inside a wagon at all?
Trains are entities (objects), not nodes.untiltoday wrote:Apparently being in a wagon is currently done by Minetest through the attachment of the player node to a train node? Does a wagon consist of only one node, or is it multiple nodes? If it's the latter, then the wagon's properties could include also the inner area, and the player could move between the nodes inside that area... Although, if you can only attach a node to the middle of another node, without any offset, the movement would be discrete.
untiltoday wrote:A bigger problem, in my opinion, is that players would be more likely to forget not to punch the wagon.
Code: Select all
function wagon:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
return advtrains.pcall(function()
if not self:ensure_init() then return end
local data = advtrains.wagons[self.id]
if not puncher or not puncher:is_player() then
return
end
if data.owner and puncher:get_player_name()~=data.owner and (not minetest.check_player_privs(puncher, {train_admin = true })) then
minetest.chat_send_player(puncher:get_player_name(), attrans("This wagon is owned by @1, you can't destroy it.", data.owner));
return
end
if #(self:train().trainparts)>1 then
minetest.chat_send_player(puncher:get_player_name(), attrans("Wagon needs to be decoupled from other wagons in order to destroy it."));
return
end
local pc=puncher:get_player_control()
if not pc.sneak then
minetest.chat_send_player(puncher:get_player_name(), attrans("Warning: If you destroy this wagon, you only get some steel back! If you are sure, hold Sneak and left-click the wagon."))
return
end
if self.custom_may_destroy then
if not self.custom_may_destroy(self, puncher, time_from_last_punch, tool_capabilities, direction) then
return
end
end
if not self:destroy() then return end
local inv = puncher:get_inventory()
for _,item in ipairs(self.drops or {self.name}) do
inv:add_item("main", item)
end
end)
end