Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/tg/ Status effects part 1 - fluid status updates #4828

Merged
merged 65 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
aae4b6c
WIP
fira Nov 2, 2023
3266b3e
fixes
fira Nov 2, 2023
39eb055
adjustments
fira Nov 3, 2023
86705c1
more fixes
fira Nov 3, 2023
9249933
srsly CI
fira Nov 3, 2023
e158f90
Merge branch 'master' into tg-effects-1123
fira Nov 4, 2023
b7f5956
conflict fix
fira Nov 4, 2023
8b47687
typo chloroform
fira Nov 4, 2023
d587c68
remove now unused resting procs
fira Nov 5, 2023
cd8e217
move stop pulling logic
fira Nov 5, 2023
af2854c
oopsie
fira Nov 5, 2023
614185d
Merge branch 'master' into tg-effects-1123
fira Nov 7, 2023
f7e0bde
transform fixes
fira Nov 7, 2023
dd9b2dc
AGH
fira Nov 7, 2023
e14781f
fix xeno immobilized overlay bein shown too often
fira Nov 7, 2023
152d696
add snowflake ignore check for projectiles and nests
fira Nov 7, 2023
f8e985f
you can't do this to me
fira Nov 7, 2023
716d9e6
so embarassing
fira Nov 7, 2023
d72fcc9
Refactor Freeze
fira Nov 8, 2023
ee1bc99
small oopsie
fira Nov 8, 2023
fd6a8da
WIP
fira Nov 9, 2023
261d685
comment revert
fira Nov 9, 2023
ecc0fd6
useless src
fira Nov 9, 2023
65be7a2
explicit ui_data
fira Nov 9, 2023
f974e82
Merge branch 'master' into tg-effects-prelude-freeze
fira Nov 9, 2023
e503e46
Merge branch 'master' into tg-effects-1123
fira Nov 9, 2023
fe450ec
minute adjustments
fira Nov 9, 2023
72637f9
merged doubled init
fira Nov 9, 2023
37f3a29
animation fix
fira Nov 9, 2023
9037518
Merge branch 'tg-effects-prelude-freeze' into tg-effects-1123
fira Nov 9, 2023
f26d91b
bugfix
fira Nov 9, 2023
b0a9fe8
Merge branch 'tg-effects-prelude-living' into tg-effects-1123
fira Nov 9, 2023
ee19848
small memory change
fira Nov 9, 2023
2393c4d
fix merge accidents and two bugs
fira Nov 9, 2023
aeb375b
add missing handler
fira Nov 9, 2023
45283be
Merge branch 'master' into tg-effects-prelude-freeze
fira Nov 13, 2023
99491e4
Merge branch 'tg-effects-prelude-freeze' into tg-effects-1123
fira Nov 13, 2023
9425267
WIP
fira Nov 13, 2023
651974a
watch this blow up
fira Nov 13, 2023
54bea03
reverted sent changes
fira Nov 13, 2023
ddb1ff6
missing trait in trait list
fira Nov 13, 2023
084c827
explicit explosion stun
fira Nov 13, 2023
2eaeec0
Merge branch 'master' into tg-effects-1123
fira Nov 16, 2023
b4a7332
double trait
fira Nov 16, 2023
a6ecfcd
review fixes
fira Nov 17, 2023
935d77d
comment removal
fira Nov 17, 2023
f5390a3
fix incorrect logic for welding goggles
fira Nov 19, 2023
7890da1
fix double seats, probably
fira Nov 19, 2023
39af3a7
fix buckled movement probably
fira Nov 19, 2023
617580a
rest cd
fira Nov 20, 2023
7d4a9fa
fix welding mask logic
fira Nov 20, 2023
863589c
bugfixes
fira Nov 20, 2023
f63732c
stasis bag safety check
fira Nov 20, 2023
cef8d44
fix roundstart nesting angle
fira Nov 20, 2023
442a4ff
resting doesnt prevent opening xeno tacmap anymore
fira Nov 20, 2023
62d5b98
fix freeze overlay on nested
fira Nov 20, 2023
e86e71e
Merge branch 'master' into tg-effects-1123
fira Nov 20, 2023
f753342
Merge branch 'master' into tg-effects-1123
fira Nov 20, 2023
3016d51
remove random offset on buckled
fira Nov 21, 2023
0091b02
fix missing animation parallel causing knock to cancel some others
fira Nov 21, 2023
8f794cf
Merge branch 'master' into tg-effects-1123
fira Nov 22, 2023
d5be1f3
fix species limbs and falling over during creation
fira Nov 24, 2023
2122188
consistency fix
fira Nov 24, 2023
30b6443
Merge branch 'master' into tg-effects-1123
fira Nov 25, 2023
bb1226a
a noob, i am
fira Nov 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions code/__DEFINES/assert.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#undef ASSERT

/// Override BYOND's native ASSERT to optionally specify a message
#define ASSERT(condition, message...) \
if (!(condition)) { \
CRASH(assertion_message(__FILE__, __LINE__, #condition, ##message)) \
}

/proc/assertion_message(file, line, condition, message)
if (!isnull(message))
message = " - [message]"

return "[file]:[line]:Assertion failed: [condition][message]"
5 changes: 5 additions & 0 deletions code/__DEFINES/dcs/signals/atom/mob/living/signals_living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,8 @@
/// From /mob/living/Collide(): (atom/A)
#define COMSIG_LIVING_PRE_COLLIDE "living_pre_collide"
#define COMPONENT_LIVING_COLLIDE_HANDLED (1<<0)

///from base of mob/living/set_buckled(): (new_buckled)
#define COMSIG_LIVING_SET_BUCKLED "living_set_buckled"
///from base of mob/living/set_body_position()
#define COMSIG_LIVING_SET_BODY_POSITION "living_set_body_position"
3 changes: 3 additions & 0 deletions code/__DEFINES/dcs/signals/atom/mob/living/signals_xeno.dm
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,6 @@

/// For any additional things that should happen when a xeno's melee_attack_additional_effects_self() proc is called
#define COMSIG_XENO_SLASH_ADDITIONAL_EFFECTS_SELF "xeno_slash_additional_effects_self"

/// Cancels all running cloaking effects on target
#define COMSIG_MOB_EFFECT_CLOAK_CANCEL "mob_effect_cloak_cancel"
8 changes: 2 additions & 6 deletions code/__DEFINES/dcs/signals/atom/mob/signals_mob.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
///from base of mob/set_stat(): (new_stat, old_stat)
#define COMSIG_MOB_STATCHANGE "mob_statchange"
/// From /obj/structure/machinery/door/airlock/proc/take_damage
#define COMSIG_MOB_DESTROY_AIRLOCK "mob_destroy_airlock"

Expand Down Expand Up @@ -35,10 +37,6 @@
#define COMSIG_MOB_FIRED_GUN_ATTACHMENT "mob_fired_gun_attachment"
/// From /mob/proc/death
#define COMSIG_MOB_DEATH "mob_death"
/// From /mob/proc/update_canmove()
#define COMSIG_MOB_GETTING_UP "mob_getting_up"
/// From /mob/proc/update_canmove()
#define COMSIG_MOB_KNOCKED_DOWN "mob_knocked_down"
/// For when a mob is dragged
#define COMSIG_MOB_DRAGGED "mob_dragged"
/// From /obj/item/proc/unequipped()
Expand Down Expand Up @@ -84,8 +82,6 @@
//from /mob/proc/on_deafness_loss()
#define COMSIG_MOB_REGAINED_HEARING "mob_regained_hearing"

#define COMSIG_MOB_POST_UPDATE_CANMOVE "mob_can_move"

#define COMSIG_ATTEMPT_MOB_PULL "attempt_mob_pull"
#define COMPONENT_CANCEL_MOB_PULL (1<<0)

Expand Down
26 changes: 26 additions & 0 deletions code/__DEFINES/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -418,3 +418,29 @@ var/list/default_xeno_onmob_icons = list(
#define EXTREMITY_LIMBS list("l_leg","l_foot","r_leg","r_foot","l_arm","l_hand","r_arm","r_hand")
#define CORE_LIMBS list("chest","head","groin")

// Body position defines.
/// Mob is standing up, usually associated with lying_angle value of 0.
#define STANDING_UP 0
/// Mob is lying down, usually associated with lying_angle values of 90 or 270.
#define LYING_DOWN 1

/// Possible value of [/atom/movable/buckle_lying]. If set to a different (positive-or-zero) value than this, the buckling thing will force a lying angle on the buckled.
#define NO_BUCKLE_LYING -1

// ====================================
// /mob/living /tg/ mobility_flags
// These represent in what capacity the mob is capable of moving
// Because porting this is underway, NOT ALL FLAGS ARE CURRENTLY IN.

/// can move
#define MOBILITY_MOVE (1<<0)
/// can, and is, standing up
#define MOBILITY_STAND (1<<1)
/// can rest
#define MOBILITY_REST (1<<7)
/// can lie down
#define MOBILITY_LIEDOWN (1<<8)

#define MOBILITY_FLAGS_DEFAULT (MOBILITY_MOVE | MOBILITY_STAND)
#define MOBILITY_FLAGS_CARBON_DEFAULT (MOBILITY_MOVE | MOBILITY_STAND | MOBILITY_REST | MOBILITY_LIEDOWN)
#define MOBILITY_FLAGS_REST_CAPABLE_DEFAULT (MOBILITY_MOVE | MOBILITY_STAND | MOBILITY_REST | MOBILITY_LIEDOWN)
160 changes: 107 additions & 53 deletions code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
@@ -1,84 +1,94 @@
//shamelessly ripped from TG
#define SIGNAL_ADDTRAIT(trait_ref) "addtrait [trait_ref]"
#define SIGNAL_REMOVETRAIT(trait_ref) "removetrait [trait_ref]"

// trait accessor defines
//here be dragons
#define ADD_TRAIT(target, trait, source) \
do { \
var/list/_L; \
if (!target.status_traits) { \
target.status_traits = list(); \
_L = target.status_traits; \
if (!target._status_traits) { \
target._status_traits = list(); \
_L = target._status_traits; \
_L[trait] = list(source); \
SEND_SIGNAL(target, SIGNAL_ADDTRAIT(trait), trait); \
if(trait in GLOB.traits_with_elements){ \
target.AddElement(GLOB.traits_with_elements[trait]); \
} \
} else { \
_L = target.status_traits; \
_L = target._status_traits; \
if (_L[trait]) { \
_L[trait] |= list(source); \
} else { \
_L[trait] = list(source); \
SEND_SIGNAL(target, SIGNAL_ADDTRAIT(trait), trait); \
if(trait in GLOB.traits_with_elements){ \
target.AddElement(GLOB.traits_with_elements[trait]); \
} \
} \
} \
} while (0)
#define REMOVE_TRAIT(target, trait, sources) \
do { \
var/list/_L = target.status_traits; \
var/list/_L = target._status_traits; \
var/list/_S; \
if (sources && !islist(sources)) { \
_S = list(sources); \
} else { \
_S = sources\
}; \
if (_L && _L[trait]) { \
if (_L?[trait]) { \
for (var/_T in _L[trait]) { \
if ((!_S && (_T != TRAIT_SOURCE_QUIRK)) || (_T in _S)) { \
if ((!_S && (_T != ROUNDSTART_TRAIT)) || (_T in _S)) { \
_L[trait] -= _T \
} \
};\
if (!length(_L[trait])) { \
_L -= trait; \
SEND_SIGNAL(target, SIGNAL_REMOVETRAIT(trait), trait); \
if(trait in GLOB.traits_with_elements) { \
target.RemoveElement(GLOB.traits_with_elements[trait]); \
} \
}; \
if (!length(_L)) { \
target.status_traits = null \
target._status_traits = null \
}; \
} \
} while (0)
#define REMOVE_TRAIT_NOT_FROM(target, trait, sources) \
do { \
var/list/_traits_list = target._status_traits; \
var/list/_sources_list; \
if (sources && !islist(sources)) { \
_sources_list = list(sources); \
} else { \
_sources_list = sources\
}; \
if (_traits_list?[trait]) { \
for (var/_trait_source in _traits_list[trait]) { \
if (!(_trait_source in _sources_list)) { \
_traits_list[trait] -= _trait_source \
} \
};\
if (!length(_traits_list[trait])) { \
_traits_list -= trait; \
SEND_SIGNAL(target, SIGNAL_REMOVETRAIT(trait), trait); \
}; \
if (!length(_traits_list)) { \
target._status_traits = null \
}; \
} \
} while (0)
#define REMOVE_TRAITS_NOT_IN(target, sources) \
do { \
var/list/_L = target.status_traits; \
var/list/_L = target._status_traits; \
var/list/_S = sources; \
if (_L) { \
for (var/_T in _L) { \
_L[_T] &= _S;\
if (!length(_L[_T])) { \
_L -= _T; \
SEND_SIGNAL(target, SIGNAL_REMOVETRAIT(_T), _T); \
if(_T in GLOB.traits_with_elements) { \
target.RemoveElement(GLOB.traits_with_elements[_T]); \
}; \
};\
};\
if (!length(_L)) { \
target.status_traits = null\
target._status_traits = null\
};\
}\
} while (0)

#define REMOVE_TRAITS_IN(target, sources) \
do { \
var/list/_L = target.status_traits; \
var/list/_L = target._status_traits; \
var/list/_S = sources; \
if (sources && !islist(sources)) { \
_S = list(sources); \
Expand All @@ -91,46 +101,37 @@
if (!length(_L[_T])) { \
_L -= _T; \
SEND_SIGNAL(target, SIGNAL_REMOVETRAIT(_T)); \
if(_T in GLOB.traits_with_elements) { \
target.RemoveElement(GLOB.traits_with_elements[_T]); \
}; \
};\
};\
if (!length(_L)) { \
target.status_traits = null\
target._status_traits = null\
};\
}\
} while (0)

/// Will 100% nuke a trait regardless of source. Preferably use this as little as possible
#define REMOVE_TRAIT_ALLSOURCES(target, trait) \
do { \
var/list/_L = target.status_traits; \
if (_L?[trait]) { \
if (length(_L)) { \
_L -= trait; \
SEND_SIGNAL(target, SIGNAL_REMOVETRAIT(trait), trait); \
}; \
else { \
target.status_traits = null \
}; \
} \
} while (0)

#define HAS_TRAIT(target, trait) (target.status_traits ? (target.status_traits[trait] ? TRUE : FALSE) : FALSE)
#define HAS_TRAIT_FROM(target, trait, source) (target.status_traits ? (target.status_traits[trait] ? (source in target.status_traits[trait]) : FALSE) : FALSE)
#define HAS_TRAIT_FROM_ONLY(target, trait, source) (\
target.status_traits ?\
(target.status_traits[trait] ?\
((source in target.status_traits[trait]) && (length(target.status_traits) == 1))\
: FALSE)\
: FALSE)
#define HAS_TRAIT_NOT_FROM(target, trait, source) (target.status_traits ? (target.status_traits[trait] ? (length(target.status_traits[trait] - source) > 0) : FALSE) : FALSE)
#define HAS_TRAIT(target, trait) (target._status_traits?[trait] ? TRUE : FALSE)
#define HAS_TRAIT_FROM(target, trait, source) (HAS_TRAIT(target, trait) && (source in target._status_traits[trait]))
#define HAS_TRAIT_FROM_ONLY(target, trait, source) (HAS_TRAIT(target, trait) && (source in target._status_traits[trait]) && (length(target._status_traits[trait]) == 1))
#define HAS_TRAIT_NOT_FROM(target, trait, source) (HAS_TRAIT(target, trait) && (length(target._status_traits[trait] - source) > 0))
/// Returns a list of trait sources for this trait. Only useful for wacko cases and internal futzing
/// You should not be using this
#define GET_TRAIT_SOURCES(target, trait) (target._status_traits?[trait] || list())
/// Returns the amount of sources for a trait. useful if you don't want to have a "thing counter" stuck around all the time
#define COUNT_TRAIT_SOURCES(target, trait) length(GET_TRAIT_SOURCES(target, trait))
/// A simple helper for checking traits in a mob's mind
#define HAS_MIND_TRAIT(target, trait) (HAS_TRAIT(target, trait) || (target.mind ? HAS_TRAIT(target.mind, trait) : FALSE))


/// Example trait
// #define TRAIT_X "t_x"

/// cannot be removed without admin intervention
#define ROUNDSTART_TRAIT "roundstart"

//-- mob traits --
/// Apply this to make a mob not dense, and remove it when you want it to no longer make them undense, other sorces of undesity will still apply. Always define a unique source when adding a new instance of this!
#define TRAIT_UNDENSE "undense"

// SPECIES TRAITS
/// Knowledge of Yautja technology
#define TRAIT_YAUTJA_TECH "t_yautja_tech"
Expand All @@ -145,6 +146,14 @@
/// Makes it impossible to strip the inventory of this mob.
#define TRAIT_UNSTRIPPABLE "t_unstrippable"

/// Forces the user to stay unconscious.
#define TRAIT_KNOCKEDOUT "knockedout"
/// Prevents voluntary movement.
#define TRAIT_IMMOBILIZED "immobilized"
/// Prevents voluntary standing or staying up on its own.
#define TRAIT_FLOORED "floored"
#define TRAIT_INCAPACITATED "incapacitated"

// HIVE TRAITS
/// If the Hive is a Xenonid Hive
#define TRAIT_XENONID "t_xenonid"
Expand Down Expand Up @@ -279,6 +288,10 @@ GLOBAL_LIST_INIT(mob_traits, list(
*/
GLOBAL_LIST_INIT(traits_by_type, list(
/mob = list(
"TRAIT_KNOCKEDOUT" = TRAIT_KNOCKEDOUT,
"TRAIT_IMMOBILIZED" = TRAIT_IMMOBILIZED,
"TRAIT_FLOORED" = TRAIT_FLOORED,
"TRAIT_UNDENSE" = TRAIT_UNDENSE,
"TRAIT_YAUTJA_TECH" = TRAIT_YAUTJA_TECH,
"TRAIT_SUPER_STRONG" = TRAIT_SUPER_STRONG,
"TRAIT_FOREIGN_BIO" = TRAIT_FOREIGN_BIO,
Expand Down Expand Up @@ -379,6 +392,8 @@ GLOBAL_LIST(trait_name_map)
#define TRAIT_SOURCE_ABILITY(ability) "t_s_ability_[ability]"
///Status trait forced by the xeno action charge
#define TRAIT_SOURCE_XENO_ACTION_CHARGE "t_s_xeno_action_charge"
///Status trait coming from a xeno nest
#define XENO_NEST_TRAIT "xeno_nest"
//-- structure traits --
///Status trait coming from being flipped or unflipped.
#define TRAIT_SOURCE_FLIP_TABLE "t_s_flip_table"
Expand All @@ -390,3 +405,42 @@ GLOBAL_LIST(trait_name_map)

//Status trait coming from clothing.
#define TRAIT_SOURCE_CLOTHING "t_s_clothing"

/// trait associated to being buckled
#define BUCKLED_TRAIT "buckled" // Yes the name doesn't conform. /tg/ appears to have changed naming style inbetween
/// trait source when an effect is coming from a fakedeath effect (refactor this)
#define FAKEDEATH_TRAIT "fakedeath"
/// trait source where a condition comes from body state
#define BODY_TRAIT "body"
/// Trait associated to lying down (having a [lying_angle] of a different value than zero).
#define LYING_DOWN_TRAIT "lying-down"
/// trait associated to a stat value or range of
#define STAT_TRAIT "stat"
/// trait effect related to the queen ovipositor
#define OVIPOSITOR_TRAIT "ovipositor"
/// trait effect related to active specialist gear
#define SPECIALIST_GEAR_TRAIT "specialist_gear"
/// trait associated to being held in a chokehold
#define CHOKEHOLD_TRAIT "chokehold"
/// traits associated with usage of snowflake dropship double seats
#define DOUBLE_SEATS_TRAIT "double_seats"
/// traits associated with xeno on-ground weeds
#define XENO_WEED_TRAIT "xeno_weed"
/// traits associated with actively interacted machinery
#define INTERACTION_TRAIT "interaction"
/// traits bound by stunned status effects
#define STUNNED_TRAIT "stunned"
/// traits bound by knocked_down status effect
#define KNOCKEDDOWN_TRAIT "knockeddown"
/// traits bound by knocked_out status effect
#define KNOCKEDOUT_TRAIT "knockedout"
/// traits from being pounced
#define POUNCED_TRAIT "pounced"
/// traits added by manual intervention
#define ADMIN_ACTION_TRAIT "admin_action"
/// traits from cloroform usage
#define CLOROFORM_TRAIT "cloroform"
/// traits from step_triggers on the map
#define STEP_TRIGGER_TRAIT "step_trigger"
/// traits from hacked machine interactions
#define HACKED_TRAIT "hacked"
2 changes: 2 additions & 0 deletions code/__HELPERS/animations.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/// The duration of the animate call in mob/living/update_transform
#define UPDATE_TRANSFORM_ANIMATION_TIME (0.2 SECONDS)
7 changes: 0 additions & 7 deletions code/__HELPERS/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,6 @@
if(I.assignment in GLOB.joblist) return I.assignment
return "Unknown"

/proc/FindNameFromID(mob/living/carbon/human/H)
ASSERT(istype(H))
var/obj/item/card/id/I = H.wear_id
if(istype(I)) return I.registered_name
I = H.get_active_hand()
if(istype(I)) return I.registered_name

/proc/get_all_job_icons() return GLOB.joblist + list("Prisoner")//For all existing HUD icons

/obj/proc/GetJobName() //Used in secHUD icon generation
Expand Down
1 change: 1 addition & 0 deletions code/__HELPERS/status_effects.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#define TRAIT_STATUS_EFFECT(effect_id) "[effect_id]-trait"
Loading
Loading