Paradise icon indicating copy to clipboard operation
Paradise copied to clipboard

refactor: Datumizes ore.

Open warriorstar-orion opened this issue 4 months ago • 0 comments

What Does This PR Do

This PR:

  1. Turns the ore contents of mineral walls from a set of attributes on the mineral wall type into separate datums that can be set for a given wall.
  2. Creates an UpdatePaths script for relevant map changes and applies it.
  3. Refactors some of the admin logs around gibtonite mining, utilizing log macros.

I believe I did the calculations for the gibtonite countdown correctly to match the original implementation, but I'm probably missing something, or shouldn't be keying it to world.time, or some similar oversight. My read of the original code is that the detonation countdown is anywhere from 4 to 5 seconds (det_time = rand(8, 10)) because the detonation countdown is spun off to another thread which calls sleep(5), ticking down that value every half-second.

Why It's Good For The Game

ChangeTurf is an expensive operation, even during mapload when most important behavior is deferred until AfterChange. By datumizing ores, the MTPC for /turf/simulated/mineral/random/Initialize() has been reduced by 40%, resulting in a commensurate speedup from 5.5s to 3.1s over the course of mapload (locally):

image

image

It also reduces the needless amount of subtypes, which had turned into a combinatoric explosion of every permutation of ore type, ore randomness weights, and mineral atmos environment:

2024_10_09__18_47_10__● Projects_Paradise Station_PR Descriptions_ore datumization md - Writing - Visu

2024_10_09__18_48_41__code_game_turfs_simulated_minerals dm - Paradise (Workspace) - Visual Studio Cod

From 36 distinct subtypes, we now have 15.

Testing

Copius lavaland spawning, as well as learning that /obj/item/mining_scanner/admin didn't and quite possibly has never worked.

A little more testing of gibtonite needed since that's the most complex ore.


Declaration

  • [X] I confirm that I either do not require pre-approval for this PR, or I have obtained such approval and have included a screenshot to demonstrate this below.

Changelog

NPFC

warriorstar-orion avatar Oct 10 '24 00:10 warriorstar-orion