mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-11 10:22:13 +00:00
* bay instruments * k * AAA * remove that * changes * Update _instrument_key.dm * safety nets * @ghommie fixed * volume * Update item.dm * Update item.dm Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
21 lines
638 B
Plaintext
21 lines
638 B
Plaintext
/datum/instrument_key
|
|
var/key //1 to 127
|
|
var/sample //file
|
|
var/frequency //frequency generated
|
|
var/deviation //deviation up/down towards pivot from sample (??)
|
|
|
|
/datum/instrument_key/New(sample = src.sample, key = src.key, deviation = src.deviation, frequency = src.frequency)
|
|
src.sample = sample
|
|
src.key = key
|
|
src.deviation = deviation
|
|
src.frequency = frequency
|
|
if(!frequency && deviation)
|
|
calculate()
|
|
|
|
/datum/instrument_key/proc/calculate()
|
|
if(!deviation)
|
|
CRASH("Invalid calculate call: No deviation or sample in instrument_key")
|
|
#define KEY_TWELTH (1/12)
|
|
frequency = 2 ** (KEY_TWELTH * deviation)
|
|
#undef KEY_TWELTH
|