Files
Paradise/code/__DEFINES/rust.dm
T
Charlie NolanGitHubBurzahparadisess13[bot] <165046124+paradisess13[bot]@users.noreply.github.com>
e6f99049f6 MILLA phase 2 (#27659)
* MILLA phase 2

* Lint.

* Build Rust library

* Assorted bugfixes and tweaks

* Simplify fire mechanics and make hotspot sending to DM more reliable.

* Assorted tweaks, fixed an issue in the core engine and removed the softcap it made necesary.

* SM fixes, slower plasmafire, less overpowered pyro anomalies, and air alarm improvements.

* Review fixes.

* Build Rust library

* Unbalanced icon.

* Rebalance immovable rods.

* Unbalanced has alerts, can fight airflow (but get slowed)

* Build Rust library

* Stronger space cooling, slower temperature flow, faster burns, burnt floors, and a hotspot display fix.

* Build Rust library

* Tweaks to avoid merge conflict

* Oops.

* Build Rust library

* Rebalance wind.

* Rebalance temperature flow and space cooling.

* Fix gas flamethrower.

* Build Rust library

* Make air push slowdown directional, so you don't get slowed while moving with the air.

* Variable name cleanup.

* Reduce the speed of wind pushes.

* Prevent wind pushes from breaking your pull.

* Prevent swaps during wind push.

* Made supermatter crytals reliably run last in atmos machinery.

* Sped up plasmafire burning, but dropped the minimum burn amount.

* Rebalanced SM heat output.

* Rebalanced pyro anomaly.

* Build Rust library

* Lint

* Build Rust library

* Uncap fuel burnt readout.

* Added Custom air alarm mode, dropped Refill cap to ONE_ATMOSPHERE.

* Updated air alarm modes to use pressure settings instead of ONE_ATMOSPHERE

* Added a list of areas not in Filtering to atmos alert computer.

* Increase pressure gradient and vent output, especially at low distro pressure.

* Changed Immovable Rod from Moderate to Major.

* Lint

* Build Rust library

* More lint!

* Build Rust library

* Magboots, scaled slowdown, and nukie borg immunity

* Wind image

* Wind v2

* Wind v3

* pngcrush

* pngcrush again

* Moved hotspot removal into SSair, add wind effect.

* Lint

* Build Rust library

* Fix hotspots.

* Hotspot visual based on gas burnt

* Build Rust library

* Scaled wind to gas amount, stopped first wind push while moving.

* Made Rust panic logging safer.

* Made MILLA full tick and sleep timers more honest.

* Pressure overlay, ghost mode, atmos goggles.

* Build Rust library

* Lint

* Build Rust library

* More lint-y stuff.

* Build Rust library

* Repair pressure overlay if it loses its loc.

* Bind pressure overlays to their tile better.

* Build Rust library

* Make the pressure overlay work on z=1 and not proliferate effects.

* Don't block the supply shuttle.

* Don't fine for special effects.

* Maybe don't fine for ghosts, either.

* Build Rust library

* Make pressure overlay play nice with shuttles.

* Build Rust library

* Pressure scanning for borgs.

* Build Rust library

* Lint

* Build Rust library

* Made explosions not generate so much wind.

* Removed an old and non-functional proc.

* Clientless mobs can get pushed again.

* Build Rust library

* cargo fmt

* Build Rust library

* Don't divide by zero.

* Plasmafire generator for the Shadow

* Update shadow to use plasmafire generators

* Fix shadow's plasmafire generators going out on depart.

* Prevent heat2color from runtiming at absolute zero.

* Better nanofrost

* Build Rust library

* Singularity immunity

* Build Rust library

* Add back meson mode to atmospheric scanner goggles, so they don't stare deeply into the SM

* Build Rust library

* Dump panic outputs into data/ instead.

* Build Rust library

* Apply suggestions from code review

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
Signed-off-by: Charlie Nolan <funnyman3595@gmail.com>

* Saner handling of MILLA crash.

* Build Rust library

---------

Signed-off-by: Charlie Nolan <funnyman3595@gmail.com>
Co-authored-by: paradisess13[bot] <165046124+paradisess13[bot]@users.noreply.github.com>
Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
2025-01-01 20:12:05 +00:00

166 lines
6.5 KiB
Plaintext

// DM API for Rust extension modules
// Current modules:
// - MILLA, an asynchronous replacement for BYOND atmos
// - Mapmanip, a parse-time DMM file reader and modifier
// Default automatic library detection.
// Look for it in the build location first, then in `.`, then in standard places.
/* This comment bypasses grep checks */ /var/__rustlib
// IF we are on the production box, use a dll that has 0 compatibility of working with normal people's CPUs
// This works by allowing rust to compile with modern x86 instructionns, instead of compiling for a pentium 4
// This has the potential for significant speed upgrades with SIMD and similar
#ifdef PARADISE_PRODUCTION_HARDWARE
#define RUSTLIBS_SUFFIX "_prod"
#else
#define RUSTLIBS_SUFFIX ""
#endif
/proc/__detect_rustlib()
if(world.system_type == UNIX)
#ifdef CIBUILDING
// CI override, use librustlibs_ci.so if possible.
if(fexists("./tools/ci/librustlibs_ci.so"))
return __rustlib = "tools/ci/librustlibs_ci.so"
#endif
// First check if it's built in the usual place.
if(fexists("./rust/target/i686-unknown-linux-gnu/release/librustlibs[RUSTLIBS_SUFFIX].so"))
return __rustlib = "./rust/target/i686-unknown-linux-gnu/release/librustlibs[RUSTLIBS_SUFFIX].so"
// Then check in the current directory.
if(fexists("./librustlibs[RUSTLIBS_SUFFIX].so"))
return __rustlib = "./librustlibs[RUSTLIBS_SUFFIX].so"
// And elsewhere.
return __rustlib = "librustlibs[RUSTLIBS_SUFFIX].so"
else
// First check if it's built in the usual place.
if(fexists("./rust/target/i686-pc-windows-msvc/release/rustlibs[RUSTLIBS_SUFFIX].dll"))
return __rustlib = "./rust/target/i686-pc-windows-msvc/release/rustlibs[RUSTLIBS_SUFFIX].dll"
// Then check in the current directory.
if(fexists("./rustlibs[RUSTLIBS_SUFFIX].dll"))
return __rustlib = "./rustlibs[RUSTLIBS_SUFFIX].dll"
// And elsewhere.
var/assignment_confirmed = (__rustlib = "rustlibs[RUSTLIBS_SUFFIX].dll")
// This being spanned over multiple lines is kinda scuffed, but its needed because of https://www.byond.com/forum/post/2072419
return assignment_confirmed
#define RUSTLIB (__rustlib || __detect_rustlib())
#define RUSTLIB_CALL(func, args...) call_ext(RUSTLIB, "byond:[#func]_ffi")(args)
// This needs to go BELOW the above define, otherwise the BYOND compiler can make the above immediate call disappear
#undef RUSTLIBS_SUFFIX
/// Exists by default in 516, but needs to be defined for 515 or byondapi-rs doesn't like it.
/proc/byondapi_stack_trace(err)
CRASH(err)
/proc/milla_init_z(z)
return RUSTLIB_CALL(milla_initialize, z)
/proc/set_tile_atmos(turf/T, airtight_north, airtight_east, airtight_south, airtight_west, atmos_mode, environment_id, oxygen, carbon_dioxide, nitrogen, toxins, sleeping_agent, agent_b, temperature, innate_heat_capacity, hotspot_temperature, hotspot_volume)
return RUSTLIB_CALL(milla_set_tile, T, airtight_north, airtight_east, airtight_south, airtight_west, atmos_mode, environment_id, oxygen, carbon_dioxide, nitrogen, toxins, sleeping_agent, agent_b, temperature, innate_heat_capacity, hotspot_temperature, hotspot_volume)
/proc/get_tile_atmos(turf/T, list/L)
return RUSTLIB_CALL(milla_get_tile, T, L)
/proc/spawn_milla_tick_thread()
return RUSTLIB_CALL(milla_spawn_tick_thread)
/proc/get_milla_tick_time()
return RUSTLIB_CALL(milla_get_tick_time)
/proc/get_interesting_atmos_tiles()
return RUSTLIB_CALL(milla_get_interesting_tiles)
/proc/get_tracked_pressure_tiles()
return RUSTLIB_CALL(milla_get_tracked_pressure_tiles)
/proc/reduce_superconductivity(turf/T, list/superconductivity)
var/north = superconductivity[1]
var/east = superconductivity[2]
var/south = superconductivity[3]
var/west = superconductivity[4]
return RUSTLIB_CALL(milla_reduce_superconductivity, T, north, east, south, west)
/proc/reset_superconductivity(turf/T)
return RUSTLIB_CALL(milla_reset_superconductivity, T)
/proc/set_tile_airtight(turf/T, list/airtight)
var/north = airtight[1]
var/east = airtight[2]
var/south = airtight[3]
var/west = airtight[4]
return RUSTLIB_CALL(milla_set_tile_airtight, T, north, east, south, west)
/proc/create_hotspot(turf/T, hotspot_temperature, hotspot_volume)
return RUSTLIB_CALL(milla_create_hotspot, T, hotspot_temperature, hotspot_volume)
/proc/track_pressure_tiles(atom/A, radius)
var/turf/T = get_turf(A)
if(istype(T))
return RUSTLIB_CALL(milla_track_pressure_tiles, T, radius)
/proc/get_random_interesting_tile()
return RUSTLIB_CALL(milla_get_random_interesting_tile)
/proc/create_environment(oxygen, carbon_dioxide, nitrogen, toxins, sleeping_agent, agent_b, temperature)
return RUSTLIB_CALL(milla_create_environment, oxygen, carbon_dioxide, nitrogen, toxins, sleeping_agent, agent_b, temperature)
/proc/mapmanip_read_dmm(mapname)
return RUSTLIB_CALL(mapmanip_read_dmm_file, mapname)
#undef RUSTLIB
#undef RUSTLIB_CALL
// Indexes for Tiles and InterestingTiles
// Must match the order in milla/src/model.rs
#define MILLA_INDEX_AIRTIGHT_DIRECTIONS 1
#define MILLA_INDEX_OXYGEN 2
#define MILLA_INDEX_CARBON_DIOXIDE 3
#define MILLA_INDEX_NITROGEN 4
#define MILLA_INDEX_TOXINS 5
#define MILLA_INDEX_SLEEPING_AGENT 6
#define MILLA_INDEX_AGENT_B 7
#define MILLA_INDEX_ATMOS_MODE 8
#define MILLA_INDEX_ENVIRONMENT_ID 9
#define MILLA_INDEX_SUPERCONDUCTIVITY_NORTH 10
#define MILLA_INDEX_SUPERCONDUCTIVITY_EAST 11
#define MILLA_INDEX_SUPERCONDUCTIVITY_SOUTH 12
#define MILLA_INDEX_SUPERCONDUCTIVITY_WEST 13
#define MILLA_INDEX_INNATE_HEAT_CAPACITY 14
#define MILLA_INDEX_TEMPERATURE 15
#define MILLA_INDEX_HOTSPOT_TEMPERATURE 16
#define MILLA_INDEX_HOTSPOT_VOLUME 17
#define MILLA_INDEX_WIND_X 18
#define MILLA_INDEX_WIND_Y 19
#define MILLA_INDEX_FUEL_BURNT 20
/// The number of values per tile.
#define MILLA_TILE_SIZE MILLA_INDEX_FUEL_BURNT
// These are only for InterestingTiles.
#define MILLA_INDEX_TURF 21
#define MILLA_INDEX_INTERESTING_REASONS 22
#define MILLA_INDEX_AIRFLOW_X 23
#define MILLA_INDEX_AIRFLOW_Y 24
/// The number of values per interesting tile.
#define MILLA_INTERESTING_TILE_SIZE MILLA_INDEX_AIRFLOW_Y
/// Interesting because it needs a display update.
#define MILLA_INTERESTING_REASON_DISPLAY (1 << 0)
/// Interesting because it's hot enough to start a fire. Excludes normal-temperature Lavaland tiles without an active fire.
#define MILLA_INTERESTING_REASON_HOT (1 << 1)
/// Interesting because it has wind that can push stuff around.
#define MILLA_INTERESTING_REASON_WIND (1 << 2)
#define MILLA_NORTH (1 << 0)
#define MILLA_EAST (1 << 1)
#define MILLA_SOUTH (1 << 2)
#define MILLA_WEST (1 << 3)