aboutsummaryrefslogtreecommitdiff
path: root/damage.lua
diff options
context:
space:
mode:
authororwell96 <mono96.mml@gmail.com>2016-06-09 21:59:06 +0200
committerorwell96 <mono96.mml@gmail.com>2016-06-09 21:59:06 +0200
commitf9a7fa68b176f499375e1b6cbffcf5f2c52317e1 (patch)
treeb16435b16f52a93fd21e58288b252626dc3d6e81 /damage.lua
parent77de1965f95924ffc9086786bcb22ec02d9a8e19 (diff)
downloadadvtrains-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
Diffstat (limited to 'damage.lua')
-rw-r--r--damage.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/damage.lua b/damage.lua
index 860feaa..3fc1d97 100644
--- a/damage.lua
+++ b/damage.lua
@@ -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