mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Merge pull request #13290 from VOREStation/upstream-merge-8660
[MIRROR] Adds some core behavior code, uses it to fix a small bug (ABLE TO BE MERGED)
This commit is contained in:
@@ -34,7 +34,7 @@ PROCESSING_SUBSYSTEM_DEF(instruments)
|
|||||||
|
|
||||||
/datum/controller/subsystem/processing/instruments/proc/initialize_instrument_data()
|
/datum/controller/subsystem/processing/instruments/proc/initialize_instrument_data()
|
||||||
for(var/datum/instrument/I as anything in subtypesof(/datum/instrument))
|
for(var/datum/instrument/I as anything in subtypesof(/datum/instrument))
|
||||||
if(initial(I.abstract_type) == I)
|
if(initial(I.instrument_type) == I)
|
||||||
continue
|
continue
|
||||||
I = new I
|
I = new I
|
||||||
I.Initialize()
|
I.Initialize()
|
||||||
|
|||||||
53
code/core/atom/Transform.dm
Normal file
53
code/core/atom/Transform.dm
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
/// The atom's base transform scale for width.
|
||||||
|
/atom/var/tf_scale_x
|
||||||
|
|
||||||
|
/// The atom's base transform scale for height.
|
||||||
|
/atom/var/tf_scale_y
|
||||||
|
|
||||||
|
/// The atom's base transform scale for rotation.
|
||||||
|
/atom/var/tf_rotation
|
||||||
|
|
||||||
|
/// The atom's base transform scale for horizontal offset.
|
||||||
|
/atom/var/tf_offset_x
|
||||||
|
|
||||||
|
/// The atom's base transform scale for vertical offset.
|
||||||
|
/atom/var/tf_offset_y
|
||||||
|
|
||||||
|
|
||||||
|
/// Clear the atom's tf_* variables and the current transform state.
|
||||||
|
/atom/proc/ClearTransform()
|
||||||
|
tf_scale_x = null
|
||||||
|
tf_scale_y = null
|
||||||
|
tf_rotation = null
|
||||||
|
tf_offset_x = null
|
||||||
|
tf_offset_y = null
|
||||||
|
transform = null
|
||||||
|
|
||||||
|
|
||||||
|
/// Sets the atom's tf_* variables and the current transform state, also applying others if supplied.
|
||||||
|
/atom/proc/SetTransform(
|
||||||
|
scale,
|
||||||
|
scale_x = tf_scale_x,
|
||||||
|
scale_y = tf_scale_y,
|
||||||
|
rotation = tf_rotation,
|
||||||
|
offset_x = tf_offset_x,
|
||||||
|
offset_y = tf_offset_y,
|
||||||
|
list/others
|
||||||
|
)
|
||||||
|
if (!isnull(scale))
|
||||||
|
tf_scale_x = scale
|
||||||
|
tf_scale_y = scale
|
||||||
|
else
|
||||||
|
tf_scale_x = scale_x
|
||||||
|
tf_scale_y = scale_y
|
||||||
|
tf_rotation = rotation
|
||||||
|
tf_offset_x = offset_x
|
||||||
|
tf_offset_y = offset_y
|
||||||
|
transform = matrix().Update(
|
||||||
|
scale_x = tf_scale_x,
|
||||||
|
scale_y = tf_scale_y,
|
||||||
|
rotation = tf_rotation,
|
||||||
|
offset_x = tf_offset_x,
|
||||||
|
offset_y = tf_offset_y,
|
||||||
|
others = others
|
||||||
|
)
|
||||||
23
code/core/datum/IsAbstract.dm
Normal file
23
code/core/datum/IsAbstract.dm
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/**
|
||||||
|
* Abstract-ness is a meta-property of a class that is used to indicate
|
||||||
|
* that the class is intended to be used as a base class for others, and
|
||||||
|
* should not (or cannot) be instantiated.
|
||||||
|
* We have no such language concept in DM, and so we provide a datum member
|
||||||
|
* that can be used to hint at abstractness for circumstances where we would
|
||||||
|
* like that to be the case, such as base behavior providers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/// If set, a path at/above this one that expects not to be instantiated.
|
||||||
|
/datum/var/abstract_type
|
||||||
|
|
||||||
|
/// If true, this datum is an instance of an abstract type. Oops.
|
||||||
|
/datum/proc/IsAbstract()
|
||||||
|
SHOULD_NOT_OVERRIDE(TRUE)
|
||||||
|
return type == abstract_type
|
||||||
|
|
||||||
|
/// Passed a path or instance, returns whether it is abstract. Otherwise null.
|
||||||
|
/proc/is_abstract(datum/thing)
|
||||||
|
if (ispath(thing))
|
||||||
|
return thing == initial(thing.abstract_type)
|
||||||
|
if (istype(thing))
|
||||||
|
return thing.IsAbstract()
|
||||||
53
code/core/image/Transform.dm
Normal file
53
code/core/image/Transform.dm
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
/// The image's base transform scale for width.
|
||||||
|
/image/var/tf_scale_x
|
||||||
|
|
||||||
|
/// The image's base transform scale for height.
|
||||||
|
/image/var/tf_scale_y
|
||||||
|
|
||||||
|
/// The image's base transform scale for rotation.
|
||||||
|
/image/var/tf_rotation
|
||||||
|
|
||||||
|
/// The image's base transform scale for horizontal offset.
|
||||||
|
/image/var/tf_offset_x
|
||||||
|
|
||||||
|
/// The image's base transform scale for vertical offset.
|
||||||
|
/image/var/tf_offset_y
|
||||||
|
|
||||||
|
|
||||||
|
/// Clear the image's tf_* variables and the current transform state.
|
||||||
|
/image/proc/ClearTransform()
|
||||||
|
tf_scale_x = null
|
||||||
|
tf_scale_y = null
|
||||||
|
tf_rotation = null
|
||||||
|
tf_offset_x = null
|
||||||
|
tf_offset_y = null
|
||||||
|
transform = null
|
||||||
|
|
||||||
|
|
||||||
|
/// Sets the image's tf_* variables and the current transform state, also applying others if supplied.
|
||||||
|
/image/proc/SetTransform(
|
||||||
|
scale,
|
||||||
|
scale_x = tf_scale_x,
|
||||||
|
scale_y = tf_scale_y,
|
||||||
|
rotation = tf_rotation,
|
||||||
|
offset_x = tf_offset_x,
|
||||||
|
offset_y = tf_offset_y,
|
||||||
|
list/others
|
||||||
|
)
|
||||||
|
if (!isnull(scale))
|
||||||
|
tf_scale_x = scale
|
||||||
|
tf_scale_y = scale
|
||||||
|
else
|
||||||
|
tf_scale_x = scale_x
|
||||||
|
tf_scale_y = scale_y
|
||||||
|
tf_rotation = rotation
|
||||||
|
tf_offset_x = offset_x
|
||||||
|
tf_offset_y = offset_y
|
||||||
|
transform = matrix().Update(
|
||||||
|
scale_x = tf_scale_x,
|
||||||
|
scale_y = tf_scale_y,
|
||||||
|
rotation = tf_rotation,
|
||||||
|
offset_x = tf_offset_x,
|
||||||
|
offset_y = tf_offset_y,
|
||||||
|
others = others
|
||||||
|
)
|
||||||
27
code/core/matrix/Transform.dm
Normal file
27
code/core/matrix/Transform.dm
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
/// Clears the matrix's a-f variables to identity.
|
||||||
|
/matrix/proc/Clear()
|
||||||
|
a = 1
|
||||||
|
b = 0
|
||||||
|
c = 0
|
||||||
|
d = 0
|
||||||
|
e = 1
|
||||||
|
f = 0
|
||||||
|
return src
|
||||||
|
|
||||||
|
|
||||||
|
/// Runs Scale, Turn, and Translate if supplied parameters, then multiplies by others if set.
|
||||||
|
/matrix/proc/Update(scale_x, scale_y, rotation, offset_x, offset_y, list/others)
|
||||||
|
var/x_null = isnull(scale_x)
|
||||||
|
var/y_null = isnull(scale_y)
|
||||||
|
if (!x_null || !y_null)
|
||||||
|
Scale(x_null ? 1 : scale_x, y_null ? 1 : scale_y)
|
||||||
|
if (!isnull(rotation))
|
||||||
|
Turn(rotation)
|
||||||
|
if (offset_x || offset_y)
|
||||||
|
Translate(offset_x || 0, offset_y || 0)
|
||||||
|
if (islist(others))
|
||||||
|
for (var/other in others)
|
||||||
|
Multiply(other)
|
||||||
|
else if (others)
|
||||||
|
Multiply(others)
|
||||||
|
return src
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
// The actual modifiers (if used) for these are stored inside code/modules/mob/_modifiers/traits.dm
|
// The actual modifiers (if used) for these are stored inside code/modules/mob/_modifiers/traits.dm
|
||||||
|
|
||||||
/datum/trait/modifier
|
/datum/trait/modifier
|
||||||
|
abstract_type = /datum/trait/modifier
|
||||||
var/modifier_type = null // Type to add to the mob post spawn.
|
var/modifier_type = null // Type to add to the mob post spawn.
|
||||||
|
|
||||||
/datum/trait/modifier/apply_trait_post_spawn(mob/living/L)
|
/datum/trait/modifier/apply_trait_post_spawn(mob/living/L)
|
||||||
@@ -26,6 +27,7 @@
|
|||||||
|
|
||||||
// Physical traits are what they sound like, and involve the character's physical body, as opposed to their mental state.
|
// Physical traits are what they sound like, and involve the character's physical body, as opposed to their mental state.
|
||||||
/datum/trait/modifier/physical
|
/datum/trait/modifier/physical
|
||||||
|
abstract_type = /datum/trait/modifier/physical
|
||||||
name = "Physical"
|
name = "Physical"
|
||||||
category = "Physical"
|
category = "Physical"
|
||||||
|
|
||||||
@@ -198,6 +200,7 @@
|
|||||||
// 'Mental' traits are just those that only sapients can have, for now, and generally involves fears.
|
// 'Mental' traits are just those that only sapients can have, for now, and generally involves fears.
|
||||||
// So far, all of them are just for fluff/don't have mechanical effects.
|
// So far, all of them are just for fluff/don't have mechanical effects.
|
||||||
/datum/trait/modifier/mental
|
/datum/trait/modifier/mental
|
||||||
|
abstract_type = /datum/trait/modifier/mental
|
||||||
name = "Mental"
|
name = "Mental"
|
||||||
category = "Mental"
|
category = "Mental"
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ var/list/trait_categories = list() // The categories available for the trait men
|
|||||||
/hook/startup/proc/populate_trait_list()
|
/hook/startup/proc/populate_trait_list()
|
||||||
|
|
||||||
//create a list of trait datums
|
//create a list of trait datums
|
||||||
for(var/trait_type in typesof(/datum/trait) - list(/datum/trait, /datum/trait/modifier))
|
for(var/trait_type as anything in subtypesof(/datum/trait))
|
||||||
|
if (is_abstract(trait_type))
|
||||||
|
continue
|
||||||
var/datum/trait/T = new trait_type
|
var/datum/trait/T = new trait_type
|
||||||
if(!T.is_available())
|
if(!T.is_available())
|
||||||
qdel(T)
|
qdel(T)
|
||||||
@@ -144,6 +146,7 @@ var/list/trait_categories = list() // The categories available for the trait men
|
|||||||
|
|
||||||
|
|
||||||
/datum/trait
|
/datum/trait
|
||||||
|
abstract_type = /datum/trait
|
||||||
var/name = null // Name to show on UI
|
var/name = null // Name to show on UI
|
||||||
var/desc = null // Description of what it does, also shown on UI.
|
var/desc = null // Description of what it does, also shown on UI.
|
||||||
var/list/mutually_exclusive = list() // List of trait types which cannot be taken alongside this trait.
|
var/list/mutually_exclusive = list() // List of trait types which cannot be taken alongside this trait.
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
/// Category
|
/// Category
|
||||||
var/category = "Unsorted"
|
var/category = "Unsorted"
|
||||||
/// Used for categorization subtypes
|
/// Used for categorization subtypes
|
||||||
var/abstract_type = /datum/instrument
|
var/instrument_type = /datum/instrument
|
||||||
/// Write here however many samples, follow this syntax: "%note num%"='%sample file%' eg. "27"='synthesizer/e2.ogg'. Key must never be lower than 0 and higher than 127
|
/// Write here however many samples, follow this syntax: "%note num%"='%sample file%' eg. "27"='synthesizer/e2.ogg'. Key must never be lower than 0 and higher than 127
|
||||||
var/list/real_samples
|
var/list/real_samples
|
||||||
/// assoc list key = /datum/instrument_key. do not fill this yourself!
|
/// assoc list key = /datum/instrument_key. do not fill this yourself!
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/datum/instrument/brass
|
/datum/instrument/brass
|
||||||
name = "Generic brass instrument"
|
name = "Generic brass instrument"
|
||||||
category = "Brass"
|
category = "Brass"
|
||||||
abstract_type = /datum/instrument/brass
|
instrument_type = /datum/instrument/brass
|
||||||
|
|
||||||
/datum/instrument/brass/crisis_section
|
/datum/instrument/brass/crisis_section
|
||||||
name = "Crisis Brass Section"
|
name = "Crisis Brass Section"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/datum/instrument/chromatic
|
/datum/instrument/chromatic
|
||||||
name = "Generic chromatic percussion instrument"
|
name = "Generic chromatic percussion instrument"
|
||||||
category = "Chromatic percussion"
|
category = "Chromatic percussion"
|
||||||
abstract_type = /datum/instrument/chromatic
|
instrument_type = /datum/instrument/chromatic
|
||||||
|
|
||||||
/datum/instrument/chromatic/vibraphone1
|
/datum/instrument/chromatic/vibraphone1
|
||||||
name = "Crisis Vibraphone"
|
name = "Crisis Vibraphone"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/datum/instrument/fun
|
/datum/instrument/fun
|
||||||
name = "Generic Fun Instrument"
|
name = "Generic Fun Instrument"
|
||||||
category = "Fun"
|
category = "Fun"
|
||||||
abstract_type = /datum/instrument/fun
|
instrument_type = /datum/instrument/fun
|
||||||
|
|
||||||
/datum/instrument/fun/honk
|
/datum/instrument/fun/honk
|
||||||
name = "!!HONK!!"
|
name = "!!HONK!!"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/datum/instrument/guitar
|
/datum/instrument/guitar
|
||||||
name = "Generic guitar-like instrument"
|
name = "Generic guitar-like instrument"
|
||||||
category = "Guitar"
|
category = "Guitar"
|
||||||
abstract_type = /datum/instrument/guitar
|
instrument_type = /datum/instrument/guitar
|
||||||
|
|
||||||
/datum/instrument/guitar/steel_crisis
|
/datum/instrument/guitar/steel_crisis
|
||||||
name = "Crisis Steel String Guitar"
|
name = "Crisis Steel String Guitar"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
//SONGS WILL BE AUTOMATICALLY SWITCHED TO LEGACY MODE IF THEY USE THIS KIND OF INSTRUMENT!
|
//SONGS WILL BE AUTOMATICALLY SWITCHED TO LEGACY MODE IF THEY USE THIS KIND OF INSTRUMENT!
|
||||||
//I'd prefer these stayed. They sound different from the mechanical synthesis of synthed instruments, and I quite like them that way. It's not legacy, it's hardcoded, old style. - kevinz000
|
//I'd prefer these stayed. They sound different from the mechanical synthesis of synthed instruments, and I quite like them that way. It's not legacy, it's hardcoded, old style. - kevinz000
|
||||||
/datum/instrument/hardcoded
|
/datum/instrument/hardcoded
|
||||||
abstract_type = /datum/instrument/hardcoded
|
instrument_type = /datum/instrument/hardcoded
|
||||||
category = "Non-Synthesized"
|
category = "Non-Synthesized"
|
||||||
instrument_flags = INSTRUMENT_LEGACY
|
instrument_flags = INSTRUMENT_LEGACY
|
||||||
volume_multiplier = 1 //not as loud as synth'd
|
volume_multiplier = 1 //not as loud as synth'd
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/datum/instrument/organ
|
/datum/instrument/organ
|
||||||
name = "Generic organ"
|
name = "Generic organ"
|
||||||
category = "Organ"
|
category = "Organ"
|
||||||
abstract_type = /datum/instrument/organ
|
instrument_type = /datum/instrument/organ
|
||||||
|
|
||||||
/datum/instrument/organ/crisis_church
|
/datum/instrument/organ/crisis_church
|
||||||
name = "Crisis Church Organ"
|
name = "Crisis Church Organ"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/datum/instrument/piano
|
/datum/instrument/piano
|
||||||
name = "Generic piano"
|
name = "Generic piano"
|
||||||
category = "Piano"
|
category = "Piano"
|
||||||
abstract_type = /datum/instrument/piano
|
instrument_type = /datum/instrument/piano
|
||||||
|
|
||||||
/datum/instrument/piano/fluid_piano
|
/datum/instrument/piano/fluid_piano
|
||||||
name = "FluidR3 Grand Piano"
|
name = "FluidR3 Grand Piano"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/datum/instrument/tones
|
/datum/instrument/tones
|
||||||
name = "Ideal tone"
|
name = "Ideal tone"
|
||||||
category = "Tones"
|
category = "Tones"
|
||||||
abstract_type = /datum/instrument/tones
|
instrument_type = /datum/instrument/tones
|
||||||
|
|
||||||
/datum/instrument/tones/square_wave
|
/datum/instrument/tones/square_wave
|
||||||
name = "Ideal square wave"
|
name = "Ideal square wave"
|
||||||
|
|||||||
@@ -322,6 +322,10 @@
|
|||||||
#include "code\controllers\subsystems\processing\processing.dm"
|
#include "code\controllers\subsystems\processing\processing.dm"
|
||||||
#include "code\controllers\subsystems\processing\projectiles.dm"
|
#include "code\controllers\subsystems\processing\projectiles.dm"
|
||||||
#include "code\controllers\subsystems\processing\turfs.dm"
|
#include "code\controllers\subsystems\processing\turfs.dm"
|
||||||
|
#include "code\core\atom\Transform.dm"
|
||||||
|
#include "code\core\datum\IsAbstract.dm"
|
||||||
|
#include "code\core\image\Transform.dm"
|
||||||
|
#include "code\core\matrix\Transform.dm"
|
||||||
#include "code\datums\ai_law_sets.dm"
|
#include "code\datums\ai_law_sets.dm"
|
||||||
#include "code\datums\ai_law_sets_vr.dm"
|
#include "code\datums\ai_law_sets_vr.dm"
|
||||||
#include "code\datums\ai_laws.dm"
|
#include "code\datums\ai_laws.dm"
|
||||||
|
|||||||
Reference in New Issue
Block a user