Git Product home page Git Product logo

dv-rolling-stock-ownership's Introduction

Contributors Forks Stargazers Issues MIT License

Rolling Stock Ownership

Download the mod · Report a bug · Request a feature

Table of Contents
  1. About The Project
  2. Building
  3. Packaging
  4. License

About The Project

Rolling Stock Ownership (RSO) is a mod for the 2019 VR compatible train simulator Derail Valley. It introduces a game mechanic of purchasing and managing railroad equipment—a.k.a. rolling stock—the locomotives and wagons that the player must use to complete job contracts in the game. Use the Comms Radio to purchase and clear equipment. Integrates with Custom Car Loader. Custom Car Loader integration returning soon.

Building

Building the project requires some initial setup, after which running dotnet build will do a Debug build or running dotnet build -c Release will do a Release build.

References Setup

After cloning the repository, some setup is required in order to successfully build the mod DLLs. You will need to create a new Directory.Build.targets file to specify your local reference paths. This file will be located in the main directory, next to DVOwnership.sln.

Below is an example of the necessary structure. When creating your targets file, you will need to replace the reference paths with the corresponding folders on your system. Make sure to include semicolons between each of the paths and no semicolon after the last path. Also note that any shortcuts you might use in file explorer—such as %ProgramFiles%—won't be expanded in these paths. You have to use full, absolute paths.

<Project>
	<PropertyGroup>
		<ReferencePath>
			C:\Program Files (x86)\Steam\steamapps\common\Derail Valley\DerailValley_Data\Managed\;
			C:\Program Files (x86)\Steam\steamapps\common\Derail Valley\Mods\CommsRadioAPI\;
			C:\Program Files (x86)\Steam\steamapps\common\Derail Valley\Mods\DVCustomCarLoader\;
			C:\Program Files (x86)\Steam\steamapps\common\Derail Valley\Mods\DVLangHelper\;
			C:\Program Files (x86)\Steam\steamapps\common\Derail Valley\Mods\MessageBox\
		</ReferencePath>
		<AssemblySearchPaths>$(AssemblySearchPaths);$(ReferencePath);</AssemblySearchPaths>
	</PropertyGroup>
</Project>

Line Endings Setup

It's recommended to use Git's autocrlf mode on Windows. Activate this by running git config --global core.autocrlf true.

Packaging

To package a build for distribution, you can run the package.ps1 PowerShell script in the root of the project. If no parameters are supplied, it will create a .zip file ready for distribution in the dist directory. A post build event is configured to run this automatically after each successful Release build.

Linux: pwsh ./package.ps1 Windows: powershell -executionpolicy bypass .\package.ps1

Parameters

Some parameters are available for the packaging script.

-NoArchive

Leave the package contents uncompressed in the output directory.

-OutputDirectory

Specify a different output directory. For instance, this can be used in conjunction with -NoArchive to copy the mod files into your Derail Valley installation directory.

-NoCleanup

When compressing the package contents, a temporary directory is created and later removed. This can be used to leave the temporary directory in place for inspection, debugging, etc. It has no effect when used with -NoArchive.

License

Source code is distributed under the MIT license. See LICENSE for more information.

dv-rolling-stock-ownership's People

Contributors

fauxnik avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

dv-rolling-stock-ownership's Issues

Add setting for max shunting tasks

In the Ctrl+F10 menu, add a setting to choose how many(I guess as many as there are shunting track in the yard) or little (min 1) shunting tasks you want to do when loading or unloading. thanks

Investigate save reload behavior

Recently, I noticed the IdGenerator patches complaining about IDs already being registered. This happened when I reloaded a save state after having already been in the game. I suspect duplicate equipment records may be ending up in the RollingStockManager, and this may be what's causing the mysterious car damage that's been so elusive to track down.

Handle tracks hash changes

Derail Valley uses a hash to determine when the tracks have changed between versions. When a session is loaded that was saved with an outdated tracks hash, all equipment are cleared from the world. This means that the player will lose their roster unless RSO does something to compensate.

[Bug] S282A spawns with hand brake even though it has none

As written in the title apparently the S282A (Front portion of the S282) spawns with Hand Brake applied, even though it has no hand brake making it impossible to release that brake. It's possible to drive with enough power, but it makes crazy sounds and doesn't drive very well.

Below is a picture of the brake gauge to show that the air brakes (train & independant) are properly set up (compressor started, tender connected, angle cocks at the ends closed):
grafik

Fix cargo disappearing when equipment is despawned

To reproduce:

  1. Complete a ShuntingLoad job to load cars and generate a FreightHaul job
  2. Don't accept the FreightHaul job
  3. If player previously stood on locomotive, uncouple locomotive
  4. Walk far enough away from station for equipment to despawn
  5. Return to station
  6. Observe that previously loaded cars are empty and that a ShuntingLoad job has been generated

Shunting Jobs

1. Shunt Load Jobs
Would it be at all possible for shunt load jobs to have the destination track match the loading track, like the persistent jobs mod does?
That way as soon as you have hit load you can hand in the job and then store the cars as you want or add them to a train you are building for a haul.

2. Shunt Unload Jobs
Would the above work for unload jobs? Once you unload and hand in the job it generates a load job containing one or more of the cars you just unloaded as well as other eligible empties in the yard, this would require shunting but it wouldn't feel like unnecessary work.

Alternatively, have the unload jobs work the same way as persistent jobs as well, where after unload you store in specified locations and then load jobs are assigned to those cars on your next visit to that particular station. I know this may hinder early game play a bit, i Haven't been able to figure out a way to get around that.

I think implementing one or both of the above could help mitigate the feeling of doing unnecessary work in the yard, once a job is loaded you can immediately add it to a train being built for a haul or store it for later. When unloading you can either store the cars as you need in favor of another job or do some shunting to build the next cut to be loaded.

Parallel job generation causes wagons to be assigned to multiple jobs

Triggering job generation via Comms Radio causes job generation to happen in parallel when multiple stations are listed. This happens for stations that are located close together, like Machine Factory and Machine Factory Military Base. When this occurs, each involved wagon ends up being assigned to multiple jobs because the check for job assignment only happens at the beginning of the process.

Teleport player to player home on start

The starter locomotive is spawned at the player home, but the player doesn't, not even in a fresh game. After showing the first-time prompt (or maybe before?), teleport the player to the player home so they can immediately begin using the starter locomotive.

Shunting unload jobs not spawning

I have 5 flatcars with steel. When i use "refresh jobs", an error appers in console (ArgumentOutOfRangeException: Specified argument was out of the range of valid values).
I want to note that when I brought these сars and handed over the job, the shunting unload job was generated (because max 9 flatcars on L - track can be placed). But if you move away from GF and come back again, or accept and cancel the job, then the SU job will not be generated again if refresh.
Also, the presence of these cars prevents the SL job generation with other cars
20240616223955_1

Vanilla "Owned vehicles" system usage in the RSO, and an idea how to implement both randomly generated cars with player-owned ones.

As probably everybody knows by this point, yesterday Altfuture dropped B98, that implemented "Owned vehicles" system.
Vehicles in this tab are free from the usual fee system, but player needs to service them manually as a drawback.

My first, and oblivious, suggestion is to put all purchased locomotives into "Owned vehicles" category.
In this case, player needs to receive "Manual service" license at the start of the game.

My second suggestion is to put ALL rolling stock in it as well. This, however, causes a few issues.

  1. I'm not sure you can service cars in the vanilla. I assume it is possible, after all you can service tender of S282, but I'm no codder and never modded DV, so it is just blind guess from me.

  2. Even if you can, there is exactly one loco service facility that can allow run-through service of an entire consist (OWN track A2D), and I'm not sure you can even do it MU-style, i.e. spot one car and roll the knob to select and service others. And it would be pretty tedious to service-move consists of 20+ cars.

If it is the case, it might be better to implement a radio command instead, which repairs them for a fixed fee.

And my third, and final suggestion that was mentioned in the title and sounds like something against the idea of the mod, but still, hear me out.

If the player-owned rolling stock actually gets into the "Owned vehicles" tab, then it might be possible to create a Railroader-like experience.

By that, I mean you service with not your rolling stock at first (locos are still have to be player-own), HOWEVER it is way less profitable that do it with your cars.

In order to achieve this without implementing a second set of vanilla cars just to give them reduced payout modifier, I believe it is possible to use the fee system, by setting wheel/brakes damage fees waay higher than they are in vanilla. And, because you do not pay fees for "Owned vehicles", it naturally makes your own cars more profitable.

This would provide 2 more things. First, the additional sense of progression, with your own cars gradually replacing rolling stock of your "competitors" in the yards. Second, you can actually bump up car costs to something more resonable than only a few thousands for most of them.

In closure, sorry for this wall of text of awful english spelling from somebody who has no idea how to code past basic logical operators and has no idea of the game structure, but at least I hope I decribed my idea well enough for you to undestand and evaluate.

Non random jobs generation issue

After the last update of the mod, jobs stopped being generated randomly. Instead, they are always generated to the same destination. For example, I have empty flatcars on MF. When refreshing jobs, MF-FF jobs with empty Sunomni containers are always generated. At the same time, the input and storage tracks are not occupied in all other places (HB, CM, IMW ...)

Missing some cargo chains

I took this from issue #73.
So, since update 3.0.0, some cargo chains have disappeared. This means that it is impossible to generate SL jobs for specific chains now, and therefore impossible to get FH jobs for these chains. I tried all the ways to generate a job and none of them helped.
Conditions:
-Created new game
-There was only one train at the station with the cars needed for a specific chain.
-All needed licenses have been purchased.
-The train was not too long to fit on the L-track.
Methods of job genration used:
-Bring the empty cars to the station by locomotive
-Use radio mode "Refresh jobs"
-Leave the cars at the station, get away from it at a distance at which the cars will despawn and return back

List of missing cargo chains:
MF->HB,GF Empty containers
MF->FM,HB Tractors
MF->IME,IMW,CM,HB Excavators
GF->HB,FF Empty containers
FF->HB,GF Empty containers
FM->GF Fur,...
CSW->HB,GF Empty containers
SM->HB Rails
HB->... Argon, Liquid oxygen, Nitrogen
HB->GF,FF Empty containers
HB->... Liquid hydrogen (If there is a train with black chemical tanks and flatcars, then it is possible to create a mixed job with
ammonia, sodium hydroxide and liq. hydrogen)

PS. Fauxnik, you told me "It looked like you were attempting to get a different destination for FH jobs, were you not? It's intentional that that doesn't happen. Consider taking a SL job like taking a contract to deliver the specified cargo to the specified destination. (The assignment actually happens at cargo load time, but the former works as a simpler approximation.) This "contract" is released when the wagon is unloaded."
I disagree. By refreshing in any way, you still can change the FH destination of the cargo. For example, SM-GF,MF Metal constructions Chain. In this case, destination randomly generates and not static for each loaded car. (SM-GF or SM-MF). The same thing with OWC\OWN methane, which have many destinations.

Possible CCL integration strategy

From Wiz via discord:

Add a postfix to the RecalculateCaches method (base game), CCL calls it every time a new car is loaded, and update your cache of liveries in it. That way all CCL liveries will be included.

This might also allow RSO to not need to reference TrainCarType_to_v2. This is desirable as that dictionary relies on all vanilla rail vehicles—including newly added ones—being defined in the old TrainCarType enum, which is not guaranteed to remain true forever.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.