I'm trying to create new industries but they aren't placed on the map while creating it. Is there any howto about how to bring them to the map generator? Also is there some mod to manually build a supply chain (as the industries aren't connected when placed by hand in a running game) ?
New industries
Willkommen in der Transport Fever Community
Wir begrüßen euch in der Fan-Community zu den Spielen Transport Fever und Train Fever, den Wirtschaftssimulatoren von Urban Games. Die Community steht euch kostenlos zur Verfügung damit ihr euch über das Spiel austauschen und informieren könnt. Wir pflegen hier einen freundlichen und sachlichen Umgang untereinander und unser Team steht euch in allen Fragen gerne beiseite.
Die Registrierung und Nutzung ist selbstverständlich kostenlos.
Wir wünschen euch viel Spaß und hoffen auf rege Beteiligung.
Das Team der Transport-Fever Community
-
-
It is probably the best to have a look at the other Industry files or the wiki
-
I looked at other mods but I'm new to TPF2 modding and these mods seem to be way to complicated; I don't want to examine 20 lua files doing dynamic modding while I want static modding. Do you have a wiki link? I looked at a lot of development oriented wikis but couldn't find any entry related to this topic.
//EDIT: In case you wonder what I mean with "new to modding": I have 15+ years of development experience. Did a ton of mods for other games... I ported the TPF1 to TPF2 mod converter to linux... And then I tried to convert the "Soylent Green" mod. Now I'm adjusting meshes, materials & co since days and so far all looks good but this industry bug is one of the biggest blockers. Here my complete bug list
- You have to place industries by hand and as a result there is no supply chain, leaving the buildings useless.
- No horses.
- Wrong ground textures at the industries.
- Trees at industries grow into buildings (I had to replace most trees as they are no longer available in TPF2. For example orangetrees have been replaced by lemontrees).
- No soylent logos on tucks/waggons.
As you see 4 of the 5 bugs are just cosmetic but the first one is the showstopper... -
https://www.transportfever2.co…odding:constructionbasics
I meant the other game industries, they are located in res\construction\industry
They have a ton of "genereated data" but the definition at the bottom should be similar
I don't understand the problem with "supply chain". Should your industry be placed in the map generation?
Eventually you need to define a new cargo type.
-
https://www.transportfever2.co…odding:constructionbasics
I meant the other game industries, they are located in res\construction\industry
They have a ton of "genereated data" but the definition at the bottom should be similar
Thanks, I will have a look later
I don't understand the problem with "supply chain". Should your industry be placed in the map generation?
Eventually you need to define a new cargo type.
New cargo type is already defined. The problem is: Industry B needs the new Cargo type produced by Industry A but Industry A doesn't even produce it as it thinks there's nobody wanting it. Anyway, while trying to make some screenshots I saw some bummer which might explain that bug. Will have a look soon.
//EDIT: Okay, vanilla does industry buildings completely different. The reason for this might be that this is a TPF1 port. So this is what I do to define the stocks:Codeconstructionutil.makeStocks({ stocks = { { cargoType = "MY_CARGO", type = "SENDING", x = 32, y = -46, sizex = 1, sizey = 4 }, }, stockRules = { { input = { { 0 } }, output = { { 1 } }, capacity = 100 }, } }, result)
But the industry seems to want to receive these stocks, so it looks like type = "SENDING" gets ignored. Sadly I can't find any reference to constructionutil.makeStocks in vanilla codes. Before I start to rewrite the whole industries from scatch: Does anyone know how to utilize constructionutil.makeStocks correctly?
//EDIT²: After examining the constructionutil.lua file this should work:Codeconstructionutil.makeStocks({ stocks = { { cargoType = "MY_CARGO", type = "SENDING", x = 32, y = -46, sizex = 1, sizey = 4 }, }, rule = { { input = { { } }, output = { MY_CARGO = 1 }, capacity = 100 }, } }, result)
but it doesn't: It still wants to receive instead of send the cargo.
//EDIT³: There was a table too much. After removing it the game finally reacts to the rules - with a crash
Codeconstructionutil.makeStocks({ stocks = { { cargoType = "MY_CARGO", type = "SENDING", x = 32, y = -46, sizex = 1, sizey = 4 }, }, rule = { input = { { } }, output = { MY_CARGO = 1 }, capacity = 100 } }, result)
Code
Alles anzeigen../../src/Game/construction/make_proposal.cpp:692: void construction_builder_util::MakeProposalAdd(const street_util::StreetToolkit&, const ConstructionDesc&, const Construction&, const CMat4f&, const std::unordered_map<int, std::pair<ecs::Entity, float> >&, std::__cxx11::string, ecs::Entity, construction_builder_util::Proposal&): Assertion `(int)construction.stocks.size() == (int)r.size()' failed. Uncaught exception while in N2UI9CSelectorE Exception type: Fatal error Details: Error message: Assertion `(int)construction.stocks.size() == (int)r.size()' failed. Minidump: /home/tmpuser/.local/share/Steam/userdata/100160448/1066780/local/crash_dump/e0e9331f-86b7-44e1-53252180-b32bd841.dmp In file: ../../src/Game/construction/make_proposal.cpp:692 In function: void construction_builder_util::MakeProposalAdd(const street_util::StreetToolkit&, const ConstructionDesc&, const Construction&, const CMat4f&, const std::unordered_map<int, std::pair<ecs::Entity, float> >&, std::__cxx11::string, ecs::Entity, construction_builder_util::Proposal&) __CRASHDB_CRASH__ AssertException: ../../src/Game/construction/make_proposal.cpp:692: void construction_builder_util::MakeProposalAdd(const street_util::StreetToolkit&, const ConstructionDesc&, const Construction&, const CMat4f&, const std::unordered_map<int, std::pair<ecs::Entity, float> >&, std::__cxx11::string, ecs::Entity, construction_builder_util::Proposal&): Assertion `(int)construction.stocks.size() == (int)r.size()' failed. Exception type: Fatal error Details: Error message: Assertion `(int)construction.stocks.size() == (int)r.size()' failed. Minidump: /home/tmpuser/.local/share/Steam/userdata/100160448/1066780/local/crash_dump/e0e9331f-86b7-44e1-53252180-b32bd841.dmp In file: ../../src/Game/construction/make_proposal.cpp:692 In function: void construction_builder_util::MakeProposalAdd(const street_util::StreetToolkit&, const ConstructionDesc&, const Construction&, const CMat4f&, const std::unordered_map<int, std::pair<ecs::Entity, float> >&, std::__cxx11::string, ecs::Entity, construction_builder_util::Proposal&)
//EDIT: It finally works and I feel stupid... Industry A:Industry B:
-
I am experiencing problems with rules.
I only need a single producing factory for "MY_CARGO". It will end up in a fish farm on the bottom of the sea and it should be connected to a harbour. This mod is working in TpF1, but now it's time to get it into TpF2. "FISH" is as cargo already defined, but to test the function at the moment I use "OIL"
I have for a long time read Wiki and looked into different vanilla industries, ex. oil well. Interestingly, even though I use exactly like industry A above, TpF2 crashes with the following log.
Test1
Test2
Test3
return result
Test1
Test2
Test3
return result
..\..\src\Game\ecs\StockListSystem.cpp:148: class ecs::Entity __cdecl `anonymous-namespace'::GetRandomTarget(int,const class ecs::SimEntityAtTerminalSystem &,const class ecs::TransportVehicleSystem &,const class ecs::LineSystem &,const class ecs::StationSystem &,const class ecs::TransportNetworkSystem &,const class ecs::CatchmentAreaSystem &,const class ecs::Engine &,const class IdVector<struct CargoTypeId,class std::unordered_map<class ecs::Entity,class std::unordered_map<class ecs::Entity,int,struct std::hash<class ecs::Entity>,struct std::equal_to<class ecs::Entity>,class std::allocator<struct std::pair<class ecs::Entity const ,int> > >,struct std::hash<class ecs::Entity>,struct std::equal_to<class ecs::Entity>,class std::allocator<struct std::pair<class ecs::Entity const ,class std::unordered_map<class ecs::Entity,int,struct std::hash<class ecs::Entity>,struct std::equal_to<class ecs::Entity>,class std::allocator<struct std::pair<class ecs::Entity const ,int> > > > > > > &,const class IdVector<struct CargoTypeId,class std::set<class ecs::Entity,struct std::less<class ecs::Entity>,class std::allocator<class ecs::Entity> > > &,class boost::random::mersenne_twister_engine<unsigned int,32,624,397,31,2567483615,11,4294967295,7,2636928640,15,4022730752,18,1812433253> &,class ecs::Entity,struct CargoTypeId,bool): Assertion `!fromEdges.empty()' failed.
Attempting to write crash save to "I:/Steam/userdata/70790454/1066780/local/save/crash_Test Highway_2021-09-09_06-57-34.sav"
available disk space: 281657 MB
[2021-09-09 06:57:34] Saving to file I:/Steam/userdata/70790454/1066780/local/save/crash_Test Highway_2021-09-09_06-57-34.sav.tmp
GC Called
Destroying failback ui done
Uncaught exception while in class UI::CSelector
Exception type: Fatal error
Details:
Error message: Assertion `!fromEdges.empty()' failed.
Minidump: I:/Steam/userdata/70790454/1066780/local/crash_dump/9b05d735-bc50-4ab5-b661-74b270d85525.dmp
In file: ..\..\src\Game\ecs\StockListSystem.cpp:148
In function: class ecs::Entity __cdecl `anonymous-namespace'::GetRandomTarget(int,const class ecs::SimEntityAtTerminalSystem &,const class ecs::TransportVehicleSystem &,const class ecs::LineSystem &,const class ecs::StationSystem &,const class ecs::TransportNetworkSystem &,const class ecs::CatchmentAreaSystem &,const class ecs::Engine &,const class IdVector<struct CargoTypeId,class std::unordered_map<class ecs::Entity,class std::unordered_map<class ecs::Entity,int,struct std::hash<class ecs::Entity>,struct std::equal_to<class ecs::Entity>,class std::allocator<struct std::pair<class ecs::Entity const ,int> > >,struct std::hash<class ecs::Entity>,struct std::equal_to<class ecs::Entity>,class std::allocator<struct std::pair<class ecs::Entity const ,class std::unordered_map<class ecs::Entity,int,struct std::hash<class ecs::Entity>,struct std::equal_to<class ecs::Entity>,class std::allocator<struct std::pair<class ecs::Entity const ,int> > > > > > > &,const class IdVector<struct CargoTypeId,class std::set<class ecs::Entity,struct std::less<class ecs::Entity>,class std::allocator<class ecs::Entity> > > &,class boost::random::mersenne_twister_engine<unsigned int,32,624,397,31,2567483615,11,4294967295,7,2636928640,15,4022730752,18,1812433253> &,class ecs::Entity,struct CargoTypeId,bool)
__CRASHDB_CRASH__ struct AssertException: ..\..\src\Game\ecs\StockListSystem.cpp:148: class ecs::Entity __cdecl `anonymous-namespace'::GetRandomTarget(int,const class ecs::SimEntityAtTerminalSystem &,const class ecs::TransportVehicleSystem &,const class ecs::LineSystem &,const class ecs::StationSystem &,const class ecs::TransportNetworkSystem &,const class ecs::CatchmentAreaSystem &,const class ecs::Engine &,const class IdVector<struct CargoTypeId,class std::unordered_map<class ecs::Entity,class std::unordered_map<class ecs::Entity,int,struct std::hash<class ecs::Entity>,struct std::equal_to<class ecs::Entity>,class std::allocator<struct std::pair<class ecs::Entity const ,int> > >,struct std::hash<class ecs::Entity>,struct std::equal_to<class ecs::Entity>,class std::allocator<struct std::pair<class ecs::Entity const ,class std::unordered_map<class ecs::Entity,int,struct std::hash<class ecs::Entity>,struct std::equal_to<class ecs::Entity>,class std::allocator<struct std::pair<class ecs::Entity const ,int> > > > > > > &,const class IdVector<struct CargoTypeId,class std::set<class ecs::Entity,struct std::less<class ecs::Entity>,class std::allocator<class ecs::Entity> > > &,class boost::random::mersenne_twister_engine<unsigned int,32,624,397,31,2567483615,11,4294967295,7,2636928640,15,4022730752,18,1812433253> &,class ecs::Entity,struct CargoTypeId,bool): Assertion `!fromEdges.empty()' failed.
Exception type: Fatal error
Details:
Error message: Assertion `!fromEdges.empty()' failed.
Minidump: I:/Steam/userdata/70790454/1066780/local/crash_dump/9b05d735-bc50-4ab5-b661-74b270d85525.dmp
In file: ..\..\src\Game\ecs\StockListSystem.cpp:148
In function: class ecs::Entity __cdecl `anonymous-namespace'::GetRandomTarget(int,const class ecs::SimEntityAtTerminalSystem &,const class ecs::TransportVehicleSystem &,const class ecs::LineSystem &,const class ecs::StationSystem &,const class ecs::TransportNetworkSystem &,const class ecs::CatchmentAreaSystem &,const class ecs::Engine &,const class IdVector<struct CargoTypeId,class std::unordered_map<class ecs::Entity,class std::unordered_map<class ecs::Entity,int,struct std::hash<class ecs::Entity>,struct std::equal_to<class ecs::Entity>,class std::allocator<struct std::pair<class ecs::Entity const ,int> > >,struct std::hash<class ecs::Entity>,struct std::equal_to<class ecs::Entity>,class std::allocator<struct std::pair<class ecs::Entity const ,class std::unordered_map<class ecs::Entity,int,struct std::hash<class ecs::Entity>,struct std::equal_to<class ecs::Entity>,class std::allocator<struct std::pair<class ecs::Entity const ,int> > > > > > > &,const class IdVector<struct CargoTypeId,class std::set<class ecs::Entity,struct std::less<class ecs::Entity>,class std::allocator<class ecs::Entity> > > &,class boost::random::mersenne_twister_engine<unsigned int,32,624,397,31,2567483615,11,4294967295,7,2636928640,15,4022730752,18,1812433253> &,class ecs::Entity,struct CargoTypeId,bool)
Goodbye.
========================================
Shutdown at Thu Sep 9 06:58:09 2021
========================================
I have put some print inside my con file, so I can follow that it completely executes two times before the crash.
The first run is done when clicking on the industry in the menu. After placing the industry on the map, it is visible for about 5 seconds before it crashes.
The construction is working (though without any production) when a comment is placed before result.rule = { input = { { } }, output = { OIL = 1 }, capacity = 100 }
I do not understand what is wrong. Below is the small con file.
Code
Alles anzeigenlocal vec3 = require "vec3" local transf = require "transf" local constructionutil = require "constructionutil" local paramsutil = require "paramsutil" local industryutil = require "industryutil" function data() return { type = "INDUSTRY", description = { name = _("Fish_farm"), }, availability = { yearFrom = 0, yearTo = 0}, params = paramsutil.makeIndustryParams(), skipCollision = false, skipOnInit = true, soundConfig = { }, updateFn = function(params) local result = { } result.groundFaces = {} result.edgeLists = {} result.models = { } local level = (params.productionLevel or 0) + 1 -- local level = 1 local edges = { } result.models[#result.models + 1] = { id = "industry/Fish_farm/fish_farm.mdl", transf = transf.rotZYXTransl(transf.degToRad(0.0, 0.0, 0.0), vec3.new(0.0, 0.0, .1))} --station result.models[#result.models + 1] = { id = "industry/Fish_farm/station_sea.mdl", transf = transf.rotZYXTransl(transf.degToRad(0, 0, 0), vec3.new(-10, 50, 0)) } print("Test1") result.stocks = {} result.rule = { input = { { } }, output = { OIL = 1 }, capacity = 100 } print("Test2") result.edgeLists = { { type = "STREET", params = { type = "standard/country_medium_new.lua", }, edgeType = "TUNNEL", edgeTypeName = "street_old.lua", edges = { {{ 0, 0, -100 }, { 0, 10, 0 }}, {{ 0, 20, -100 }, { 0, 10, 0 }}, }, snapNodes = { }, }, } --]] print("Test3") -- result.cost = 200000 -- result.maintenanceCost = result.cost / 6 print("return result") return result end } end