123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758 |
- local S = dlxtrains_industrial_wagons.S
- local use_attachment_patch = advtrains_attachment_offset_patch and advtrains_attachment_offset_patch.setup_advtrains_wagon
- local mod_name = "dlxtrains_industrial_wagons"
- local crate_texture_count = dlxtrains_industrial_wagons.crate_texture_count
- local shipping_container_livery_count = dlxtrains_industrial_wagons.shipping_container_livery_count
- local tank_container_livery_count = dlxtrains_industrial_wagons.tank_container_livery_count
- dlxtrains.register_mod(mod_name)
- local livery_scheme_industrial_wagon_container_type1 = {
- filename_prefix = "dlxtrains_industrial_wagons_container_type1",
- [0]={code="dlx"},
- [1]={code="dz"},
- [2]={code="wf"},
- [3]={code="t"},
- [4]={code="zr"},
- count = 5,
- }
- local livery_scheme_industrial_wagon_container_type2 = {
- filename_prefix = "dlxtrains_industrial_wagons_container_type2",
- [0]={code="dlx"},
- [1]={code="dz"},
- [2]={code="wf"},
- [3]={code="t"},
- [4]={code="zr"},
- count = 5,
- }
- local livery_scheme_industrial_wagon_covered_goods_type1 = {
- filename_prefix = "dlxtrains_industrial_wagons_covered_goods_type1",
- [0]={code="nr"},
- [1]={code="tt"},
- [2]={code="dlx"},
- [3]={code="t"},
- count = 4,
- }
- local livery_scheme_industrial_wagon_covered_goods_type2 = {
- filename_prefix = "dlxtrains_industrial_wagons_covered_goods_type2",
- [0]={code="vr"},
- [1]={code="ar"},
- [2]={code="at"},
- [3]={code="t"},
- count = 4,
- }
- local livery_scheme_industrial_wagon_covered_goods_type3 = {
- filename_prefix = "dlxtrains_industrial_wagons_covered_goods_type3",
- [0]={code="dz"},
- [1]={code="t"},
- [2]={code="wf"},
- [3]={code="zr"},
- count = 4,
- }
- local livery_scheme_industrial_wagon_flat_type1 = {
- filename_prefix = "dlxtrains_industrial_wagons_flat_type1",
- [0]={code="zr"},
- [1]={code="t"},
- [2]={code="dz"},
- [3]={code="wf"},
- count = 4,
- }
- local livery_scheme_industrial_wagon_flat_type2 = {
- filename_prefix = "dlxtrains_industrial_wagons_flat_type2",
- [0]={code="ar"},
- [1]={code="at"},
- [2]={code="t"},
- [3]={code="vr"},
- count = 4,
- }
- local livery_scheme_industrial_wagon_hopper_type1 = {
- filename_prefix = "dlxtrains_industrial_wagons_hopper_type1",
- [0]={code="dlx"},
- [1]={code="t"},
- [2]={code="tt"},
- [3]={code="nr"},
- count = 4,
- }
- local livery_scheme_industrial_wagon_hopper_type2 = {
- filename_prefix = "dlxtrains_industrial_wagons_hopper_type2",
- [0]={code="dlx"},
- [1]={code="t"},
- [2]={code="tt"},
- [3]={code="nr"},
- count = 4,
- }
- local livery_scheme_industrial_wagon_livestock_type1 = {
- filename_prefix = "dlxtrains_industrial_wagons_livestock_type1",
- [0]={code="ar"},
- [1]={code="at"},
- [2]={code="t"},
- [3]={code="vr"},
- count = 4,
- }
- local livery_scheme_industrial_wagon_open_type1 = {
- filename_prefix = "dlxtrains_industrial_wagons_open_type1",
- [0]={code="ar"},
- [1]={code="at"},
- [2]={code="t"},
- [3]={code="vr"},
- count = 4,
- }
- local livery_scheme_industrial_wagon_stake_type1 = {
- filename_prefix = "dlxtrains_industrial_wagons_stake_type1",
- [0]={code="t"},
- [1]={code="dz"},
- [2]={code="wf"},
- [3]={code="zr"},
- count = 4,
- }
- local livery_scheme_industrial_wagon_tank_type1 = {
- filename_prefix = "dlxtrains_industrial_wagons_tank_type1",
- [0]={code="dz"},
- [1]={code="t"},
- [2]={code="wf"},
- [3]={code="zr"},
- count = 4,
- }
- local livery_scheme_industrial_wagon_tank_type2 = {
- filename_prefix = "dlxtrains_industrial_wagons_tank_type2",
- [0]={code="dz"},
- [1]={code="t"},
- [2]={code="wf"},
- [3]={code="zr"},
- count = 4,
- }
- local livery_scheme_industrial_wagon_transition_type1 = {
- filename_prefix = "dlxtrains_industrial_wagons_transition_type1",
- [0]={code="dlx"},
- [1]={code="t"},
- count = 2,
- }
- local livery_templates = {
- ["dlxtrains_industrial_wagons:container_type1"] = {
- dlxtrains.init_livery_template(mod_name, 0, dlxtrains.livery_type.standard, "DL&X", "container_type1_dlx"),
- dlxtrains.init_livery_template(mod_name, 1, dlxtrains.livery_type.standard, "DZ", "container_type1_dz"),
- dlxtrains.init_livery_template(mod_name, 2, dlxtrains.livery_type.standard, "WF", "container_type1_wf"),
- dlxtrains.init_livery_template(mod_name, 3, dlxtrains.livery_type.standard, "T", "container_type1_t"),
- dlxtrains.init_livery_template(mod_name, 4, dlxtrains.livery_type.standard, "ZR", "container_type1_zr"),
- },
- ["dlxtrains_industrial_wagons:container_type2"] = {
- dlxtrains.init_livery_template(mod_name, 0, dlxtrains.livery_type.standard, "DL&X", "container_type2_dlx"),
- dlxtrains.init_livery_template(mod_name, 1, dlxtrains.livery_type.standard, "DZ", "container_type2_dz"),
- dlxtrains.init_livery_template(mod_name, 2, dlxtrains.livery_type.standard, "WF", "container_type2_wf"),
- dlxtrains.init_livery_template(mod_name, 3, dlxtrains.livery_type.standard, "T", "container_type2_t"),
- dlxtrains.init_livery_template(mod_name, 4, dlxtrains.livery_type.standard, "ZR", "container_type2_zr"),
- },
- ["dlxtrains_industrial_wagons:covered_goods_type1"] = {
- dlxtrains.init_livery_template(mod_name, 0, dlxtrains.livery_type.early_era, "NR", "covered_goods_type1_nr"),
- dlxtrains.init_livery_template(mod_name, 1, dlxtrains.livery_type.early_era, "TT", "covered_goods_type1_tt"),
- dlxtrains.init_livery_template(mod_name, 2, dlxtrains.livery_type.early_era, "DL&X", "covered_goods_type1_dlx"),
- dlxtrains.init_livery_template(mod_name, 3, dlxtrains.livery_type.early_era, "T", "covered_goods_type1_t"),
- },
- ["dlxtrains_industrial_wagons:covered_goods_type2"] = {
- dlxtrains.init_livery_template(mod_name, 0, dlxtrains.livery_type.middle_era, "VR", "covered_goods_type2_vr"),
- dlxtrains.init_livery_template(mod_name, 1, dlxtrains.livery_type.middle_era, "AR", "covered_goods_type2_ar"),
- dlxtrains.init_livery_template(mod_name, 2, dlxtrains.livery_type.middle_era, "AT", "covered_goods_type2_at"),
- dlxtrains.init_livery_template(mod_name, 3, dlxtrains.livery_type.standard, "T", "covered_goods_type2_t"),
- },
- ["dlxtrains_industrial_wagons:covered_goods_type3"] = {
- dlxtrains.init_livery_template(mod_name, 0, dlxtrains.livery_type.middle_era, "DZ", "covered_goods_type3_dz"),
- dlxtrains.init_livery_template(mod_name, 1, dlxtrains.livery_type.middle_era, "T", "covered_goods_type3_t"),
- dlxtrains.init_livery_template(mod_name, 2, dlxtrains.livery_type.early_era, "WF", "covered_goods_type3_wf"),
- dlxtrains.init_livery_template(mod_name, 3, dlxtrains.livery_type.middle_era, "ZR", "covered_goods_type3_zr"),
- },
- ["dlxtrains_industrial_wagons:flat_type1"] = {
- dlxtrains.init_livery_template(mod_name, 0, dlxtrains.livery_type.standard, "ZR", "flat_type1_zr"),
- dlxtrains.init_livery_template(mod_name, 1, dlxtrains.livery_type.standard, "T", "flat_type1_t"),
- dlxtrains.init_livery_template(mod_name, 2, dlxtrains.livery_type.standard, "DZ", "flat_type1_dz"),
- dlxtrains.init_livery_template(mod_name, 3, dlxtrains.livery_type.standard, "WF", "flat_type1_wf"),
- },
- ["dlxtrains_industrial_wagons:flat_type2"] = {
- dlxtrains.init_livery_template(mod_name, 0, dlxtrains.livery_type.middle_era, "AR", "flat_type2_ar"),
- dlxtrains.init_livery_template(mod_name, 1, dlxtrains.livery_type.middle_era, "AT", "flat_type2_at"),
- dlxtrains.init_livery_template(mod_name, 2, dlxtrains.livery_type.standard, "T", "flat_type2_t"),
- dlxtrains.init_livery_template(mod_name, 3, dlxtrains.livery_type.middle_era, "VR", "flat_type2_vr"),
- },
- ["dlxtrains_industrial_wagons:hopper_type1"] = {
- dlxtrains.init_livery_template(mod_name, 0, dlxtrains.livery_type.standard, "DL&X", "hopper_type1_dlx"),
- dlxtrains.init_livery_template(mod_name, 1, dlxtrains.livery_type.standard, "T", "hopper_type1_t"),
- dlxtrains.init_livery_template(mod_name, 2, dlxtrains.livery_type.middle_era, "TT", "hopper_type1_tt"),
- dlxtrains.init_livery_template(mod_name, 3, dlxtrains.livery_type.middle_era, "NR", "hopper_type1_nr"),
- },
- ["dlxtrains_industrial_wagons:hopper_type2"] = {
- dlxtrains.init_livery_template(mod_name, 0, dlxtrains.livery_type.standard, "DL&X", "hopper_type2_dlx"),
- dlxtrains.init_livery_template(mod_name, 1, dlxtrains.livery_type.standard, "T", "hopper_type2_t"),
- dlxtrains.init_livery_template(mod_name, 2, dlxtrains.livery_type.standard, "TT", "hopper_type2_tt"),
- dlxtrains.init_livery_template(mod_name, 3, dlxtrains.livery_type.middle_era, "NR", "hopper_type2_nr"),
- },
- ["dlxtrains_industrial_wagons:livestock_type1"] = {
- dlxtrains.init_livery_template(mod_name, 0, dlxtrains.livery_type.middle_era, "AR", "livestock_type1_ar"),
- dlxtrains.init_livery_template(mod_name, 1, dlxtrains.livery_type.middle_era, "AT", "livestock_type1_at"),
- dlxtrains.init_livery_template(mod_name, 2, dlxtrains.livery_type.standard, "T", "livestock_type1_t"),
- dlxtrains.init_livery_template(mod_name, 3, dlxtrains.livery_type.middle_era, "VR", "livestock_type1_vr"),
- },
- ["dlxtrains_industrial_wagons:open_type1"] = {
- dlxtrains.init_livery_template(mod_name, 0, dlxtrains.livery_type.middle_era, "AR", "open_type1_ar"),
- dlxtrains.init_livery_template(mod_name, 1, dlxtrains.livery_type.middle_era, "AT", "open_type1_at"),
- dlxtrains.init_livery_template(mod_name, 2, dlxtrains.livery_type.standard, "T", "open_type1_t"),
- dlxtrains.init_livery_template(mod_name, 3, dlxtrains.livery_type.middle_era, "VR", "open_type1_vr"),
- },
- ["dlxtrains_industrial_wagons:stake_type1"] = {
- dlxtrains.init_livery_template(mod_name, 0, dlxtrains.livery_type.standard, "T", "stake_type1_t"),
- dlxtrains.init_livery_template(mod_name, 1, dlxtrains.livery_type.standard, "DZ", "stake_type1_dz"),
- dlxtrains.init_livery_template(mod_name, 2, dlxtrains.livery_type.standard, "WF", "stake_type1_wf"),
- dlxtrains.init_livery_template(mod_name, 3, dlxtrains.livery_type.standard, "ZR", "stake_type1_zr"),
- },
- ["dlxtrains_industrial_wagons:tank_type1"] = {
- dlxtrains.init_livery_template(mod_name, 0, dlxtrains.livery_type.early_era, "DZ", "tank_type1_dz"),
- dlxtrains.init_livery_template(mod_name, 1, dlxtrains.livery_type.early_era, "T", "tank_type1_t"),
- dlxtrains.init_livery_template(mod_name, 2, dlxtrains.livery_type.early_era, "WF", "tank_type1_wf"),
- dlxtrains.init_livery_template(mod_name, 3, dlxtrains.livery_type.early_era, "ZR", "tank_type1_zr"),
- },
- ["dlxtrains_industrial_wagons:tank_type2"] = {
- dlxtrains.init_livery_template(mod_name, 0, dlxtrains.livery_type.early_era, "DZ", "tank_type2_dz"),
- dlxtrains.init_livery_template(mod_name, 1, dlxtrains.livery_type.early_era, "T", "tank_type2_t"),
- dlxtrains.init_livery_template(mod_name, 2, dlxtrains.livery_type.early_era, "WF", "tank_type2_wf"),
- dlxtrains.init_livery_template(mod_name, 3, dlxtrains.livery_type.early_era, "ZR", "tank_type2_zr"),
- },
- ["dlxtrains_industrial_wagons:transition_type1"] = {
- dlxtrains.init_livery_template(mod_name, 0, dlxtrains.livery_type.standard, "DL&X", "transition_type1_dlx"),
- dlxtrains.init_livery_template(mod_name, 1, dlxtrains.livery_type.standard, "T", "transition_type1_t"),
- },
- }
- local function is_filled_bucket(stack)
- local stack_name = stack:get_name()
- if minetest.get_modpath("default") then
-
- for bucket, def in pairs(bucket.liquids) do
- if def.itemname == stack_name then
- return true
- end
- end
- end
- if minetest.get_modpath("mcl_buckets") then
-
- for bucket, def in pairs(mcl_buckets.liquids) do
- if def.bucketname == stack_name then
- return true
- end
- end
- if stack_name == "mcl_mobitems:milk_bucket" then
- return true
- end
- end
- return false
- end
- local stackable_liquid_proxies = {}
- local function register_stackable_liquid_proxy(src_mod_name, item_name)
- if src_mod_name ~= nil and item_name ~= nil then
- if minetest.get_modpath(src_mod_name) then
- table.insert(stackable_liquid_proxies, item_name)
- end
- end
- end
- local technic_cans = {}
- if minetest.get_modpath("technic") then
- if technic.cans ~= nil then
-
-
-
- for _, def in pairs(technic.cans) do
- technic_cans[def.can_name] = true
- end
- else
-
-
-
- technic_cans["technic:water_can"] = true
- technic_cans["technic:lava_can"] = true
- technic_cans["technic:river_water_can"] = true
- end
- end
- register_stackable_liquid_proxy("basic_materials", "basic_materials:oil_extract")
- register_stackable_liquid_proxy("biofuel", "biofuel:phial_fuel")
- register_stackable_liquid_proxy("biofuel", "biofuel:bottle_fuel")
- register_stackable_liquid_proxy("biofuel", "biofuel:fuel_can")
- register_stackable_liquid_proxy("farming", "farming:bottle_ethanol")
- register_stackable_liquid_proxy("farming", "farming:hemp_oil")
- register_stackable_liquid_proxy("pipeworks", "homedecor:oil_extract")
- register_stackable_liquid_proxy("technic", "technic:cottonseed_oil")
- register_stackable_liquid_proxy("technic", "technic:lox")
- if minetest.get_modpath("techage") then
-
-
-
-
-
-
- register_stackable_liquid_proxy("techage", "techage:bitumen")
- register_stackable_liquid_proxy("techage", "techage:epoxy")
- register_stackable_liquid_proxy("techage", "techage:fueloil")
- register_stackable_liquid_proxy("techage", "techage:gasoline")
- register_stackable_liquid_proxy("techage", "techage:lye")
- register_stackable_liquid_proxy("techage", "techage:naphtha")
- register_stackable_liquid_proxy("techage", "techage:redmud")
-
- register_stackable_liquid_proxy("techage", "techage:hydrogen")
- register_stackable_liquid_proxy("techage", "techage:isobutane")
- register_stackable_liquid_proxy("techage", "techage:gas")
-
- register_stackable_liquid_proxy("techage", "techage:ta3_barrel_bitumen")
- register_stackable_liquid_proxy("techage", "techage:barrel_epoxy")
- register_stackable_liquid_proxy("techage", "techage:ta3_barrel_fueloil")
- register_stackable_liquid_proxy("techage", "techage:ta3_barrel_gasoline")
- register_stackable_liquid_proxy("techage", "techage:barrel_lye")
- register_stackable_liquid_proxy("techage", "techage:ta3_barrel_naphtha")
- register_stackable_liquid_proxy("techage", "techage:ta3_barrel_oil")
- register_stackable_liquid_proxy("techage", "techage:barrel_redmud")
- register_stackable_liquid_proxy("techage", "techage:barrel_river_water")
- register_stackable_liquid_proxy("techage", "techage:barrel_water")
-
- register_stackable_liquid_proxy("techage", "techage:ta3_canister_bitumen")
- register_stackable_liquid_proxy("techage", "techage:canister_epoxy")
- register_stackable_liquid_proxy("techage", "techage:ta3_canister_fueloil")
- register_stackable_liquid_proxy("techage", "techage:ta3_canister_gasoline")
- register_stackable_liquid_proxy("techage", "techage:canister_lye")
- register_stackable_liquid_proxy("techage", "techage:ta3_canister_naphtha")
- register_stackable_liquid_proxy("techage", "techage:ta3_canister_oil")
- register_stackable_liquid_proxy("techage", "techage:canister_redmud")
-
- register_stackable_liquid_proxy("techage", "techage:cylinder_large_hydrogen")
- register_stackable_liquid_proxy("techage", "techage:ta4_cylinder_large_isobutane")
- register_stackable_liquid_proxy("techage", "techage:ta3_cylinder_large_gas")
-
- register_stackable_liquid_proxy("techage", "techage:cylinder_small_hydrogen")
- register_stackable_liquid_proxy("techage", "techage:ta4_cylinder_small_isobutane")
- register_stackable_liquid_proxy("techage", "techage:ta3_cylinder_small_gas")
- end
- local function is_stackable_liquid_proxy(item_name)
- for _, proxy_name in ipairs(stackable_liquid_proxies) do
- if item_name == proxy_name then
- return true
- end
- end
- return false
- end
- local function get_liquid_count(stack)
-
-
- local liquid_count = 0
- if is_filled_bucket(stack) then
-
- liquid_count = 1
- elseif technic_cans[stack:get_name()] then
-
- liquid_count = tonumber(stack:get_metadata()) or 0
- else
- local item_def = minetest.registered_items[stack:get_name()]
- if item_def then
- if item_def.groups.liquid or is_stackable_liquid_proxy(stack:get_name()) then
-
-
- liquid_count = stack:get_count()
- end
- end
- end
- return liquid_count
- end
- local function is_loose_material(node_def)
- if node_def and node_def.name ~= "" then
- if node_def.groups.soil
- or node_def.groups.sand
- or node_def.name == dlxtrains.materials.gravel
- or node_def.name == dlxtrains.materials.coalblock
- or node_def.name == dlxtrains.materials.permafrost
- or node_def.name == dlxtrains.materials.permafrost_with_stones
- or node_def.name == dlxtrains.materials.cobble then
- return true
- end
- end
- return false
- end
- local function get_crate_texture_index(wagon_id, quantity)
- return (wagon_id + quantity) % crate_texture_count
- end
- local animal_types = {
- ["mobs_animal:cow"] = "cow",
- ["mobs_animal:cow_set"] = "cow",
- ["animalia:spawn_cow"] = "cow",
- ["animalia:cow"] = "cow",
- ["mob_horse:horse"] = "horse",
- ["mob_horse:horse_set"] = "horse",
- ["animalia:spawn_horse"] = "horse",
- ["animalia:horse"] = "horse",
- ["animalia:spawn_pig"] = "pig",
- ["mobs_animal:sheep"] = "sheep",
- ["animalia:spawn_sheep"] = "sheep",
- ["animalia:sheep"] = "sheep",
- ["mobs_animal:pumba"] = "warthog",
- ["mobs_animal:pumba_set"] = "warthog",
- }
- local function get_animal_type(stack)
- local stack_item = stack:get_name()
- if string.sub(stack_item, 1, 17) == "mobs_animal:sheep" then
-
- stack_item = "mobs_animal:sheep"
- elseif stack_item == "animalia:net" or stack_item == "animalia:crate" then
- local meta = stack:get_meta()
- if meta then
- stack_item = meta:get_string("mob") or stack:get_name()
- end
- end
- return animal_types[stack_item]
- end
- local animal_info = {
- ["cow"] = {texture_count = 3, },
- ["horse"] = {texture_count = 5, },
- ["pig"] = {texture_count = 3, },
- ["sheep"] = {texture_count = 4, },
- ["warthog"] = {texture_count = 4, },
- }
- local function get_animal_texture(animal_type, rnd_number, quantity)
- local info = animal_info[animal_type]
- if info then
- local index = 1 + ((rnd_number + quantity) % info.texture_count)
- return dlxtrains.add_modifier_escaping("dlxtrains_industrial_wagons_animals_"..animal_type.."-"..index..".png")
- end
- return ""
- end
- local function play_animal_sound(wagon, wagon_id, cargo_stack)
- local animal_count = cargo_stack:get_count()
- if dlxtrains.wagon_sounds and animal_count > 0 then
- local count = animal_count
- if count > 99 then
- count = 99
- end
-
-
-
-
-
-
- local odds = math.floor(24000 * math.pow(count + 15, -1))
- if math.random(1, odds) == 1 then
- local animal_sounds = dlxtrains_animal_sounds.get_sounds(get_animal_type(cargo_stack))
- if animal_sounds and #animal_sounds > 0 then
-
- local sound_idx = math.random(1, #animal_sounds)
- local animal_sound = animal_sounds[sound_idx]
- local sound_name = animal_sound.name
- local gain = math.random(animal_sound.gain - 10, animal_sound.gain + 10) / 100
- local pitch = math.random(90, 110) / 100
- minetest.sound_play(sound_name, {
- object = wagon,
- gain = gain,
- pitch = pitch,
- })
- end
- end
- end
- end
- local function get_valid_flat_wagon_load_texture(node_def, crate_texture_index)
-
-
-
-
-
-
-
-
-
-
- local texture = "dlxtrains_industrial_wagons_wooden_crate.png"
- if crate_texture_index > 0 and dlxtrains_industrial_wagons.get_crate_texture ~= nil then
- texture = dlxtrains_industrial_wagons.get_crate_texture(crate_texture_index)
- end
- if node_def.drawtype == "normal" and not is_loose_material(node_def) and node_def.tiles then
- if type(node_def.tiles) == "table" and node_def.tiles[1] and not node_def.tiles[3] then
- texture = node_def.tiles[1]
- end
- end
- return dlxtrains.add_modifier_escaping(texture)
- end
- local function get_shipping_container_livery_id(wagon_id, quantity)
- return (wagon_id + quantity) % shipping_container_livery_count
- end
- local function get_shipping_container_texture(livery_id)
- if dlxtrains_industrial_wagons.get_shipping_container_texture ~= nil then
- return dlxtrains_industrial_wagons.get_shipping_container_texture(livery_id)
- end
- return "invalid.png"
- end
- local function get_shipping_container_overlay(livery_id, y)
- local overlay_texture = ""
- if livery_id > 0 then
- overlay_texture = ":0,"..y.."="..get_shipping_container_texture(livery_id).."\\^\\[resize\\:216x32"
- end
- return overlay_texture
- end
- local function get_tank_container_livery_id(wagon_id, quantity)
- return (wagon_id + quantity) % tank_container_livery_count
- end
- local function get_tank_container_texture(livery_id)
- if dlxtrains_industrial_wagons.get_tank_container_texture ~= nil then
- return dlxtrains_industrial_wagons.get_tank_container_texture(livery_id)
- end
- return "invalid.png"
- end
- local function get_default_tank_container_texture(livery_code)
- return "dlxtrains_industrial_wagons_default_tank_container_"..livery_code..".png"
- end
- local function get_tank_container_overlay(livery_id, livery_code, y)
- local overlay_texture = ":0,"..y.."="
- if livery_id > 0 then
-
- overlay_texture = overlay_texture..get_tank_container_texture(livery_id)
- else
-
- overlay_texture = overlay_texture..get_default_tank_container_texture(livery_code)
- end
- overlay_texture = overlay_texture.."\\^\\[resize\\:232x32"
- return overlay_texture
- end
- local function update_model_industrial_wagon_container(wagon, data, texture_file, meshes, livery_code)
- local updated_texture = texture_file
-
- wagon.object:set_properties({
- mesh = meshes.default
- })
- local inv = minetest.get_inventory({type="detached", name="advtrains_wgn_"..data.id})
- if inv and not inv:is_empty("box") then
- local occupied_slots = 1
- local stack1 = inv:get_stack("box", 1)
- local stack17 = inv:get_stack("box", 17)
- if stack1:get_count() > 0 and stack17:get_count() > 0 then
- occupied_slots = 2
- end
- local liquid_count1 = get_liquid_count(stack1)
- local liquid_count17 = get_liquid_count(stack17)
-
- local overlay_y_offset = {[1]=64, [2]=96}
- updated_texture = "[combine:256x256:0,0=("..texture_file..")"
- if liquid_count1 > 0 or (occupied_slots == 1 and liquid_count17 > 0) then
-
- local livery_id = get_tank_container_livery_id(data.id, liquid_count1)
- if occupied_slots == 1 and stack17:get_count() > 0 then
-
- livery_id = get_tank_container_livery_id(data.id, liquid_count17)
- end
- updated_texture = updated_texture..get_tank_container_overlay(livery_id, livery_code, overlay_y_offset[1])
- else
-
- local livery_id = get_shipping_container_livery_id(data.id, stack1:get_count())
- if stack1:get_count() == 0 and stack17:get_count() > 0 then
-
- livery_id = get_shipping_container_livery_id(data.id, stack17:get_count())
- end
- updated_texture = updated_texture..get_shipping_container_overlay(livery_id, overlay_y_offset[1])
- end
- if occupied_slots > 1 then
- if liquid_count17 > 0 then
-
- local livery_id = get_tank_container_livery_id(data.id, liquid_count17)
- updated_texture = updated_texture..get_tank_container_overlay(livery_id, livery_code, overlay_y_offset[2])
- else
-
- local livery_id = get_shipping_container_livery_id(data.id, stack17:get_count())
- updated_texture = updated_texture..get_shipping_container_overlay(livery_id, overlay_y_offset[2])
- end
- end
-
-
-
-
-
-
-
-
-
-
-
- local mesh_with_load = meshes.load_a
- if liquid_count1 > 0 or liquid_count17 > 0 then
- mesh_with_load = meshes.load_b
- end
- if occupied_slots > 1 then
- mesh_with_load = meshes.load_aa
- if liquid_count1 > 0 and liquid_count17 > 0 then
- mesh_with_load = meshes.load_bb
- elseif liquid_count1 > 0 then
- mesh_with_load = meshes.load_ba
- elseif liquid_count17 > 0 then
- mesh_with_load = meshes.load_ab
- end
- end
- wagon.object:set_properties({
- mesh = mesh_with_load
- })
- end
- return updated_texture
- end
- local function update_model_industrial_wagon_flat(wagon, data, texture_file, meshes)
- local updated_texture = texture_file
-
- wagon.object:set_properties({
- mesh = meshes.default
- })
- local inv = minetest.get_inventory({type="detached", name="advtrains_wgn_"..data.id})
- if inv and not inv:is_empty("box") then
-
-
-
-
-
-
-
-
-
- local stack1 = inv:get_stack("box", 1)
- local stack2 = inv:get_stack("box", 9)
- local stack3 = inv:get_stack("box", 17)
- local node_def1 = minetest.registered_nodes[stack1:get_name()]
- local node_def2 = minetest.registered_nodes[stack2:get_name()]
- local node_def3 = minetest.registered_nodes[stack3:get_name()]
- local occupied_slots = 0
- if not stack1:is_empty() then occupied_slots = occupied_slots + 1 end
- if not stack2:is_empty() then occupied_slots = occupied_slots + 1 end
- if not stack3:is_empty() then occupied_slots = occupied_slots + 1 end
- if occupied_slots > 0 then
- updated_texture = "[combine:256x256:0,0=("..texture_file..")"
- if node_def1 then
- updated_texture = updated_texture..":0,112="..get_valid_flat_wagon_load_texture(node_def1,get_crate_texture_index(data.id,stack1:get_count())).."\\^\\[resize\\:16x16"
- end
- if node_def2 then
- local x = 16
- if stack1:is_empty() then x = 0 end
- updated_texture = updated_texture..":"..x..",112="..get_valid_flat_wagon_load_texture(node_def2,get_crate_texture_index(data.id,stack2:get_count())).."\\^\\[resize\\:16x16"
- end
- if node_def3 then
- local x = 32
- if stack1:is_empty() and stack2:is_empty() then
- x = 0
- elseif stack2:is_empty() then
- x = 16
- end
- updated_texture = updated_texture..":"..x..",112="..get_valid_flat_wagon_load_texture(node_def3,get_crate_texture_index(data.id,stack3:get_count())).."\\^\\[resize\\:16x16"
- end
- end
-
- local mesh_with_load = meshes.loaded1
- if occupied_slots == 2 then
- mesh_with_load = meshes.loaded3
- elseif occupied_slots == 3 then
- mesh_with_load = meshes.loaded5
- end
- wagon.object:set_properties({
- mesh = mesh_with_load
- })
- end
- return updated_texture
- end
- local function update_model_industrial_wagon_hopper(wagon, data, texture_file, meshes)
-
- wagon.object:set_properties({
- mesh = meshes.default
- })
- local inv = minetest.get_inventory({type="detached", name="advtrains_wgn_"..data.id})
- if inv and not inv:is_empty("box") then
- local stack = inv:get_stack("box", 1)
- local node_def = minetest.registered_nodes[stack:get_name()]
- local item_def = minetest.registered_items[stack:get_name()]
- if node_def or item_def then
-
-
- wagon.object:set_properties({
- mesh = meshes.loaded
- })
-
-
- local load_node_name = nil
- if is_loose_material(node_def) then
- load_node_name = node_def.name
- elseif item_def then
- if item_def.name == dlxtrains.materials.coal_lump or item_def.name == "technic:coal_dust" then
- load_node_name = dlxtrains.materials.coalblock
- end
- end
- if load_node_name then
- local load_node_def = minetest.registered_nodes[load_node_name]
- if load_node_def then
- if load_node_def.drawtype == "normal" then
- local texture = load_node_def.tiles or "dlxtrains_mixed_material.png"
- if type(texture) == "table" then
- texture = texture[1] or "dlxtrains_mixed_material.png"
- end
- local texture_clause = dlxtrains.add_modifier_escaping(texture).."\\^\\[resize\\:16x16"
- return "[combine:256x256:0,0=("..texture_file..
- "):128,32="..texture_clause..
- ":144,32="..texture_clause..
- ":160,32="..texture_clause..
- ":176,32="..texture_clause..
- ":192,32="..texture_clause..
- ":208,32="..texture_clause..
- ":128,48="..texture_clause..
- ":144,48="..texture_clause..
- ":160,48="..texture_clause..
- ":176,48="..texture_clause..
- ":192,48="..texture_clause..
- ":208,48="..texture_clause
- end
- end
- end
- end
- end
- return texture_file
- end
- local function update_model_industrial_wagon_livestock(wagon, data, texture_file, meshes)
- local updated_texture = texture_file
-
- wagon.object:set_properties({
- mesh = meshes.default
- })
- local inv = minetest.get_inventory({type="detached", name="advtrains_wgn_"..data.id})
- if inv and not inv:is_empty("box") then
- local stack = inv:get_stack("box", 1)
- updated_texture = "[combine:256x256:0,0=("..texture_file..")"
-
-
-
-
- local mesh_with_load = meshes.loaded
- local animal_type = get_animal_type(stack)
- if animal_type then
- local pseudo_rnd_1 = data.id
- local pseudo_rnd_2 = math.floor(data.id/10)
- local stack_count = stack:get_count()
- updated_texture = updated_texture..":0,96="..get_animal_texture(animal_type, pseudo_rnd_1, stack_count).."\\^\\[resize\\:32x32"
- updated_texture = updated_texture..":32,96="..get_animal_texture(animal_type, pseudo_rnd_2, stack_count).."\\^\\[resize\\:32x32"
- mesh_with_load = meshes.animal_load[animal_type]
- else
- local node_def = minetest.registered_nodes[stack:get_name()]
- if node_def ~= nil then
- local x = 16
- updated_texture = updated_texture..":"..x..",112="..get_valid_flat_wagon_load_texture(node_def, get_crate_texture_index(data.id, stack:get_count())).."\\^\\[resize\\:16x16"
- end
- end
- wagon.object:set_properties({
- mesh = mesh_with_load
- })
- end
- return updated_texture
- end
- local function update_model_industrial_wagon_open(wagon, data, texture_file, meshes)
-
- wagon.object:set_properties({
- mesh = meshes.default
- })
- local inv = minetest.get_inventory({type="detached", name="advtrains_wgn_"..data.id})
- if inv and not inv:is_empty("box") then
- local stack = inv:get_stack("box", 1)
- local node_def = minetest.registered_nodes[stack:get_name()]
- local item_def = minetest.registered_items[stack:get_name()]
- if node_def or item_def then
- wagon.object:set_properties({
- mesh = meshes.loaded
- })
-
-
- local load_node_name = nil
- if is_loose_material(node_def) then
- load_node_name = node_def.name
- elseif item_def then
- if item_def.name == dlxtrains.materials.coal_lump or item_def.name == "technic:coal_dust" then
- load_node_name = dlxtrains.materials.coalblock
- end
- end
- if load_node_name then
-
- local load_node_def = minetest.registered_nodes[load_node_name]
- if load_node_def then
- if load_node_def.drawtype == "normal" then
- local texture = load_node_def.tiles or "dlxtrains_mixed_material.png"
- if type(texture) == "table" then
- texture = texture[1] or "dlxtrains_mixed_material.png"
- end
- local texture_clause = dlxtrains.add_modifier_escaping(texture).."\\^\\[resize\\:16x16"
- return "[combine:256x256:0,0=("..texture_file..
- "):80,112="..texture_clause..
- ":96,112="..texture_clause..
- ":112,112="..texture_clause..
- ":128,112="..texture_clause..
- ":144,112="..texture_clause..
- ":160,112="..texture_clause..
- ":80,128="..texture_clause..
- ":96,128="..texture_clause..
- ":112,128="..texture_clause..
- ":128,128="..texture_clause..
- ":144,128="..texture_clause..
- ":160,128="..texture_clause
- end
- end
- else
-
-
-
- if item_def and item_def.type == "craft" and meshes.covered then
- wagon.object:set_properties({
- mesh = meshes.covered
- })
- return texture_file
- end
-
- if node_def and node_def.groups.tree and meshes.log_load then
- wagon.object:set_properties({
- mesh = meshes.log_load
- })
- local tree_side = "default_tree_top.png"
- local tree_end = "default_tree.png"
- if type(node_def.tiles) == "table" and node_def.tiles[1] and node_def.tiles[3] then
- tree_end = node_def.tiles[1]
- tree_side = node_def.tiles[3]
- end
- local tree_end_texture = dlxtrains.add_modifier_escaping(tree_end).."\\^\\[resize\\:16x16"
- local tree_side_texture = dlxtrains.add_modifier_escaping(tree_side).."\\^\\[resize\\:16x16"
- return "[combine:256x256:0,0=("..texture_file.."):48,112="..tree_end_texture..":64,112="..tree_side_texture
- end
-
- return update_model_industrial_wagon_flat(wagon, data, texture_file, meshes)
- end
- end
- end
- return texture_file
- end
- local function update_model_industrial_wagon_stake(wagon, data, texture_file, meshes)
- local updated_texture = texture_file
-
- wagon.object:set_properties({
- mesh = meshes.default
- })
- local inv = minetest.get_inventory({type="detached", name="advtrains_wgn_"..data.id})
- if inv and not inv:is_empty("box") then
- local stack = inv:get_stack("box", 1)
- local node_def = minetest.registered_nodes[stack:get_name()]
-
- if not node_def or not node_def.groups.tree then
- return update_model_industrial_wagon_flat(wagon, data, texture_file, meshes)
- end
- if meshes.log_load then
- wagon.object:set_properties({
- mesh = meshes.log_load
- })
- local tree_side = "default_tree_top.png"
- local tree_end = "default_tree.png"
- if type(node_def.tiles) == "table" and node_def.tiles[1] and node_def.tiles[3] then
- tree_end = node_def.tiles[1]
- tree_side = node_def.tiles[3]
- end
- local tree_end_texture = dlxtrains.add_modifier_escaping(tree_end).."\\^\\[resize\\:16x16"
- local tree_side_texture = dlxtrains.add_modifier_escaping(tree_side).."\\^\\[resize\\:16x16"
- return "[combine:256x256:0,0=("..texture_file.."):48,112="..tree_end_texture..":64,112="..tree_side_texture
- end
- end
- return updated_texture
- end
- local function get_wagon_proprties_button_spec(wagon_id, pname, x, y)
- local button_spec = ""
- if advtrains.wagons[wagon_id].owner == pname then
- button_spec = "button_exit["..x..","..y..";4,1;prop;"..S("Wagon properties").."]"
- end
- return button_spec
- end
- local meshes_industrial_wagon_container_type1 = {
- default = "dlxtrains_industrial_wagons_container_type1.b3d",
- load_a = "dlxtrains_industrial_wagons_container_type1_a.b3d",
- load_aa = "dlxtrains_industrial_wagons_container_type1_aa.b3d",
- load_ab = "dlxtrains_industrial_wagons_container_type1_ab.b3d",
- load_b = "dlxtrains_industrial_wagons_container_type1_b.b3d",
- load_ba = "dlxtrains_industrial_wagons_container_type1_ba.b3d",
- load_bb = "dlxtrains_industrial_wagons_container_type1_bb.b3d",
- update_model = function(wagon, data, texture_file, meshes)
- return update_model_industrial_wagon_container(wagon, data, texture_file, meshes, livery_scheme_industrial_wagon_container_type1[data.scheme_id or 0].code)
- end,
- }
- local meshes_industrial_wagon_container_type2 = {
- default = "dlxtrains_industrial_wagons_container_type2.b3d",
- load_a = "dlxtrains_industrial_wagons_container_type2_a.b3d",
- load_b = "dlxtrains_industrial_wagons_container_type2_b.b3d",
- update_model = function(wagon, data, texture_file, meshes)
- return update_model_industrial_wagon_container(wagon, data, texture_file, meshes, livery_scheme_industrial_wagon_container_type2[data.scheme_id or 0].code)
- end,
- }
- local meshes_industrial_wagon_covered_goods_type1 = {
- default = "dlxtrains_industrial_wagons_covered_goods_type1.obj",
- }
- local meshes_industrial_wagon_covered_goods_type2 = {
- default = "dlxtrains_industrial_wagons_covered_goods_type2.obj",
- }
- local meshes_industrial_wagon_covered_goods_type3 = {
- default = "dlxtrains_industrial_wagons_covered_goods_type3.obj",
- }
- local meshes_industrial_wagon_flat_type1 = {
- default = "dlxtrains_industrial_wagons_flat_type1.obj",
- loaded1 = "dlxtrains_industrial_wagons_flat_type1_loaded1.obj",
- loaded3 = "dlxtrains_industrial_wagons_flat_type1_loaded3.obj",
- loaded5 = "dlxtrains_industrial_wagons_flat_type1_loaded5.obj",
- update_model = function(wagon, data, texture_file, meshes)
- return update_model_industrial_wagon_flat(wagon, data, texture_file, meshes)
- end,
- }
- local meshes_industrial_wagon_flat_type2 = {
- default = "dlxtrains_industrial_wagons_flat_type2.b3d",
- loaded1 = "dlxtrains_industrial_wagons_flat_type2_loaded1.b3d",
- loaded3 = "dlxtrains_industrial_wagons_flat_type2_loaded3.b3d",
- loaded5 = "dlxtrains_industrial_wagons_flat_type2_loaded5.b3d",
- update_model = function(wagon, data, texture_file, meshes)
- return update_model_industrial_wagon_flat(wagon, data, texture_file, meshes)
- end,
- }
- local meshes_industrial_wagon_hopper_type1 = {
- default = "dlxtrains_industrial_wagons_hopper_type1.obj",
- loaded = "dlxtrains_industrial_wagons_hopper_type1_loaded.obj",
- update_model = function(wagon, data, texture_file, meshes)
- return update_model_industrial_wagon_hopper(wagon, data, texture_file, meshes)
- end,
- }
- local meshes_industrial_wagon_hopper_type2 = {
- default = "dlxtrains_industrial_wagons_hopper_type2.obj",
- }
- local meshes_industrial_wagon_livestock_type1 = {
- default = "dlxtrains_industrial_wagons_livestock_type1.b3d",
- loaded = "dlxtrains_industrial_wagons_livestock_type1_loaded.b3d",
- animal_load = {
- ["cow"] = "dlxtrains_industrial_wagons_livestock_type1_cows.b3d",
- ["horse"] = "dlxtrains_industrial_wagons_livestock_type1_horses.b3d",
- ["pig"] = "dlxtrains_industrial_wagons_livestock_type1_pigs.b3d",
- ["sheep"] = "dlxtrains_industrial_wagons_livestock_type1_sheep.b3d",
- ["warthog"] = "dlxtrains_industrial_wagons_livestock_type1_warthogs.b3d",
- },
- update_model = function(wagon, data, texture_file, meshes)
- return update_model_industrial_wagon_livestock(wagon, data, texture_file, meshes)
- end,
- }
- local meshes_industrial_wagon_open_type1 = {
- default = "dlxtrains_industrial_wagons_open_type1.b3d",
- loaded = "dlxtrains_industrial_wagons_open_type1_loaded.b3d",
- loaded1 = "dlxtrains_industrial_wagons_open_type1_loaded1.b3d",
- loaded3 = "dlxtrains_industrial_wagons_open_type1_loaded3.b3d",
- loaded5 = "dlxtrains_industrial_wagons_open_type1_loaded5.b3d",
- covered = "dlxtrains_industrial_wagons_open_type1_covered.b3d",
- log_load = "dlxtrains_industrial_wagons_open_type1_logs.b3d",
- update_model = function(wagon, data, texture_file, meshes)
- return update_model_industrial_wagon_open(wagon, data, texture_file, meshes)
- end,
- }
- local meshes_industrial_wagon_stake_type1 = {
- default = "dlxtrains_industrial_wagons_stake_type1.obj",
- loaded1 = "dlxtrains_industrial_wagons_stake_type1_loaded1.obj",
- loaded3 = "dlxtrains_industrial_wagons_stake_type1_loaded3.obj",
- loaded5 = "dlxtrains_industrial_wagons_stake_type1_loaded5.obj",
- log_load = "dlxtrains_industrial_wagons_stake_type1_logs.obj",
- update_model = function(wagon, data, texture_file, meshes)
- return update_model_industrial_wagon_stake(wagon, data, texture_file, meshes)
- end,
- }
- local meshes_industrial_wagon_tank_type1 = {
- default = "dlxtrains_industrial_wagons_tank_type1.b3d",
- }
- local meshes_industrial_wagon_tank_type2 = {
- default = "dlxtrains_industrial_wagons_tank_type2.b3d",
- }
- local meshes_industrial_wagon_transition_type1 = {
- default = "dlxtrains_industrial_wagons_transition_type1.obj",
- loaded1 = "dlxtrains_industrial_wagons_transition_type1_loaded1.obj",
- loaded3 = "dlxtrains_industrial_wagons_transition_type1_loaded3.obj",
- loaded5 = "dlxtrains_industrial_wagons_transition_type1_loaded5.obj",
- update_model = function(wagon, data, texture_file, meshes)
- return update_model_industrial_wagon_flat(wagon, data, texture_file, meshes)
- end,
- }
- if dlxtrains_industrial_wagons.max_wagon_length >= 8.5 then
- local wagon_type = "dlxtrains_industrial_wagons:container_type1"
- dlxtrains.register_livery_templates(wagon_type, mod_name, livery_templates)
- advtrains.register_wagon(wagon_type, {
- mesh = meshes_industrial_wagon_container_type1.default,
- textures = {dlxtrains.get_init_texture()},
- set_textures = function(wagon, data)
- dlxtrains.set_textures_for_livery_scheme(wagon, data, livery_scheme_industrial_wagon_container_type1, meshes_industrial_wagon_container_type1)
- end,
- custom_may_destroy = function(wagon, puncher, time_from_last_punch, tool_capabilities, direction)
- return not dlxtrains.update_livery(wagon, puncher, livery_scheme_industrial_wagon_container_type1)
- end,
- seats = {},
- drives_on={default=true},
- max_speed=20,
- visual_size = {x=1, y=1},
- wagon_span=4.25,
- wheel_positions = {2.6875, -2.6875},
- collisionbox = {-1.0,-0.5,-1.0,1.0,2.5,1.0},
- coupler_types_front = {chain=true},
- coupler_types_back = {chain=true},
- drops={dlxtrains.materials.steelblock},
- has_inventory = true,
- get_inventory_formspec = function(wagon, pname, invname)
- return "size[8,9]"..
- "box[0,0;.8,.88;#077]"..
- "box[0,2;.8,.88;#077]"..
- "list["..invname..";box;0,0;8,4;]"..
- "list[current_player;main;0,5;8,4;]"..
- "listring[]"..
- get_wagon_proprties_button_spec(wagon.id, pname, 2, 4)
- end,
- inventory_list_sizes = {
- box=8*4,
- },
- }, S("European Container Wagon"), "dlxtrains_industrial_wagons_container_type1_inv.png")
- end
- if dlxtrains_industrial_wagons.max_wagon_length >= 4.875 then
- local wagon_type = "dlxtrains_industrial_wagons:container_type2"
- dlxtrains.register_livery_templates(wagon_type, mod_name, livery_templates)
- advtrains.register_wagon(wagon_type, {
- mesh = meshes_industrial_wagon_container_type2.default,
- textures = {dlxtrains.get_init_texture()},
- set_textures = function(wagon, data)
- dlxtrains.set_textures_for_livery_scheme(wagon, data, livery_scheme_industrial_wagon_container_type2, meshes_industrial_wagon_container_type2)
- end,
- custom_may_destroy = function(wagon, puncher, time_from_last_punch, tool_capabilities, direction)
- return not dlxtrains.update_livery(wagon, puncher, livery_scheme_industrial_wagon_container_type2)
- end,
- seats = {},
- drives_on={default=true},
- max_speed=20,
- visual_size = {x=1, y=1},
- wagon_span=2.4375,
- wheel_positions = {1.5, -1.5},
- collisionbox = {-1.0,-0.5,-1.0,1.0,2.5,1.0},
- coupler_types_front = {chain=true},
- coupler_types_back = {chain=true},
- drops={dlxtrains.materials.steelblock},
- has_inventory = true,
- get_inventory_formspec = function(wagon, pname, invname)
- return "size[8,7]"..
- "box[0,0;.8,.88;#077]"..
- "list["..invname..";box;0,0;8,2;]"..
- "list[current_player;main;0,3;8,4;]"..
- "listring[]"..
- get_wagon_proprties_button_spec(wagon.id, pname, 2, 2)
- end,
- inventory_list_sizes = {
- box=8*2,
- },
- }, S("European Single Container Wagon"), "dlxtrains_industrial_wagons_container_type2_inv.png")
- end
- if dlxtrains_industrial_wagons.max_wagon_length >= 8 then
- local wagon_type = "dlxtrains_industrial_wagons:covered_goods_type1"
- dlxtrains.register_livery_templates(wagon_type, mod_name, livery_templates)
- advtrains.register_wagon(wagon_type, {
- mesh = meshes_industrial_wagon_covered_goods_type1.default,
- textures = {dlxtrains.get_init_texture()},
- set_textures = function(wagon, data)
- dlxtrains.set_textures_for_livery_scheme(wagon, data, livery_scheme_industrial_wagon_covered_goods_type1, meshes_industrial_wagon_covered_goods_type1)
- end,
- custom_may_destroy = function(wagon, puncher, time_from_last_punch, tool_capabilities, direction)
- return not dlxtrains.update_livery(wagon, puncher, livery_scheme_industrial_wagon_covered_goods_type1)
- end,
- seats = {},
- drives_on={default=true},
- max_speed=25,
- visual_size = {x=1, y=1},
- wagon_span=4,
- wheel_positions = {3.0, -3.0},
- collisionbox = {-1.0,-0.5,-1.0,1.0,2.5,1.0},
- coupler_types_front = {knuckle=true},
- coupler_types_back = {knuckle=true},
- drops={dlxtrains.materials.steelblock},
- has_inventory = true,
- get_inventory_formspec = function(wagon, pname, invname)
- return "size[8,10]"..
- "list["..invname..";box;0,0;8,5;]"..
- "list[current_player;main;0,6;8,4;]"..
- "listring[]"..
- get_wagon_proprties_button_spec(wagon.id, pname, 2, 5)
- end,
- inventory_list_sizes = {
- box=8*5,
- },
- }, S("North American Wooden Boxcar"), "dlxtrains_industrial_wagons_covered_goods_type1_inv.png")
- end
- if dlxtrains_industrial_wagons.max_wagon_length >= 8 then
- local wagon_type = "dlxtrains_industrial_wagons:covered_goods_type2"
- dlxtrains.register_livery_templates(wagon_type, mod_name, livery_templates)
- advtrains.register_wagon(wagon_type, {
- mesh = meshes_industrial_wagon_covered_goods_type2.default,
- textures = {dlxtrains.get_init_texture()},
- set_textures = function(wagon, data)
- dlxtrains.set_textures_for_livery_scheme(wagon, data, livery_scheme_industrial_wagon_covered_goods_type2, meshes_industrial_wagon_covered_goods_type2)
- end,
- custom_may_destroy = function(wagon, puncher, time_from_last_punch, tool_capabilities, direction)
- return not dlxtrains.update_livery(wagon, puncher, livery_scheme_industrial_wagon_covered_goods_type2)
- end,
- seats = {},
- drives_on={default=true},
- max_speed=25,
- visual_size = {x=1, y=1},
- wagon_span=4,
- wheel_positions = {2.8, -2.8},
- collisionbox = {-1.0,-0.5,-1.0,1.0,2.5,1.0},
- coupler_types_front = {knuckle=true},
- coupler_types_back = {knuckle=true},
- drops={dlxtrains.materials.steelblock},
- has_inventory = true,
- get_inventory_formspec = function(wagon, pname, invname)
- return "size[8,10]"..
- "list["..invname..";box;0,0;8,5;]"..
- "list[current_player;main;0,6;8,4;]"..
- "listring[]"..
- get_wagon_proprties_button_spec(wagon.id, pname, 2, 5)
- end,
- inventory_list_sizes = {
- box=8*5,
- },
- }, S("Australian Louver Van"), "dlxtrains_industrial_wagons_covered_goods_type2_inv.png")
- end
- if dlxtrains_industrial_wagons.max_wagon_length >= 7 then
- local wagon_type = "dlxtrains_industrial_wagons:covered_goods_type3"
- dlxtrains.register_livery_templates(wagon_type, mod_name, livery_templates)
- advtrains.register_wagon(wagon_type, {
- mesh = meshes_industrial_wagon_covered_goods_type3.default,
- textures = {dlxtrains.get_init_texture()},
- set_textures = function(wagon, data)
- dlxtrains.set_textures_for_livery_scheme(wagon, data, livery_scheme_industrial_wagon_covered_goods_type3, meshes_industrial_wagon_covered_goods_type3)
- end,
- custom_may_destroy = function(wagon, puncher, time_from_last_punch, tool_capabilities, direction)
- return not dlxtrains.update_livery(wagon, puncher, livery_scheme_industrial_wagon_covered_goods_type3)
- end,
- seats = {},
- drives_on={default=true},
- max_speed=20,
- visual_size = {x=1, y=1},
- wagon_span=3.5,
- wheel_positions = {2.0, -2.0},
- collisionbox = {-1.0,-0.5,-1.0,1.0,2.5,1.0},
- coupler_types_front = {chain=true},
- coupler_types_back = {chain=true},
- drops={dlxtrains.materials.steelblock},
- has_inventory = true,
- get_inventory_formspec = function(wagon, pname, invname)
- return "size[8,9]"..
- "list["..invname..";box;0,0;8,4;]"..
- "list[current_player;main;0,5;8,4;]"..
- "listring[]"..
- get_wagon_proprties_button_spec(wagon.id, pname, 2, 4)
- end,
- inventory_list_sizes = {
- box=8*4,
- },
- }, S("European Wooden Covered Goods Wagon"), "dlxtrains_industrial_wagons_covered_goods_type3_inv.png")
- end
- if dlxtrains_industrial_wagons.max_wagon_length >= 6 then
- local wagon_type = "dlxtrains_industrial_wagons:flat_type1"
- dlxtrains.register_livery_templates(wagon_type, mod_name, livery_templates)
- advtrains.register_wagon(wagon_type, {
- mesh = meshes_industrial_wagon_flat_type1.default,
- textures = {dlxtrains.get_init_texture()},
- set_textures = function(wagon, data)
- dlxtrains.set_textures_for_livery_scheme(wagon, data, livery_scheme_industrial_wagon_flat_type1, meshes_industrial_wagon_flat_type1)
- end,
- custom_may_destroy = function(wagon, puncher, time_from_last_punch, tool_capabilities, direction)
- return not dlxtrains.update_livery(wagon, puncher, livery_scheme_industrial_wagon_flat_type1)
- end,
- seats = {},
- drives_on={default=true},
- max_speed=20,
- visual_size = {x=1, y=1},
- wagon_span=3,
- wheel_positions = {2.0, -2.0},
- collisionbox = {-1.0,-0.5,-1.0,1.0,2.5,1.0},
- coupler_types_front = {chain=true},
- coupler_types_back = {chain=true},
- drops={dlxtrains.materials.steelblock},
- has_inventory = true,
- get_inventory_formspec = function(wagon, pname, invname)
- return "size[8,8]"..
- "box[0,0;.8,.88;#077]"..
- "box[0,1;.8,.88;#077]"..
- "box[0,2;.8,.88;#077]"..
- "list["..invname..";box;0,0;8,3;]"..
- "list[current_player;main;0,4;8,4;]"..
- "listring[]"..
- get_wagon_proprties_button_spec(wagon.id, pname, 2, 3)
- end,
- inventory_list_sizes = {
- box=8*3,
- },
- }, S("European Flat Wagon"), "dlxtrains_industrial_wagons_flat_type1_inv.png")
- end
- if dlxtrains_industrial_wagons.max_wagon_length >= 6 then
- local wagon_type = "dlxtrains_industrial_wagons:flat_type2"
- dlxtrains.register_livery_templates(wagon_type, mod_name, livery_templates)
- advtrains.register_wagon(wagon_type, {
- mesh = meshes_industrial_wagon_flat_type2.default,
- textures = {dlxtrains.get_init_texture()},
- set_textures = function(wagon, data)
- dlxtrains.set_textures_for_livery_scheme(wagon, data, livery_scheme_industrial_wagon_flat_type2, meshes_industrial_wagon_flat_type2)
- end,
- custom_may_destroy = function(wagon, puncher, time_from_last_punch, tool_capabilities, direction)
- return not dlxtrains.update_livery(wagon, puncher, livery_scheme_industrial_wagon_flat_type2)
- end,
- seats = {},
- drives_on={default=true},
- max_speed=20,
- visual_size = {x=1, y=1},
- wagon_span=3,
- wheel_positions = {2.0, -2.0},
- collisionbox = {-1.0,-0.5,-1.0,1.0,2.5,1.0},
- coupler_types_front = {knuckle=true},
- coupler_types_back = {knuckle=true},
- drops={dlxtrains.materials.steelblock},
- has_inventory = true,
- get_inventory_formspec = function(wagon, pname, invname)
- return "size[8,8]"..
- "box[0,0;.8,.88;#077]"..
- "box[0,1;.8,.88;#077]"..
- "box[0,2;.8,.88;#077]"..
- "list["..invname..";box;0,0;8,3;]"..
- "list[current_player;main;0,4;8,4;]"..
- "listring[]"..
- get_wagon_proprties_button_spec(wagon.id, pname, 2, 3)
- end,
- inventory_list_sizes = {
- box=8*3,
- },
- }, S("Australian Flat Wagon"), "dlxtrains_industrial_wagons_flat_type2_inv.png")
- end
- if dlxtrains_industrial_wagons.max_wagon_length >= 6 then
- local wagon_type = "dlxtrains_industrial_wagons:hopper_type1"
- dlxtrains.register_livery_templates(wagon_type, mod_name, livery_templates)
- advtrains.register_wagon(wagon_type, {
- mesh = meshes_industrial_wagon_hopper_type1.default,
- textures = {dlxtrains.get_init_texture()},
- set_textures = function(wagon, data)
- dlxtrains.set_textures_for_livery_scheme(wagon, data, livery_scheme_industrial_wagon_hopper_type1, meshes_industrial_wagon_hopper_type1)
- end,
- custom_may_destroy = function(wagon, puncher, time_from_last_punch, tool_capabilities, direction)
- return not dlxtrains.update_livery(wagon, puncher, livery_scheme_industrial_wagon_hopper_type1)
- end,
- seats = {},
- drives_on={default=true},
- max_speed=25,
- visual_size = {x=1, y=1},
- wagon_span=3,
- wheel_positions = {2.0, -2.0},
- collisionbox = {-1.0,-0.5,-1.0,1.0,2.5,1.0},
- coupler_types_front = {knuckle=true},
- coupler_types_back = {knuckle=true},
- drops={dlxtrains.materials.steelblock},
- has_inventory = true,
- get_inventory_formspec = function(wagon, pname, invname)
- return "size[8,8]"..
- "box[0,0;.8,.88;#077]"..
- "list["..invname..";box;0,0;8,3;]"..
- "list[current_player;main;0,4;8,4;]"..
- "listring[]"..
- get_wagon_proprties_button_spec(wagon.id, pname, 2, 3)
- end,
- inventory_list_sizes = {
- box=8*3,
- },
- }, S("North American Hopper Wagon"), "dlxtrains_industrial_wagons_hopper_type1_inv.png")
- end
- if dlxtrains_industrial_wagons.max_wagon_length >= 6 then
- local wagon_type = "dlxtrains_industrial_wagons:hopper_type2"
- dlxtrains.register_livery_templates(wagon_type, mod_name, livery_templates)
- advtrains.register_wagon(wagon_type, {
- mesh = meshes_industrial_wagon_hopper_type2.default,
- textures = {dlxtrains.get_init_texture()},
- set_textures = function(wagon, data)
- dlxtrains.set_textures_for_livery_scheme(wagon, data, livery_scheme_industrial_wagon_hopper_type2, meshes_industrial_wagon_hopper_type2)
- end,
- custom_may_destroy = function(wagon, puncher, time_from_last_punch, tool_capabilities, direction)
- return not dlxtrains.update_livery(wagon, puncher, livery_scheme_industrial_wagon_hopper_type2)
- end,
- seats = {},
- drives_on={default=true},
- max_speed=25,
- visual_size = {x=1, y=1},
- wagon_span=3,
- wheel_positions = {2.0, -2.0},
- collisionbox = {-1.0,-0.5,-1.0,1.0,2.5,1.0},
- coupler_types_front = {knuckle=true},
- coupler_types_back = {knuckle=true},
- drops={dlxtrains.materials.steelblock},
- has_inventory = true,
- get_inventory_formspec = function(wagon, pname, invname)
- return "size[8,8]"..
- "list["..invname..";box;0,0;8,3;]"..
- "list[current_player;main;0,4;8,4;]"..
- "listring[]"..
- get_wagon_proprties_button_spec(wagon.id, pname, 2, 3)
- end,
- inventory_list_sizes = {
- box=8*3,
- },
- }, S("North American Covered Hopper Wagon"), "dlxtrains_industrial_wagons_hopper_type2_inv.png")
- end
- if dlxtrains_industrial_wagons.max_wagon_length >= 6 then
- local wagon_type = "dlxtrains_industrial_wagons:livestock_type1"
- dlxtrains.register_livery_templates(wagon_type, mod_name, livery_templates)
- advtrains.register_wagon(wagon_type, {
- mesh = meshes_industrial_wagon_livestock_type1.default,
- textures = {dlxtrains.get_init_texture()},
- set_textures = function(wagon, data)
- dlxtrains.set_textures_for_livery_scheme(wagon, data, livery_scheme_industrial_wagon_livestock_type1, meshes_industrial_wagon_livestock_type1)
- end,
- custom_may_destroy = function(wagon, puncher, time_from_last_punch, tool_capabilities, direction)
- return not dlxtrains.update_livery(wagon, puncher, livery_scheme_industrial_wagon_livestock_type1)
- end,
- custom_on_step = function(self, dtime, data, train)
- if dlxtrains.wagon_sounds then
- local inv = minetest.get_inventory({type="detached", name="advtrains_wgn_"..data.id})
- if inv and not inv:is_empty("box") then
- local stack = inv:get_stack("box", 1)
- if not stack:is_empty() then
- play_animal_sound(self.object, data.id, stack)
- end
- end
- end
- end,
- seats = {},
- drives_on={default=true},
- max_speed=20,
- visual_size = {x=1, y=1},
- wagon_span=3,
- wheel_positions = {2.0, -2.0},
- collisionbox = {-1.0,-0.5,-1.0,1.0,2.5,1.0},
- coupler_types_front = {knuckle=true},
- coupler_types_back = {knuckle=true},
- drops={"default:steelblock"},
- has_inventory = true,
- get_inventory_formspec = function(wagon, pname, invname)
- return "size[8,7]"..
- "box[0,0;.8,.88;#077]"..
- "list["..invname..";box;0,0;8,2;]"..
- "list[current_player;main;0,3;8,4;]"..
- "listring[]"..
- get_wagon_proprties_button_spec(wagon.id, pname, 2, 2)
- end,
- inventory_list_sizes = {
- box=8*3,
- },
- }, S("Australian Cattle Van"), "dlxtrains_industrial_wagons_livestock_type1_inv.png")
- end
- if dlxtrains_industrial_wagons.max_wagon_length >= 6 then
- local wagon_type = "dlxtrains_industrial_wagons:open_type1"
- dlxtrains.register_livery_templates(wagon_type, mod_name, livery_templates)
- advtrains.register_wagon(wagon_type, {
- mesh = meshes_industrial_wagon_open_type1.default,
- textures = {dlxtrains.get_init_texture()},
- set_textures = function(wagon, data)
- dlxtrains.set_textures_for_livery_scheme(wagon, data, livery_scheme_industrial_wagon_open_type1, meshes_industrial_wagon_open_type1)
- end,
- custom_may_destroy = function(wagon, puncher, time_from_last_punch, tool_capabilities, direction)
- return not dlxtrains.update_livery(wagon, puncher, livery_scheme_industrial_wagon_open_type1)
- end,
- seats = {},
- drives_on={default=true},
- max_speed=20,
- visual_size = {x=1, y=1},
- wagon_span=3,
- wheel_positions = {2.0, -2.0},
- collisionbox = {-1.0,-0.5,-1.0,1.0,2.5,1.0},
- coupler_types_front = {knuckle=true},
- coupler_types_back = {knuckle=true},
- drops={dlxtrains.materials.steelblock},
- has_inventory = true,
- get_inventory_formspec = function(wagon, pname, invname)
- return "size[8,8]"..
- "box[0,0;.8,.88;#077]"..
- "box[0,1;.8,.88;#077]"..
- "box[0,2;.8,.88;#077]"..
- "list["..invname..";box;0,0;8,3;]"..
- "list[current_player;main;0,4;8,4;]"..
- "listring[]"..
- get_wagon_proprties_button_spec(wagon.id, pname, 2, 3)
- end,
- inventory_list_sizes = {
- box=8*3,
- },
- }, S("Australian Open Wagon"), "dlxtrains_industrial_wagons_open_type1_inv.png")
- end
- if dlxtrains_industrial_wagons.max_wagon_length >= 6 then
- local wagon_type = "dlxtrains_industrial_wagons:stake_type1"
- dlxtrains.register_livery_templates(wagon_type, mod_name, livery_templates)
- advtrains.register_wagon(wagon_type, {
- mesh = meshes_industrial_wagon_stake_type1.default,
- textures = {dlxtrains.get_init_texture()},
- set_textures = function(wagon, data)
- dlxtrains.set_textures_for_livery_scheme(wagon, data, livery_scheme_industrial_wagon_stake_type1, meshes_industrial_wagon_stake_type1)
- end,
- custom_may_destroy = function(wagon, puncher, time_from_last_punch, tool_capabilities, direction)
- return not dlxtrains.update_livery(wagon, puncher, livery_scheme_industrial_wagon_stake_type1)
- end,
- seats = {},
- drives_on={default=true},
- max_speed=20,
- visual_size = {x=1, y=1},
- wagon_span=3,
- wheel_positions = {2.0, -2.0},
- collisionbox = {-1.0,-0.5,-1.0,1.0,2.5,1.0},
- coupler_types_front = {chain=true},
- coupler_types_back = {chain=true},
- drops={dlxtrains.materials.steelblock},
- has_inventory = true,
- get_inventory_formspec = function(wagon, pname, invname)
- return "size[8,8]"..
- "box[0,0;.8,.88;#077]"..
- "box[0,1;.8,.88;#077]"..
- "box[0,2;.8,.88;#077]"..
- "list["..invname..";box;0,0;8,3;]"..
- "list[current_player;main;0,4;8,4;]"..
- "listring[]"..
- get_wagon_proprties_button_spec(wagon.id, pname, 2, 3)
- end,
- inventory_list_sizes = {
- box=8*3,
- },
- }, S("European Stake Wagon"), "dlxtrains_industrial_wagons_stake_type1_inv.png")
- end
- if dlxtrains_industrial_wagons.max_wagon_length >= 4.875 then
- local wagon_type = "dlxtrains_industrial_wagons:tank_type1"
- dlxtrains.register_livery_templates(wagon_type, mod_name, livery_templates)
- local wagon_def = {
- mesh = meshes_industrial_wagon_tank_type1.default,
- textures = {dlxtrains.get_init_texture()},
- set_textures = function(wagon, data)
- dlxtrains.set_textures_for_livery_scheme(wagon, data, livery_scheme_industrial_wagon_tank_type1, meshes_industrial_wagon_tank_type1)
- end,
- custom_may_destroy = function(wagon, puncher, time_from_last_punch, tool_capabilities, direction)
- return not dlxtrains.update_livery(wagon, puncher, livery_scheme_industrial_wagon_tank_type1)
- end,
- seats = {
- {
- name = "Seat in Brakeman's Cabin",
- attach_offset = use_attachment_patch and {x=0, y=1, z=-18.0} or {x=0, y=1, z=-18.0},
- view_offset = use_attachment_patch and {x=0, y=0, z=0} or {x=0, y=6.5, z=0},
- advtrains_attachment_offset_patch_attach_rotation = use_attachment_patch and {x=0, y=180, z=0} or nil,
- group = "cabin",
- },
- },
- seat_groups = {
- cabin={
- name = "Brakeman's Cabin",
- access_to = {},
- require_doors_open = false,
- },
- },
- assign_to_seat_group = {"cabin"},
- drives_on={default=true},
- max_speed=15,
- visual_size = {x=1, y=1},
- wagon_span=2.4375,
- wheel_positions = {1.3, -1.0},
- collisionbox = {-1.0,-0.5,-1.0,1.0,2.5,1.0},
- coupler_types_front = {chain=true},
- coupler_types_back = {chain=true},
- drops={dlxtrains.materials.steelblock},
- has_inventory = true,
- get_inventory_formspec = function(wagon, pname, invname)
- return "size[8,8]"..
- "list["..invname..";box;0,0;8,3;]"..
- "list[current_player;main;0,4;8,4;]"..
- "listring[]"..
- get_wagon_proprties_button_spec(wagon.id, pname, 2, 3)
- end,
- inventory_list_sizes = {
- box=8*3,
- },
- techage_liquid_capacity = 1000,
- }
- if use_attachment_patch then
- advtrains_attachment_offset_patch.setup_advtrains_wagon(wagon_def);
- end
- advtrains.register_wagon(wagon_type, wagon_def, S("European Small Tank Wagon with Brakeman's Cabin"), "dlxtrains_industrial_wagons_tank_type1_inv.png")
- end
- if dlxtrains_industrial_wagons.max_wagon_length >= 4.875 then
- local wagon_type = "dlxtrains_industrial_wagons:tank_type2"
- dlxtrains.register_livery_templates(wagon_type, mod_name, livery_templates)
- advtrains.register_wagon(wagon_type, {
- mesh = meshes_industrial_wagon_tank_type2.default,
- textures = {dlxtrains.get_init_texture()},
- set_textures = function(wagon, data)
- dlxtrains.set_textures_for_livery_scheme(wagon, data, livery_scheme_industrial_wagon_tank_type2, meshes_industrial_wagon_tank_type2)
- end,
- custom_may_destroy = function(wagon, puncher, time_from_last_punch, tool_capabilities, direction)
- return not dlxtrains.update_livery(wagon, puncher, livery_scheme_industrial_wagon_tank_type2)
- end,
- seats = {},
- drives_on={default=true},
- max_speed=15,
- visual_size = {x=1, y=1},
- wagon_span=2.4375,
- wheel_positions = {1.3, -1.0},
- collisionbox = {-1.0,-0.5,-1.0,1.0,2.5,1.0},
- coupler_types_front = {chain=true},
- coupler_types_back = {chain=true},
- drops={dlxtrains.materials.steelblock},
- has_inventory = true,
- get_inventory_formspec = function(wagon, pname, invname)
- return "size[8,8]"..
- "list["..invname..";box;0,0;8,3;]"..
- "list[current_player;main;0,4;8,4;]"..
- "listring[]"..
- get_wagon_proprties_button_spec(wagon.id, pname, 2, 3)
- end,
- inventory_list_sizes = {
- box=8*3,
- },
- techage_liquid_capacity = 1000,
- }, S("European Small Tank Wagon"), "dlxtrains_industrial_wagons_tank_type2_inv.png")
- end
- if dlxtrains_industrial_wagons.max_wagon_length >= 6 then
- local wagon_type = "dlxtrains_industrial_wagons:transition_type1"
- dlxtrains.register_livery_templates(wagon_type, mod_name, livery_templates)
- advtrains.register_wagon(wagon_type, {
- mesh = meshes_industrial_wagon_transition_type1.default,
- textures = {dlxtrains.get_init_texture()},
- set_textures = function(wagon, data)
- dlxtrains.set_textures_for_livery_scheme(wagon, data, livery_scheme_industrial_wagon_transition_type1, meshes_industrial_wagon_transition_type1)
- end,
- custom_may_destroy = function(wagon, puncher, time_from_last_punch, tool_capabilities, direction)
- return not dlxtrains.update_livery(wagon, puncher, livery_scheme_industrial_wagon_transition_type1)
- end,
- seats = {},
- drives_on={default=true},
- max_speed=20,
- visual_size = {x=1, y=1},
- wagon_span=3,
- wheel_positions = {2.0, -2.0},
- collisionbox = {-1.0,-0.5,-1.0,1.0,2.5,1.0},
- coupler_types_front = {chain=true},
- coupler_types_back = {knuckle=true},
- drops={dlxtrains.materials.steelblock},
- has_inventory = true,
- get_inventory_formspec = function(wagon, pname, invname)
- return "size[8,8]"..
- "box[0,0;.8,.88;#077]"..
- "box[0,1;.8,.88;#077]"..
- "box[0,2;.8,.88;#077]"..
- "list["..invname..";box;0,0;8,3;]"..
- "list[current_player;main;0,4;8,4;]"..
- "listring[]"..
- get_wagon_proprties_button_spec(wagon.id, pname, 2, 3)
- end,
- inventory_list_sizes = {
- box=8*3,
- },
- }, S("Buffer/Knuckle Transition Wagon"), "dlxtrains_industrial_wagons_transition_type1_inv.png")
- end
|