diff options
author | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2017-01-29 12:37:47 +0100 |
---|---|---|
committer | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2017-01-29 12:37:47 +0100 |
commit | 5f01cd2d5a1df2071579f4dcae0b83c65bc3111e (patch) | |
tree | 9c9f428025de570abf5dabba8a41a629b06a2f2c /advtrains | |
parent | 724b03abb983eb93c124cef6039bcf2ea4125335 (diff) | |
download | advtrains-5f01cd2d5a1df2071579f4dcae0b83c65bc3111e.tar.gz advtrains-5f01cd2d5a1df2071579f4dcae0b83c65bc3111e.tar.bz2 advtrains-5f01cd2d5a1df2071579f4dcae0b83c65bc3111e.zip |
Added getting on and off by walking in and out. Default seat on subway is now passenger seat.
Diffstat (limited to 'advtrains')
-rw-r--r-- | advtrains/advtrains/damage.lua | 4 | ||||
-rw-r--r-- | advtrains/advtrains/wagons.lua | 10 | ||||
-rw-r--r-- | advtrains/advtrains_train_subway/init.lua | 4 |
3 files changed, 14 insertions, 4 deletions
diff --git a/advtrains/advtrains/damage.lua b/advtrains/advtrains/damage.lua index b39fe67..e05d00d 100644 --- a/advtrains/advtrains/damage.lua +++ b/advtrains/advtrains/damage.lua @@ -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 diff --git a/advtrains/advtrains/wagons.lua b/advtrains/advtrains/wagons.lua index 9d63ab5..163dc73 100644 --- a/advtrains/advtrains/wagons.lua +++ b/advtrains/advtrains/wagons.lua @@ -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
diff --git a/advtrains/advtrains_train_subway/init.lua b/advtrains/advtrains_train_subway/init.lua index 5625418..1282ec7 100644 --- a/advtrains/advtrains_train_subway/init.lua +++ b/advtrains/advtrains_train_subway/init.lua @@ -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) |