diff options
-rw-r--r-- | couple.lua | 7 | ||||
-rw-r--r-- | damage.lua | 5 | ||||
-rw-r--r-- | textures/advtrains_track_cr.png | bin | 0 -> 33370 bytes | |||
-rw-r--r-- | textures/advtrains_track_cr_45.png | bin | 0 -> 33938 bytes | |||
-rw-r--r-- | textures/advtrains_track_placer.png | bin | 0 -> 32349 bytes | |||
-rw-r--r-- | textures/advtrains_track_st.png | bin | 0 -> 20405 bytes | |||
-rw-r--r-- | textures/advtrains_track_st_45.png | bin | 0 -> 39977 bytes | |||
-rw-r--r-- | textures/advtrains_track_swl_cr.png | bin | 0 -> 33378 bytes | |||
-rw-r--r-- | textures/advtrains_track_swl_cr_45.png | bin | 0 -> 45772 bytes | |||
-rw-r--r-- | textures/advtrains_track_swl_st.png | bin | 0 -> 32321 bytes | |||
-rw-r--r-- | textures/advtrains_track_swl_st_45.png | bin | 0 -> 46408 bytes | |||
-rw-r--r-- | textures/advtrains_track_swr_cr.png | bin | 0 -> 33670 bytes | |||
-rw-r--r-- | textures/advtrains_track_swr_cr_45.png | bin | 0 -> 46865 bytes | |||
-rw-r--r-- | textures/advtrains_track_swr_st.png | bin | 0 -> 32654 bytes | |||
-rw-r--r-- | textures/advtrains_track_swr_st_45.png | bin | 0 -> 47636 bytes | |||
-rw-r--r-- | textures/advtrains_track_vert1.png (renamed from textures/track_vert1.png) | bin | 1777 -> 1777 bytes | |||
-rw-r--r-- | textures/advtrains_track_vert2.png (renamed from textures/track_vert2.png) | bin | 2012 -> 2012 bytes | |||
-rw-r--r-- | textures/larger rails.png | bin | 0 -> 81337 bytes | |||
-rw-r--r-- | textures/larger rails.xcf | bin | 0 -> 1239132 bytes | |||
-rw-r--r-- | textures/nope/track_curve.png | bin | 527 -> 0 bytes | |||
-rw-r--r-- | textures/nope/track_curve_45.png | bin | 552 -> 0 bytes | |||
-rw-r--r-- | textures/nope/track_std.png | bin | 414 -> 0 bytes | |||
-rw-r--r-- | textures/nope/track_std_45.png | bin | 1378 -> 0 bytes | |||
-rw-r--r-- | textures/nope/track_switch_l.png | bin | 526 -> 0 bytes | |||
-rw-r--r-- | textures/nope/track_switch_l_45.png | bin | 1133 -> 0 bytes | |||
-rw-r--r-- | textures/nope/track_switch_r.png | bin | 491 -> 0 bytes | |||
-rw-r--r-- | textures/nope/track_switch_r_45.png | bin | 1140 -> 0 bytes | |||
-rw-r--r-- | textures_gravelback/advtrains_track_cr.png | bin | 0 -> 84648 bytes | |||
-rw-r--r-- | textures_gravelback/advtrains_track_cr_45.png | bin | 0 -> 85734 bytes | |||
-rw-r--r-- | textures_gravelback/advtrains_track_st.png | bin | 0 -> 67368 bytes | |||
-rw-r--r-- | textures_gravelback/advtrains_track_st_45.png | bin | 0 -> 88782 bytes | |||
-rw-r--r-- | textures_gravelback/advtrains_track_swl_cr.png | bin | 0 -> 83089 bytes | |||
-rw-r--r-- | textures_gravelback/advtrains_track_swl_cr_45.png | bin | 0 -> 90284 bytes | |||
-rw-r--r-- | textures_gravelback/advtrains_track_swl_st.png | bin | 0 -> 82548 bytes | |||
-rw-r--r-- | textures_gravelback/advtrains_track_swl_st_45.png | bin | 0 -> 90485 bytes | |||
-rw-r--r-- | textures_gravelback/advtrains_track_swr_cr.png | bin | 0 -> 84070 bytes | |||
-rw-r--r-- | textures_gravelback/advtrains_track_swr_cr_45.png | bin | 0 -> 90410 bytes | |||
-rw-r--r-- | textures_gravelback/advtrains_track_swr_st.png | bin | 0 -> 83421 bytes | |||
-rw-r--r-- | textures_gravelback/advtrains_track_swr_st_45.png | bin | 0 -> 90641 bytes | |||
-rw-r--r-- | textures_old/track_cr.png (renamed from textures/track_cr.png) | bin | 1933 -> 1933 bytes | |||
-rw-r--r-- | textures_old/track_cr_45.png (renamed from textures/track_cr_45.png) | bin | 1945 -> 1945 bytes | |||
-rw-r--r-- | textures_old/track_curve_45.xcf (renamed from textures/track_curve_45.xcf) | bin | 13824 -> 13824 bytes | |||
-rw-r--r-- | textures_old/track_placer.png (renamed from textures/track_placer.png) | bin | 621 -> 621 bytes | |||
-rw-r--r-- | textures_old/track_st.png (renamed from textures/track_st.png) | bin | 621 -> 621 bytes | |||
-rw-r--r-- | textures_old/track_st_45.png (renamed from textures/track_st_45.png) | bin | 2549 -> 2549 bytes | |||
-rw-r--r-- | textures_old/track_swl_cr.png (renamed from textures/track_swl_cr.png) | bin | 1868 -> 1868 bytes | |||
-rw-r--r-- | textures_old/track_swl_cr_45.png (renamed from textures/track_swl_cr_45.png) | bin | 2512 -> 2512 bytes | |||
-rw-r--r-- | textures_old/track_swl_st.png (renamed from textures/track_swl_st.png) | bin | 1892 -> 1892 bytes | |||
-rw-r--r-- | textures_old/track_swl_st_45.png (renamed from textures/track_swl_st_45.png) | bin | 2509 -> 2509 bytes | |||
-rw-r--r-- | textures_old/track_swr_cr.png (renamed from textures/track_swr_cr.png) | bin | 1897 -> 1897 bytes | |||
-rw-r--r-- | textures_old/track_swr_cr_45.png (renamed from textures/track_swr_cr_45.png) | bin | 2528 -> 2528 bytes | |||
-rw-r--r-- | textures_old/track_swr_st.png (renamed from textures/track_swr_st.png) | bin | 1912 -> 1912 bytes | |||
-rw-r--r-- | textures_old/track_swr_st_45.png (renamed from textures/track_swr_st_45.png) | bin | 2485 -> 2485 bytes | |||
-rw-r--r-- | tracks.lua | 2 | ||||
-rw-r--r-- | trainlogic.lua | 4 | ||||
-rw-r--r-- | wagons.lua | 58 |
56 files changed, 52 insertions, 24 deletions
@@ -36,10 +36,15 @@ minetest.register_entity("advtrains:discouple", { if not self.wagon then self.object:remove() end + --getyaw seems to be a reliable method to check if an object is loaded...if it returns nil, it is not. + if not self.wagon.object:getyaw() then + self.object:remove() + end local velocityvec=self.wagon.object:getvelocity() self.updatepct_timer=(self.updatepct_timer or 0)-dtime if not self.old_velocity_vector or not vector.equals(velocityvec, self.old_velocity_vector) or self.updatepct_timer<=0 then--only send update packet if something changed - self.object:setpos(vector.add(self.wagon.object:getpos(), {y=0, x=-math.sin(self.wagon.object:getyaw())*self.wagon.wagon_span, z=math.cos(self.wagon.object:getyaw())*self.wagon.wagon_span})) + local flipsign=self.wagon.wagon_flipped and -1 or 1 + self.object:setpos(vector.add(self.wagon.object:getpos(), {y=0, x=-math.sin(self.wagon.object:getyaw())*self.wagon.wagon_span*flipsign, z=math.cos(self.wagon.object:getyaw())*self.wagon.wagon_span*flipsign})) self.object:setvelocity(velocityvec) self.updatepct_timer=2 end @@ -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 diff --git a/textures/advtrains_track_cr.png b/textures/advtrains_track_cr.png Binary files differnew file mode 100644 index 0000000..40f0cc5 --- /dev/null +++ b/textures/advtrains_track_cr.png diff --git a/textures/advtrains_track_cr_45.png b/textures/advtrains_track_cr_45.png Binary files differnew file mode 100644 index 0000000..54966b3 --- /dev/null +++ b/textures/advtrains_track_cr_45.png diff --git a/textures/advtrains_track_placer.png b/textures/advtrains_track_placer.png Binary files differnew file mode 100644 index 0000000..03e17ed --- /dev/null +++ b/textures/advtrains_track_placer.png diff --git a/textures/advtrains_track_st.png b/textures/advtrains_track_st.png Binary files differnew file mode 100644 index 0000000..5ad7e4f --- /dev/null +++ b/textures/advtrains_track_st.png diff --git a/textures/advtrains_track_st_45.png b/textures/advtrains_track_st_45.png Binary files differnew file mode 100644 index 0000000..63b4c96 --- /dev/null +++ b/textures/advtrains_track_st_45.png diff --git a/textures/advtrains_track_swl_cr.png b/textures/advtrains_track_swl_cr.png Binary files differnew file mode 100644 index 0000000..d9b5c0b --- /dev/null +++ b/textures/advtrains_track_swl_cr.png diff --git a/textures/advtrains_track_swl_cr_45.png b/textures/advtrains_track_swl_cr_45.png Binary files differnew file mode 100644 index 0000000..f098fc9 --- /dev/null +++ b/textures/advtrains_track_swl_cr_45.png diff --git a/textures/advtrains_track_swl_st.png b/textures/advtrains_track_swl_st.png Binary files differnew file mode 100644 index 0000000..314bd2d --- /dev/null +++ b/textures/advtrains_track_swl_st.png diff --git a/textures/advtrains_track_swl_st_45.png b/textures/advtrains_track_swl_st_45.png Binary files differnew file mode 100644 index 0000000..765d0ec --- /dev/null +++ b/textures/advtrains_track_swl_st_45.png diff --git a/textures/advtrains_track_swr_cr.png b/textures/advtrains_track_swr_cr.png Binary files differnew file mode 100644 index 0000000..f74e1bc --- /dev/null +++ b/textures/advtrains_track_swr_cr.png diff --git a/textures/advtrains_track_swr_cr_45.png b/textures/advtrains_track_swr_cr_45.png Binary files differnew file mode 100644 index 0000000..fa432aa --- /dev/null +++ b/textures/advtrains_track_swr_cr_45.png diff --git a/textures/advtrains_track_swr_st.png b/textures/advtrains_track_swr_st.png Binary files differnew file mode 100644 index 0000000..06ea29e --- /dev/null +++ b/textures/advtrains_track_swr_st.png diff --git a/textures/advtrains_track_swr_st_45.png b/textures/advtrains_track_swr_st_45.png Binary files differnew file mode 100644 index 0000000..be477b7 --- /dev/null +++ b/textures/advtrains_track_swr_st_45.png diff --git a/textures/track_vert1.png b/textures/advtrains_track_vert1.png Binary files differindex ce7c31d..ce7c31d 100644 --- a/textures/track_vert1.png +++ b/textures/advtrains_track_vert1.png diff --git a/textures/track_vert2.png b/textures/advtrains_track_vert2.png Binary files differindex 7bc7bae..7bc7bae 100644 --- a/textures/track_vert2.png +++ b/textures/advtrains_track_vert2.png diff --git a/textures/larger rails.png b/textures/larger rails.png Binary files differnew file mode 100644 index 0000000..c6c4b7f --- /dev/null +++ b/textures/larger rails.png diff --git a/textures/larger rails.xcf b/textures/larger rails.xcf Binary files differnew file mode 100644 index 0000000..42ae592 --- /dev/null +++ b/textures/larger rails.xcf diff --git a/textures/nope/track_curve.png b/textures/nope/track_curve.png Binary files differdeleted file mode 100644 index 02bcf5c..0000000 --- a/textures/nope/track_curve.png +++ /dev/null diff --git a/textures/nope/track_curve_45.png b/textures/nope/track_curve_45.png Binary files differdeleted file mode 100644 index c69be2d..0000000 --- a/textures/nope/track_curve_45.png +++ /dev/null diff --git a/textures/nope/track_std.png b/textures/nope/track_std.png Binary files differdeleted file mode 100644 index 061949e..0000000 --- a/textures/nope/track_std.png +++ /dev/null diff --git a/textures/nope/track_std_45.png b/textures/nope/track_std_45.png Binary files differdeleted file mode 100644 index 89a1b36..0000000 --- a/textures/nope/track_std_45.png +++ /dev/null diff --git a/textures/nope/track_switch_l.png b/textures/nope/track_switch_l.png Binary files differdeleted file mode 100644 index 33ac21e..0000000 --- a/textures/nope/track_switch_l.png +++ /dev/null diff --git a/textures/nope/track_switch_l_45.png b/textures/nope/track_switch_l_45.png Binary files differdeleted file mode 100644 index d55da42..0000000 --- a/textures/nope/track_switch_l_45.png +++ /dev/null diff --git a/textures/nope/track_switch_r.png b/textures/nope/track_switch_r.png Binary files differdeleted file mode 100644 index bf2e722..0000000 --- a/textures/nope/track_switch_r.png +++ /dev/null diff --git a/textures/nope/track_switch_r_45.png b/textures/nope/track_switch_r_45.png Binary files differdeleted file mode 100644 index 5be48fd..0000000 --- a/textures/nope/track_switch_r_45.png +++ /dev/null diff --git a/textures_gravelback/advtrains_track_cr.png b/textures_gravelback/advtrains_track_cr.png Binary files differnew file mode 100644 index 0000000..a21b970 --- /dev/null +++ b/textures_gravelback/advtrains_track_cr.png diff --git a/textures_gravelback/advtrains_track_cr_45.png b/textures_gravelback/advtrains_track_cr_45.png Binary files differnew file mode 100644 index 0000000..b30a8ca --- /dev/null +++ b/textures_gravelback/advtrains_track_cr_45.png diff --git a/textures_gravelback/advtrains_track_st.png b/textures_gravelback/advtrains_track_st.png Binary files differnew file mode 100644 index 0000000..ac94158 --- /dev/null +++ b/textures_gravelback/advtrains_track_st.png diff --git a/textures_gravelback/advtrains_track_st_45.png b/textures_gravelback/advtrains_track_st_45.png Binary files differnew file mode 100644 index 0000000..e541853 --- /dev/null +++ b/textures_gravelback/advtrains_track_st_45.png diff --git a/textures_gravelback/advtrains_track_swl_cr.png b/textures_gravelback/advtrains_track_swl_cr.png Binary files differnew file mode 100644 index 0000000..769b92d --- /dev/null +++ b/textures_gravelback/advtrains_track_swl_cr.png diff --git a/textures_gravelback/advtrains_track_swl_cr_45.png b/textures_gravelback/advtrains_track_swl_cr_45.png Binary files differnew file mode 100644 index 0000000..6ff8b4b --- /dev/null +++ b/textures_gravelback/advtrains_track_swl_cr_45.png diff --git a/textures_gravelback/advtrains_track_swl_st.png b/textures_gravelback/advtrains_track_swl_st.png Binary files differnew file mode 100644 index 0000000..e4d5a0c --- /dev/null +++ b/textures_gravelback/advtrains_track_swl_st.png diff --git a/textures_gravelback/advtrains_track_swl_st_45.png b/textures_gravelback/advtrains_track_swl_st_45.png Binary files differnew file mode 100644 index 0000000..2dba2f6 --- /dev/null +++ b/textures_gravelback/advtrains_track_swl_st_45.png diff --git a/textures_gravelback/advtrains_track_swr_cr.png b/textures_gravelback/advtrains_track_swr_cr.png Binary files differnew file mode 100644 index 0000000..e13bd2e --- /dev/null +++ b/textures_gravelback/advtrains_track_swr_cr.png diff --git a/textures_gravelback/advtrains_track_swr_cr_45.png b/textures_gravelback/advtrains_track_swr_cr_45.png Binary files differnew file mode 100644 index 0000000..e0b36ff --- /dev/null +++ b/textures_gravelback/advtrains_track_swr_cr_45.png diff --git a/textures_gravelback/advtrains_track_swr_st.png b/textures_gravelback/advtrains_track_swr_st.png Binary files differnew file mode 100644 index 0000000..52d272d --- /dev/null +++ b/textures_gravelback/advtrains_track_swr_st.png diff --git a/textures_gravelback/advtrains_track_swr_st_45.png b/textures_gravelback/advtrains_track_swr_st_45.png Binary files differnew file mode 100644 index 0000000..b81df2c --- /dev/null +++ b/textures_gravelback/advtrains_track_swr_st_45.png diff --git a/textures/track_cr.png b/textures_old/track_cr.png Binary files differindex 54ddf79..54ddf79 100644 --- a/textures/track_cr.png +++ b/textures_old/track_cr.png diff --git a/textures/track_cr_45.png b/textures_old/track_cr_45.png Binary files differindex ad4580e..ad4580e 100644 --- a/textures/track_cr_45.png +++ b/textures_old/track_cr_45.png diff --git a/textures/track_curve_45.xcf b/textures_old/track_curve_45.xcf Binary files differindex 0e6c26e..0e6c26e 100644 --- a/textures/track_curve_45.xcf +++ b/textures_old/track_curve_45.xcf diff --git a/textures/track_placer.png b/textures_old/track_placer.png Binary files differindex afed4ce..afed4ce 100644 --- a/textures/track_placer.png +++ b/textures_old/track_placer.png diff --git a/textures/track_st.png b/textures_old/track_st.png Binary files differindex afed4ce..afed4ce 100644 --- a/textures/track_st.png +++ b/textures_old/track_st.png diff --git a/textures/track_st_45.png b/textures_old/track_st_45.png Binary files differindex e3ce89f..e3ce89f 100644 --- a/textures/track_st_45.png +++ b/textures_old/track_st_45.png diff --git a/textures/track_swl_cr.png b/textures_old/track_swl_cr.png Binary files differindex 602d727..602d727 100644 --- a/textures/track_swl_cr.png +++ b/textures_old/track_swl_cr.png diff --git a/textures/track_swl_cr_45.png b/textures_old/track_swl_cr_45.png Binary files differindex f3b741a..f3b741a 100644 --- a/textures/track_swl_cr_45.png +++ b/textures_old/track_swl_cr_45.png diff --git a/textures/track_swl_st.png b/textures_old/track_swl_st.png Binary files differindex b12a9ac..b12a9ac 100644 --- a/textures/track_swl_st.png +++ b/textures_old/track_swl_st.png diff --git a/textures/track_swl_st_45.png b/textures_old/track_swl_st_45.png Binary files differindex cf80d77..cf80d77 100644 --- a/textures/track_swl_st_45.png +++ b/textures_old/track_swl_st_45.png diff --git a/textures/track_swr_cr.png b/textures_old/track_swr_cr.png Binary files differindex 92a09bd..92a09bd 100644 --- a/textures/track_swr_cr.png +++ b/textures_old/track_swr_cr.png diff --git a/textures/track_swr_cr_45.png b/textures_old/track_swr_cr_45.png Binary files differindex f127e30..f127e30 100644 --- a/textures/track_swr_cr_45.png +++ b/textures_old/track_swr_cr_45.png diff --git a/textures/track_swr_st.png b/textures_old/track_swr_st.png Binary files differindex 7d014fc..7d014fc 100644 --- a/textures/track_swr_st.png +++ b/textures_old/track_swr_st.png diff --git a/textures/track_swr_st_45.png b/textures_old/track_swr_st_45.png Binary files differindex 5d7764a..5d7764a 100644 --- a/textures/track_swr_st_45.png +++ b/textures_old/track_swr_st_45.png @@ -122,7 +122,7 @@ end advtrains.register_tracks("regular", {
nodename_prefix="advtrains:track",
- texture_prefix="track",
+ texture_prefix="advtrains_track",
description="Regular Train Track",
})
diff --git a/trainlogic.lua b/trainlogic.lua index f7a9363..7d7fe9f 100644 --- a/trainlogic.lua +++ b/trainlogic.lua @@ -81,6 +81,10 @@ advtrains.save = function() else data.driver_name=nil end + if data.discouple then + data.discouple.object:remove() + data.discouple=nil + end end --print(dump(advtrains.wagon_save)) datastr = minetest.serialize(advtrains.wagon_save) @@ -37,12 +37,15 @@ 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
+ self.driver_name = 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
@@ -127,7 +130,7 @@ function wagon:on_punch(puncher, time_from_last_punch, tool_capabilities, direct table.remove(self:train().trainparts, self.pos_in_trainparts)
advtrains.update_trainpart_properties(self.train_id)
advtrains.wagon_save[self.unique_id]=nil
- if self.discouple_id and minetest.object_refs[self.discouple_id] then minetest.object_refs[self.discouple_id]:remove() end
+ if self.discouple then self.discouple.object:remove() end--will have no effect on unloaded objects
return
@@ -156,25 +159,14 @@ function wagon:on_step(dtime) self.initialized=true
end
- --DisCouple
- if self.pos_in_trainparts and self.pos_in_trainparts>1 then
- if not self.discouple_id or not minetest.luaentities[self.discouple_id] then
- local object=minetest.add_entity(pos, "advtrains:discouple")
- if object then
- print("spawning discouple")
- local le=object:get_luaentity()
- le.wagon=self
- --box is hidden when attached, so unuseful.
- --object:set_attach(self.object, "", {x=0, y=0, z=self.wagon_span*10}, {x=0, y=0, z=0})
- --find in object_refs
- for aoi, compare in pairs(minetest.object_refs) do
- if compare==object then
- self.discouple_id=aoi
- end
- end
- else
- print("Couldn't spawn DisCouple")
- end
+ --re-attach driver if he got lost
+ if not self.driver and self.driver_name then
+ local clicker=minetest.get_player_by_name(self.driver_name)
+ if clicker 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
end
@@ -190,10 +182,12 @@ function wagon:on_step(dtime) self:train().tarvelocity=math.max(self:train().tarvelocity-1, -(advtrains.all_traintypes[self:train().traintype].max_speed or 10))
elseif pc.aux1 then --slower
if true or math.abs(self:train().velocity)<=3 then--TODO debug
+ advtrains.player_to_wagon_mapping[self.driver:get_player_name()]=nil
self.driver:set_detach()
self.driver:set_eye_offset({x=0,y=0,z=0}, {x=0,y=0,z=0})
advtrains.set_trainhud(self.driver:get_player_name(), "")
self.driver = nil
+ self.driver_name = nil
return--(don't let it crash because of statement below)
else
minetest.chat_send_player(self.driver:get_player_name(), "Can't get off driving train!")
@@ -205,6 +199,28 @@ function wagon:on_step(dtime) end
local gp=self:train()
+
+ --DisCouple
+ if self.pos_in_trainparts and self.pos_in_trainparts>1 then
+ if gp.velocity==0 then
+ if not self.discouple or not self.discouple.object:getyaw() then
+ local object=minetest.add_entity(pos, "advtrains:discouple")
+ if object then
+ local le=object:get_luaentity()
+ le.wagon=self
+ --box is hidden when attached, so unuseful.
+ --object:set_attach(self.object, "", {x=0, y=0, z=self.wagon_span*10}, {x=0, y=0, z=0})
+ self.discouple=le
+ else
+ print("Couldn't spawn DisCouple")
+ end
+ end
+ else
+ if self.discouple and self.discouple.object:getyaw() then
+ self.discouple.object:remove()
+ end
+ end
+ end
--for path to be available. if not, skip step
if not advtrains.get_or_create_path(self.train_id, gp) then
self.object:setvelocity({x=0, y=0, z=0})
@@ -349,7 +365,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},
|