Skip to content

Commit

Permalink
Merge branch 'master' into ammo
Browse files Browse the repository at this point in the history
  • Loading branch information
Blundir authored May 28, 2024
2 parents b63dfde + 5197640 commit 797e690
Show file tree
Hide file tree
Showing 43 changed files with 391 additions and 159 deletions.
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 @@ -78,3 +78,6 @@
/// From /mob/living/carbon/xenomorph/proc/hivemind_talk(): (message)
#define COMSIG_XENO_TRY_HIVEMIND_TALK "xeno_try_hivemind_talk"
#define COMPONENT_OVERRIDE_HIVEMIND_TALK (1<<0)

/// used in /datum/component/status_effect/cleanse()
#define COMSIG_XENO_DEBUFF_CLEANSE "xeno_debuff_cleanse"
5 changes: 5 additions & 0 deletions code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@
// HIVE TRAITS
/// If the Hive is a Xenonid Hive
#define TRAIT_XENONID "t_xenonid"
/// if the xeno's connection to the hivemind is cut
#define TRAIT_HIVEMIND_INTERFERENCE "t_interference"
/// If the hive or xeno can use objects.
#define TRAIT_OPPOSABLE_THUMBS "t_thumbs"
/// If the Hive delays round end (this is overridden for some hives). Does not occur naturally. Must be applied in events.
Expand Down Expand Up @@ -355,6 +357,7 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_ABILITY_NO_PLASMA_TRANSFER" = TRAIT_ABILITY_NO_PLASMA_TRANSFER,
"TRAIT_ABILITY_OVIPOSITOR" = TRAIT_ABILITY_OVIPOSITOR,
"TRAIT_OPPOSABLE_THUMBS" = TRAIT_OPPOSABLE_THUMBS,
"TRAIT_INTERFERENCE" = TRAIT_HIVEMIND_INTERFERENCE,
),
/datum/hive_status = list(
"TRAIT_XENONID" = TRAIT_XENONID,
Expand Down Expand Up @@ -434,6 +437,8 @@ GLOBAL_LIST(trait_name_map)
#define TRAIT_SOURCE_TEMPORARY_MUTE "t_s_temporary_mute"
///Status trait forced by the xeno action charge
#define TRAIT_SOURCE_XENO_ACTION_CHARGE "t_s_xeno_action_charge"
///Status trait coming from hivemind interference
#define TRAIT_SOURCE_HIVEMIND_INTERFERENCE "t_s_hivemind_interference"
///Status trait coming from a xeno nest
#define XENO_NEST_TRAIT "xeno_nest"
///Status trait from a generic throw by xeno abilities
Expand Down
4 changes: 2 additions & 2 deletions code/datums/ammo/bullet/pistol.dm
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

/datum/ammo/bullet/pistol/ap/toxin/on_hit_mob(mob/M, obj/projectile/P)
. = ..()
M.AddComponent(/datum/component/toxic_buildup, acid_per_hit)
M.AddComponent(/datum/component/status_effect/toxic_buildup, acid_per_hit)

/datum/ammo/bullet/pistol/ap/toxin/on_hit_turf(turf/T, obj/projectile/P)
. = ..()
Expand Down Expand Up @@ -194,7 +194,7 @@

/datum/ammo/bullet/pistol/squash/toxin/on_hit_mob(mob/M, obj/projectile/P)
. = ..()
M.AddComponent(/datum/component/toxic_buildup, acid_per_hit)
M.AddComponent(/datum/component/status_effect/toxic_buildup, acid_per_hit)

/datum/ammo/bullet/pistol/squash/toxin/on_hit_turf(turf/T, obj/projectile/P)
. = ..()
Expand Down
2 changes: 1 addition & 1 deletion code/datums/ammo/bullet/revolver.dm
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

/datum/ammo/bullet/revolver/marksman/toxin/on_hit_mob(mob/M, obj/projectile/P)
. = ..()
M.AddComponent(/datum/component/toxic_buildup, acid_per_hit)
M.AddComponent(/datum/component/status_effect/toxic_buildup, acid_per_hit)

/datum/ammo/bullet/revolver/marksman/toxin/on_hit_turf(turf/T, obj/projectile/P)
. = ..()
Expand Down
2 changes: 1 addition & 1 deletion code/datums/ammo/bullet/rifle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

/datum/ammo/bullet/rifle/ap/toxin/on_hit_mob(mob/M, obj/projectile/P)
. = ..()
M.AddComponent(/datum/component/toxic_buildup, acid_per_hit)
M.AddComponent(/datum/component/status_effect/toxic_buildup, acid_per_hit)

/datum/ammo/bullet/rifle/ap/toxin/on_hit_turf(turf/T, obj/projectile/P)
. = ..()
Expand Down
2 changes: 1 addition & 1 deletion code/datums/ammo/bullet/smg.dm
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

/datum/ammo/bullet/smg/ap/toxin/on_hit_mob(mob/M, obj/projectile/P)
. = ..()
M.AddComponent(/datum/component/toxic_buildup, acid_per_hit)
M.AddComponent(/datum/component/status_effect/toxic_buildup, acid_per_hit)

/datum/ammo/bullet/smg/ap/toxin/on_hit_turf(turf/T, obj/projectile/P)
. = ..()
Expand Down
2 changes: 1 addition & 1 deletion code/datums/ammo/energy.dm
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@
if(isxeno(hit_mob))
var/mob/living/carbon/xenomorph/xeno = hit_mob
xeno.apply_damage(damage * 0.75, BURN)
xeno.interference = 30
xeno.AddComponent(/datum/component/status_effect/interference, 30, 30)

/datum/ammo/energy/yautja/rifle/bolt/set_bullet_traits()
. = ..()
Expand Down
27 changes: 18 additions & 9 deletions code/datums/components/healing_reduction.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ Healing above this strength will be reduced by the strength of the buildup.
Humans will take continuous damage instead.
*/

/datum/component/healing_reduction
/datum/component/status_effect/healing_reduction
dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS
var/healing_reduction = 0
var/healing_reduction_dissipation = AMOUNT_PER_TIME(1, 5 SECONDS)
var/max_buildup = 50 //up to 50 damage off of healing max by default

/datum/component/healing_reduction/Initialize(healing_reduction, healing_reduction_dissipation = AMOUNT_PER_TIME(1, 2.5 SECONDS), max_buildup = 50)
/datum/component/status_effect/healing_reduction/Initialize(healing_reduction, healing_reduction_dissipation = AMOUNT_PER_TIME(1, 2.5 SECONDS), max_buildup = 50)
if(!isxeno_human(parent))
return COMPONENT_INCOMPATIBLE
. = ..()
src.healing_reduction = healing_reduction
src.healing_reduction_dissipation = healing_reduction_dissipation
src.max_buildup = max_buildup

/datum/component/healing_reduction/InheritComponent(datum/component/healing_reduction/inherit_component, i_am_original, healing_reduction)
/datum/component/status_effect/healing_reduction/InheritComponent(datum/component/status_effect/healing_reduction/inherit_component, i_am_original, healing_reduction)
. = ..()
if(!inherit_component)
src.healing_reduction += healing_reduction
Expand All @@ -30,7 +30,12 @@ Humans will take continuous damage instead.

src.healing_reduction = min(src.healing_reduction, max_buildup)

/datum/component/healing_reduction/process(delta_time)
/datum/component/status_effect/healing_reduction/process(delta_time)
var/atom/parent_atom = parent
if(has_immunity)
parent_atom.remove_filter("healing_reduction")
return ..()

if(!parent)
qdel(src)
return
Expand All @@ -49,18 +54,17 @@ Humans will take continuous damage instead.
var/intensity = healing_reduction/max_buildup
color += num2text(MAX_ALPHA*intensity, 2, 16)

var/atom/parent_atom = parent
parent_atom.add_filter("healing_reduction", 2, list("type" = "outline", "color" = color, "size" = 1))

/datum/component/healing_reduction/RegisterWithParent()
/datum/component/status_effect/healing_reduction/RegisterWithParent()
START_PROCESSING(SSdcs, src)
RegisterSignal(parent, list(
COMSIG_XENO_ON_HEAL,
COMSIG_XENO_ON_HEAL_WOUNDS
), PROC_REF(apply_healing_reduction))
RegisterSignal(parent, COMSIG_XENO_APPEND_TO_STAT, PROC_REF(stat_append))

/datum/component/healing_reduction/UnregisterFromParent()
/datum/component/status_effect/healing_reduction/UnregisterFromParent()
STOP_PROCESSING(SSdcs, src)
UnregisterSignal(parent, list(
COMSIG_XENO_ON_HEAL,
Expand All @@ -70,12 +74,17 @@ Humans will take continuous damage instead.
var/atom/parent_atom = parent
parent_atom.remove_filter("healing_reduction")

/datum/component/healing_reduction/proc/stat_append(mob/target_mob, list/stat_list)
/datum/component/status_effect/healing_reduction/proc/stat_append(mob/target_mob, list/stat_list)
SIGNAL_HANDLER
if(has_immunity)
stat_list += "Healing Reduction Immunity: [grace_period]/[initial(grace_period)]"
return
stat_list += "Healing Reduction: [healing_reduction]/[max_buildup]"

/datum/component/healing_reduction/proc/apply_healing_reduction(mob/living/carbon/xenomorph/xeno, list/healing)
/datum/component/status_effect/healing_reduction/proc/apply_healing_reduction(mob/living/carbon/xenomorph/xeno, list/healing)
SIGNAL_HANDLER
if(has_immunity)
return
healing["healing"] -= healing_reduction

#undef MAX_ALPHA
Expand Down
29 changes: 19 additions & 10 deletions code/datums/components/speed_modifier.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

//Adjusts the speed of a xenomorph the component is on. Humans will take or heal stamina damage.

/datum/component/speed_modifier
/datum/component/status_effect/speed_modifier
dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS
var/speed_modifier = 0
var/speed_modifier_dissipation = AMOUNT_PER_TIME(1, 2.5 SECONDS)
var/max_buildup = 10
var/increase_speed = FALSE

/datum/component/speed_modifier/Initialize(speed_modifier, increase_speed = FALSE, speed_modifier_dissipation = AMOUNT_PER_TIME(1, 2.5 SECONDS), max_buildup = 10)
/datum/component/status_effect/speed_modifier/Initialize(speed_modifier, increase_speed = FALSE, speed_modifier_dissipation = AMOUNT_PER_TIME(1, 2.5 SECONDS), max_buildup = 10)
if(!isxeno_human(parent))
return COMPONENT_INCOMPATIBLE
. = ..()
Expand All @@ -19,7 +19,7 @@
src.max_buildup = max_buildup
src.increase_speed = increase_speed

/datum/component/speed_modifier/InheritComponent(datum/component/speed_modifier/C, i_am_original, speed_modifier)
/datum/component/status_effect/speed_modifier/InheritComponent(datum/component/status_effect/speed_modifier/C, i_am_original, speed_modifier)
. = ..()
if(!C)
src.speed_modifier += speed_modifier
Expand All @@ -28,7 +28,12 @@

src.speed_modifier = min(src.speed_modifier, max_buildup)

/datum/component/speed_modifier/process(delta_time)
/datum/component/status_effect/speed_modifier/process(delta_time)
var/atom/parent_atom = parent
if(has_immunity)
parent_atom.remove_filter("speed_modifier")
return ..()

if(!parent)
qdel(src)
speed_modifier = max(speed_modifier - speed_modifier_dissipation * delta_time, 0)
Expand All @@ -47,15 +52,14 @@
var/intensity = speed_modifier/max_buildup
color += num2text(MAX_ALPHA*intensity, 2, 16)

var/atom/A = parent
A.add_filter("speed_modifier", 2, list("type" = "outline", "color" = color, "size" = 1))
parent_atom.add_filter("speed_modifier", 2, list("type" = "outline", "color" = color, "size" = 1))

/datum/component/speed_modifier/RegisterWithParent()
/datum/component/status_effect/speed_modifier/RegisterWithParent()
START_PROCESSING(SSdcs, src)
RegisterSignal(parent, COMSIG_XENO_MOVEMENT_DELAY, PROC_REF(apply_speed_modifier))
RegisterSignal(parent, COMSIG_XENO_APPEND_TO_STAT, PROC_REF(stat_append))

/datum/component/speed_modifier/UnregisterFromParent()
/datum/component/status_effect/speed_modifier/UnregisterFromParent()
STOP_PROCESSING(SSdcs, src)
UnregisterSignal(parent, list(
COMSIG_XENO_MOVEMENT_DELAY,
Expand All @@ -64,15 +68,20 @@
var/atom/A = parent
A.remove_filter("speed_modifier")

/datum/component/speed_modifier/proc/stat_append(mob/M, list/L)
/datum/component/status_effect/speed_modifier/proc/stat_append(mob/M, list/L)
SIGNAL_HANDLER
if(has_immunity)
L += "Slow immunity: [grace_period]/[initial(grace_period)]"
return
if(!increase_speed)
L += "Slow: [speed_modifier]/[max_buildup]"
else
L += "Speed Boost: [speed_modifier]/[max_buildup]"

/datum/component/speed_modifier/proc/apply_speed_modifier(mob/living/carbon/xenomorph/X, list/speeds)
/datum/component/status_effect/speed_modifier/proc/apply_speed_modifier(mob/living/carbon/xenomorph/X, list/speeds)
SIGNAL_HANDLER
if(has_immunity)
return
if(!increase_speed)
speeds["speed"] += speed_modifier * 0.075
else //increasing speed is more effective than decreasing speed
Expand Down
23 changes: 23 additions & 0 deletions code/datums/components/status_effect_component.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//exists only to handle immunities for now

/datum/component/status_effect
var/has_immunity = FALSE
var/grace_period = 30

/datum/component/status_effect/InheritComponent(datum/component/C, i_am_original)
if(has_immunity)
grace_period = min(grace_period + 1, initial(grace_period))

/datum/component/status_effect/Initialize()
. = ..()
RegisterSignal(parent, list(COMSIG_XENO_DEBUFF_CLEANSE, COMSIG_LIVING_REJUVENATED), PROC_REF(cleanse))

/datum/component/status_effect/proc/cleanse()
SIGNAL_HANDLER
has_immunity = TRUE

/datum/component/status_effect/process(delta_time)
if(has_immunity)
grace_period -= 1 * delta_time
if(grace_period <= 0)
qdel(src)
30 changes: 20 additions & 10 deletions code/datums/components/toxin_buildup.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/datum/component/toxic_buildup
/datum/component/status_effect/toxic_buildup
dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS
var/toxic_buildup = 0
var/toxic_buildup_dissipation = AMOUNT_PER_TIME(5, 10 SECONDS)
Expand All @@ -7,13 +7,14 @@
var/max_alpha = 35
var/glow_color = "#00ff00"

/datum/component/toxic_buildup/Initialize(toxic_buildup, toxic_buildup_dissipation = AMOUNT_PER_TIME(1, 3 SECONDS), max_buildup = 75)
/datum/component/status_effect/toxic_buildup/Initialize(toxic_buildup, toxic_buildup_dissipation = AMOUNT_PER_TIME(1, 3 SECONDS), max_buildup = 75)
. = ..()
src.toxic_buildup = toxic_buildup
src.toxic_buildup_dissipation = toxic_buildup_dissipation
src.max_buildup = max_buildup
to_chat(parent, SPAN_XENOHIGHDANGER("The toxic substance damages our armor!"))

/datum/component/toxic_buildup/InheritComponent(datum/component/toxic_buildup/C, i_am_original, toxic_buildup)
/datum/component/status_effect/toxic_buildup/InheritComponent(datum/component/status_effect/toxic_buildup/C, i_am_original, toxic_buildup)
. = ..()
if(!C)
src.toxic_buildup += toxic_buildup
Expand All @@ -22,7 +23,12 @@

src.toxic_buildup = min(src.toxic_buildup, max_buildup)

/datum/component/toxic_buildup/process(delta_time)
/datum/component/status_effect/toxic_buildup/process(delta_time)
var/atom/parent_atom = parent
if(has_immunity)
parent_atom.remove_filter("toxic_buildup")
return ..()

toxic_buildup = max(toxic_buildup - toxic_buildup_dissipation * delta_time, 0)

if(ishuman(parent))
Expand All @@ -37,18 +43,17 @@
color += num2text(max_alpha*intensity, 2, 16)

if(parent)
var/atom/A = parent
A.add_filter("toxic_buildup", 2, list("type" = "outline", "color" = color, "size" = 1))
parent_atom.add_filter("toxic_buildup", 2, list("type" = "outline", "color" = color, "size" = 1))

/datum/component/toxic_buildup/RegisterWithParent()
/datum/component/status_effect/toxic_buildup/RegisterWithParent()
START_PROCESSING(SSdcs, src)
RegisterSignal(parent, list(
COMSIG_XENO_PRE_CALCULATE_ARMOURED_DAMAGE_PROJECTILE,
COMSIG_XENO_PRE_APPLY_ARMOURED_DAMAGE
), PROC_REF(apply_toxic_buildup))
RegisterSignal(parent, COMSIG_XENO_APPEND_TO_STAT, PROC_REF(stat_append))

/datum/component/toxic_buildup/UnregisterFromParent()
/datum/component/status_effect/toxic_buildup/UnregisterFromParent()
STOP_PROCESSING(SSdcs, src)
UnregisterSignal(parent, list(
COMSIG_XENO_PRE_CALCULATE_ARMOURED_DAMAGE_PROJECTILE,
Expand All @@ -58,10 +63,15 @@
var/atom/A = parent
A.remove_filter("toxic_buildup")

/datum/component/toxic_buildup/proc/stat_append(mob/M, list/L)
/datum/component/status_effect/toxic_buildup/proc/stat_append(mob/M, list/L)
SIGNAL_HANDLER
if(has_immunity)
L += "Toxin Buildup immunity [grace_period]/[initial(grace_period)]"
return
L += "Toxin Buildup: [toxic_buildup]/[max_buildup]"

/datum/component/toxic_buildup/proc/apply_toxic_buildup(mob/living/carbon/xenomorph/X, list/damagedata)
/datum/component/status_effect/toxic_buildup/proc/apply_toxic_buildup(mob/living/carbon/xenomorph/X, list/damagedata)
SIGNAL_HANDLER
if(has_immunity)
return
damagedata["armor"] = max(damagedata["armor"] - toxic_buildup, 0)
Loading

0 comments on commit 797e690

Please sign in to comment.