At some point I’ll be interested in starting to mod this game, specifically I’m interested in introducing locomotives.
I only have experience in Python, not Lua, so I’m wondering what the opinion is of some members of the community more experienced with modding at the implementation of Trains in Stonehearth’s current state just via modifying Jsons and such.
Idea:
Introduce a “rail” which acts just as a modified road.
The roads in vanilla currently give a boost in speed, what I’m wondering is whether or not we can set an entity with a base movement speed that is very low or effectively 0, and have a clause in the new “rail-road” that increases just that entity, or that class of entity’s movement speed by some reasonable amount, thus enabling motion.
I figure in this way, using a reskinned entity form from existing code (with a qubicle made train model with animations), borrowing the code for mounting from the wolves, and introducing + modifying the properties of a special roadtype, we could have effectively what could be a locomotive without having to implement anything ‘new’ in Lua.
Does this seem feasible to people experienced with modding?
It is a fully working train in game train that’s part of a collaborative mod he and I are working on. However the guy is a genius and the implementation is far from trivial. Makes me want to scoop out his brains.
Not possible. You won’t get around making some sort of custom movement mechanics. Some kind of “train” concept (moving multiple entities at the same time or rather managing them) is required, too.
Roads are weird. Basically, your basic road is just a replacement (“replace block (-5, 1, 3) grass → road_cobble”) and telling the terrain (component) “at (-5, 1, 3), scale the speed by factor X”. This is not per-entity, it’s a global kind of thing (for all classes that implement it). Because of the modularity, radiant.terrain.get_movement_speed is only used in one location - but that one is used everywhere.
So you would have to code your own system. From zero. It’s not a good approach in my opinion, however. I mean, it’s a sound idea and all, but you wouldn’t end up with proper trains.
Setting the movement speed to zero will likely cause this area to be ignored, or heavily avoided, by all pathfinding related actions: No AI would walk over those tracks, ever. You would need an own pathfinding, which wouldn’t be too bad, all things considered…
I mean, I do value your effort to create something purely using data. That’s some serious thinking to work around a system like that (a valuable trait that comes in handy often). I just don’t think that you’re going to get far in this case - at the very least, not without some very serious side effects that maybe can be avoided, but doing so will cost you much more time than learning lua and creating a component or two.
I’ve laid out my concept a bit over in the RepeatFeed - but of course, there’s many definitions of “train”. I chose one that I found appropriate. However, you might get some input from there: