aboutsummaryrefslogtreecommitdiff
path: root/damage.lua
diff options
context:
space:
mode:
authorGabriel Pérez-Cerezo <gabriel@gpcf.eu>2016-12-17 12:30:29 +0100
committerGabriel Pérez-Cerezo <gabriel@gpcf.eu>2016-12-17 12:30:29 +0100
commit2f799655facc799b8073355ece91f3c82f223b63 (patch)
tree1956d217d415afc2d330c46d7463d1a7f3260d11 /damage.lua
parent072ca535bf638e474bb6f04e40b809077e6b0b8b (diff)
parent05ce694decc0653997f45fa4f9a24b40057dbd01 (diff)
downloadadvtrains-2f799655facc799b8073355ece91f3c82f223b63.tar.gz
advtrains-2f799655facc799b8073355ece91f3c82f223b63.tar.bz2
advtrains-2f799655facc799b8073355ece91f3c82f223b63.zip
Merge branch 'master' of https://github.com/orwell96/advtrains
Diffstat (limited to 'damage.lua')
-rw-r--r--damage.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/damage.lua b/damage.lua
index 3fc1d97..b39fe67 100644
--- a/damage.lua
+++ b/damage.lua
@@ -1,7 +1,7 @@
--damage.lua
--a globalstep that damages players overrolled by trains.
-advtrains.player_to_wagon_mapping={}
+advtrains.player_to_train_mapping={}
local tmr=0
minetest.register_globalstep(function(dtime)
@@ -13,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 (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
+ 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)
end