diff options
author | orwell96 <mono96.mml@gmail.com> | 2016-06-09 21:59:06 +0200 |
---|---|---|
committer | orwell96 <mono96.mml@gmail.com> | 2016-06-09 21:59:06 +0200 |
commit | f9a7fa68b176f499375e1b6cbffcf5f2c52317e1 (patch) | |
tree | b16435b16f52a93fd21e58288b252626dc3d6e81 | |
parent | 77de1965f95924ffc9086786bcb22ec02d9a8e19 (diff) | |
download | advtrains-f9a7fa68b176f499375e1b6cbffcf5f2c52317e1.tar.gz advtrains-f9a7fa68b176f499375e1b6cbffcf5f2c52317e1.tar.bz2 advtrains-f9a7fa68b176f499375e1b6cbffcf5f2c52317e1.zip |
remove horizontal view offset on engine and try to fix damage when sitting in train
-rw-r--r-- | damage.lua | 5 | ||||
-rw-r--r-- | wagons.lua | 4 |
2 files changed, 7 insertions, 2 deletions
@@ -1,5 +1,8 @@ --damage.lua --a globalstep that damages players overrolled by trains. + +advtrains.player_to_wagon_mapping={} + local tmr=0 minetest.register_globalstep(function(dtime) tmr=tmr-dtime @@ -10,7 +13,7 @@ minetest.register_globalstep(function(dtime) for _, object in pairs(minetest.get_objects_inside_radius(pos, 1)) do local le=object:get_luaentity() if le and le.is_wagon and le.initialized and le:train() then - if le.driver~=player and math.abs(le:train().velocity)>2 then + if (not advtrains.player_to_wagon_mapping[player:get_player_name()] or le.train_id~=advtrains.player_to_wagon_mapping[player:get_player_name()].train_id) 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) end @@ -37,12 +37,14 @@ function wagon:on_rightclick(clicker) return
end
if self.driver and clicker == self.driver then
+ advtrains.player_to_wagon_mapping[self.driver:get_player_name()]=nil
advtrains.set_trainhud(self.driver:get_player_name(), "")
self.driver = nil
clicker:set_detach()
clicker:set_eye_offset({x=0,y=0,z=0}, {x=0,y=0,z=0})
elseif not self.driver then
self.driver = clicker
+ advtrains.player_to_wagon_mapping[clicker:get_player_name()]=self
clicker:set_attach(self.object, "", self.attach_offset, {x=0,y=0,z=0})
clicker:set_eye_offset(self.view_offset, self.view_offset)
end
@@ -355,7 +357,7 @@ advtrains.register_wagon("newlocomotive", "steam",{ textures = {"advtrains_newlocomotive.png"},
is_locomotive=true,
attach_offset={x=5, y=10, z=-10},
- view_offset={x=0, y=6, z=18},
+ view_offset={x=0, y=6, z=0},
visual_size = {x=1, y=1},
wagon_span=1.85,
collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
|