do not register wagons in the advtrains namespace automatically
One step towards advcarts compatibility
This commit is contained in:
parent
409e2125c9
commit
2d4833b5a8
|
@ -6,8 +6,11 @@ All boolean values in definition tables default to 'false' and can be omitted.
|
|||
Wagons are registered using the function
|
||||
|
||||
advtrains.register_wagon(name, prototype, description, inventory_image)
|
||||
- 'name' is the internal name of the wagon. It is registered inside the 'advtrains:' namespace.
|
||||
- 'name' is the internal name of the wagon. It should follow the mod naming convention, however, this is not enforced.
|
||||
For compatibility reasons, if a mod name is omitted, the wagon will be registered in the advtrains: namespace.
|
||||
Example: A wagon with name="engine_tgv" will be registered as "advtrains:engine_tgv".
|
||||
!IMPORTANT! You must not append a ":" at the start of the name, even if you want to bypass the mod naming convention check. This is because internally the register_wagon function
|
||||
appends a ":" automatically.
|
||||
- 'prototype' is the lua entity prototype. The regular definition keys for luaentites apply. Additional required and optional properties see below. DO NOT define 'on_step', 'on_activate', 'on_punch', 'on_rightclick' and 'get_staticdata' since these will be overridden. Use 'custom_*' instead.
|
||||
- 'description' is the description of the inventory item that is used to place the wagon.
|
||||
- 'inventory_image' is the inventory image of said item.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,10 +1,3 @@
|
|||
advtrains.register_tracks("regular", {
|
||||
nodename_prefix="advtrains:track",
|
||||
texture_prefix="advtrains_track",
|
||||
shared_model="trackplane.b3d",
|
||||
description=attrans("Deprecated Track"),
|
||||
formats={vst1={}, vst2={}},
|
||||
}, advtrains.ap.t_45deg)
|
||||
|
||||
--flat
|
||||
advtrains.register_tracks("default", {
|
||||
|
|
Loading…
Reference in New Issue