diff options
author | orwell96 <orwell@bleipb.de> | 2017-11-22 22:16:08 +0100 |
---|---|---|
committer | orwell96 <orwell@bleipb.de> | 2017-11-22 22:16:08 +0100 |
commit | 2d4833b5a8d3555c257cbeb5928c32eb36caa473 (patch) | |
tree | aa132f846740281892e063cb35782549cdc356ab /advtrains/wagons.lua | |
parent | 409e2125c9d6ee72090c92dc94c54d0560a80c5d (diff) | |
download | advtrains-2d4833b5a8d3555c257cbeb5928c32eb36caa473.tar.gz advtrains-2d4833b5a8d3555c257cbeb5928c32eb36caa473.tar.bz2 advtrains-2d4833b5a8d3555c257cbeb5928c32eb36caa473.zip |
do not register wagons in the advtrains namespace automatically
One step towards advcarts compatibility
Diffstat (limited to 'advtrains/wagons.lua')
-rw-r--r-- | advtrains/wagons.lua | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/advtrains/wagons.lua b/advtrains/wagons.lua index 3e8641e..efebba8 100644 --- a/advtrains/wagons.lua +++ b/advtrains/wagons.lua @@ -857,11 +857,15 @@ function wagon:reattach_all() end
end
-function advtrains.register_wagon(sysname, prototype, desc, inv_img)
+function advtrains.register_wagon(sysname_p, prototype, desc, inv_img)
+ local sysname = sysname_p
+ if not string.match(sysname, ":") then
+ sysname = "advtrains:"..sysname_p
+ end
setmetatable(prototype, {__index=wagon})
- minetest.register_entity(":advtrains:"..sysname,prototype)
+ minetest.register_entity(":"..sysname,prototype)
- minetest.register_craftitem(":advtrains:"..sysname, {
+ minetest.register_craftitem(":"..sysname, {
description = desc,
inventory_image = inv_img,
wield_image = inv_img,
@@ -888,7 +892,7 @@ function advtrains.register_wagon(sysname, prototype, desc, inv_img) local conn1=advtrains.get_track_connections(node.name, node.param2)
local id=advtrains.create_new_train_at(pointed_thing.under, advtrains.dirCoordSet(pointed_thing.under, conn1))
- local ob=minetest.add_entity(pointed_thing.under, "advtrains:"..sysname)
+ local ob=minetest.add_entity(pointed_thing.under, sysname)
if not ob then
atprint("couldn't add_entity, aborting")
end
|