Compatibility with Cargo Ships deep sea oil

Replaces resource spawning system, so that the distances between resources are much bigger. Railway is needed then.

Moderators: orzelek, Dark

robot256
Filter Inserter
Filter Inserter
Posts: 899
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Compatibility with Cargo Ships deep sea oil

Post by robot256 »

The Cargo Ships mod includes oil deposits that spawn in water for extraction by oil rigs and ships. I need some advice for how to improve this and how to ensure compatibility with RSO. I recently took over maintaining the scripts, and this was my first attempt at resource modifications.

Before my rewrite last year, Cargo Ships placed oil randomly as chunks were generated, so they were not based on the map seed at all. I changed vanilla oil to generate on both land and sea, then convert ones generated on water into the different "deep oil" entity. I did this because I couldn't really figure out how to add a new resource setting that would only generate on water. There is also a setting for "no oil on land", which makes CS delete any oil that spawns on land when the chunk is generated.

With RSO installed, this usually works the first time the map is generated. Default resource generation is disabled, RSO places oil in land and water, and CS deletes or replaces it as needed.

So my two questions are,
1. Do you have any advice for a better way to make a resource generate only on water in vanilla; and

2. What is the best way to achieve proper combatibility with RSO and deep sea oil generation?

Edit: orzelek, feel free to PM me if you would rather discuss this there. I'd be very grateful for any advice you can give. Thanks!
Edit2: the "no oil on land" works after all, but the preview is wrong of course. Still interested in any general tips.
orzelek
Smart Inserter
Smart Inserter
Posts: 3923
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: Compatibility with Cargo Ships deep sea oil

Post by orzelek »

1. AFAIK you can make your resource use generation copied from oil and attach collision mask to it to collide with ground_layer to make it spawn only on water.

2. Doing above would mean adding config to it for RSO would work and should spawn only in water.

If above 2 steps won't work then it gets tricky. One of issues is that RSO is not guaranteed to add resource exaclty inside generated chunk - it can be in one of neighboring chunks (or farther if resource patch is big). This might affect your mod if it searches for oil wells using generated_chunk event in the chunk that was generated.
Post Reply

Return to “Resource Spawner Overhaul”