Added getting on and off by walking in and out. Default seat on subway is now passenger seat.

This commit is contained in:
Gabriel Pérez-Cerezo 2017-01-29 12:37:47 +01:00
parent 724b03abb9
commit 5f01cd2d5a
No known key found for this signature in database
GPG Key ID: 90422B01A46D0B3E
3 changed files with 14 additions and 4 deletions

View File

@ -15,7 +15,9 @@ minetest.register_globalstep(function(dtime)
if le and le.is_wagon and le.initialized and le:train() then
if (not advtrains.player_to_train_mapping[player:get_player_name()] or le.train_id~=advtrains.player_to_train_mapping[player:get_player_name()]) and math.abs(le:train().velocity)>2 then
--player:punch(object, 1000, {damage={fleshy=3*math.abs(le:train().velocity)}})
player:set_hp(player:get_hp()-math.abs(le:train().velocity)-3)
player:set_hp(player:get_hp()-math.abs(le:train().velocity)-3)
elseif (not advtrains.player_to_train_mapping[player:get_player_name()] or le.train_id~=advtrains.player_to_train_mapping[player:get_player_name()]) and le:train().door_open~=0 then
le:on_rightclick(player)
end
end
end

View File

@ -257,6 +257,14 @@ function wagon:on_step(dtime)
advtrains.update_driver_hud(driver:get_player_name(), self:train(), self.wagon_flipped)
end
end
else
local pass = self.seatp[seatno] and minetest.get_player_by_name(self.seatp[seatno])
if pass and self:train().door_open~=0 then
local pc=pass:get_player_control()
if pc.up or pc.down then
self:get_off(seatno)
end
end
end
end
@ -744,7 +752,7 @@ function advtrains.register_wagon(sysname, prototype, desc, inv_img)
return
end
local node=minetest.get_node_or_nil(pointed_thing.under)
if not node then atprint("[advtrains]Ignore at placer position") return itemstack end
local nodename=node.name

View File

@ -55,7 +55,7 @@ advtrains.register_wagon("subway_wagon", {
require_doors_open=true,
},
},
assign_to_seat_group = {"dstand", "pass"},
assign_to_seat_group = {"pass","dstand"},
doors={
open={
[-1]={frames={x=0, y=20}, time=1},
@ -68,7 +68,7 @@ advtrains.register_wagon("subway_wagon", {
},
visual_size = {x=1, y=1},
wagon_span=2,
collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
collisionbox = {-1.0,-0.5,-1.8, 1.0,2.5,1.8},
is_locomotive=true,
drops={"default:steelblock 4"},
--custom_on_activate = function(self, dtime_s)