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

Revive Fixes for Boiler: IFF Gas and Cause Data #3577

Merged
merged 16 commits into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions code/datums/effects/neurotoxin.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@
/// Stamina damage per tick. Major balance number.
var/stam_dam = 7

/datum/effects/neurotoxin/New(atom/thing)
..(thing)
cause_data = create_cause_data("neurotoxic gas")
/datum/effects/neurotoxin/New(atom/thing, mob/from = null)
..(thing, from, effect_name)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not entirely sure why this is preferable to

Suggested change
..(thing, from, effect_name)
. = ..()
cause_data = create_cause_data(effect_name)

generally messing with the ..() signature can result in some particularly weird issues - but if this is fixing an issue i'm overlooking lmk

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parent constructor takes four arguments, this constructor is taking two: but in the case of this we want the third argument to always be effect_name and we don't care about the fourth argument.

Also the cause_data should contain the mob from.

Ultimately changing this will mean we waste the construction of cause_data in the parent because we need to redo it if we don't provide those three arguments to the parent constructor.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently reverted this change since I think its better to reduce the amount of times cause_data is constructed.


/datum/effects/neurotoxin/validate_atom(atom/thing)
if(isxeno(thing) || isobj(thing))
Expand All @@ -36,9 +35,10 @@
var/mob/living/carbon/affected_mob = affected_atom
if(!.)
return FALSE
if(affected_mob.stat)
if(affected_mob.stat == DEAD)
return
// General effects
affected_mob.last_damage_data = cause_data
affected_mob.apply_stamina_damage(stam_dam)
affected_mob.make_dizzy(12)

Expand Down
3 changes: 2 additions & 1 deletion code/game/objects/effects/effect_system/chemsmoke.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
// Culls the selected turfs to a (roughly) circle shape, then calls smokeFlow() to make
// sure the smoke can actually path to the turfs. This culls any turfs it can't reach.
//------------------------------------------
/datum/effect_system/smoke_spread/chem/set_up(datum/reagents/carry = null, n = 10, c = 0, loca, direct)
/datum/effect_system/smoke_spread/chem/set_up(datum/reagents/carry = null, n = 10, c = 0, loca, direct, datum/cause_data/new_cause_data)
cause_data = istype(new_cause_data) ? new_cause_data : cause_data
range = n * 0.3
cardinals = c
carry.copy_to(chemholder, carry.total_volume)
Expand Down
16 changes: 8 additions & 8 deletions code/game/objects/effects/effect_system/smoke.dm
Original file line number Diff line number Diff line change
Expand Up @@ -283,14 +283,14 @@
var/gas_damage = 20

/obj/effect/particle_effect/smoke/xeno_burn/Initialize(mapload, amount, datum/cause_data/cause_data)
var/mob/living/carbon/xenomorph/xeno = cause_data?.resolve_mob()
if (istype(xeno) && xeno.hivenumber)
hivenumber = xeno.hivenumber

set_hive_data(src, hivenumber)

. = ..()
if(istype(cause_data))
var/datum/ui_state/hive_state/cause_data_hive_state = GLOB.hive_state[cause_data.faction]
var/new_hive_number = cause_data_hive_state?.hivenumber
if(new_hive_number)
hivenumber = new_hive_number
set_hive_data(src, new_hive_number)

return ..()

/obj/effect/particle_effect/smoke/xeno_burn/apply_smoke_effect(turf/T)
..()
Expand Down Expand Up @@ -387,7 +387,7 @@
if(!issynth(moob))
var/datum/effects/neurotoxin/neuro_effect = locate() in moob.effects_list
if(!neuro_effect)
neuro_effect = new /datum/effects/neurotoxin(moob)
neuro_effect = new(moob, cause_data.resolve_mob())
neuro_effect.strength = effect_amt
neuro_effect.duration += neuro_dose
if(moob.coughedtime != 1 && !moob.stat) //Coughing/gasping
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@
spicy_gas = new /datum/effect_system/smoke_spread/xeno_weaken
else
CRASH("Globber has unknown ammo [xeno.ammo]! Oh no!")
spicy_gas.set_up(1, 0, get_turf(xeno), null, 6)
var/datum/cause_data/cause_data = create_cause_data("acid shroud gas", owner)
spicy_gas.set_up(1, 0, get_turf(xeno), null, 6, new_cause_data = cause_data)
spicy_gas.start()
to_chat(xeno, SPAN_XENOHIGHDANGER("You dump your acid through your pores, creating a shroud of gas!"))
for (var/action_type in action_types_to_cd)
Expand All @@ -166,9 +167,9 @@
if(!actually_moving)
return

var/obj/effect/particle_effect/smoke/S = new /obj/effect/particle_effect/smoke/xeno_burn(get_turf(mover), 1, create_cause_data(initial(mover.caste_type), mover))
S.time_to_live = 3
S.spread_speed = 1000000
var/obj/effect/particle_effect/smoke/xeno_burn/smoke_effect = new(get_turf(mover), 1, create_cause_data("dumped acid gas", mover))
smoke_effect.time_to_live = 3
smoke_effect.spread_speed = 1000000

/datum/action/xeno_action/onclick/dump_acid/remove_from()
remove_speed_buff()
Expand Down Expand Up @@ -283,27 +284,25 @@
apply_cooldown()
return ..()

/datum/action/xeno_action/activable/acid_shotgun/use_ability(atom/A)
var/mob/living/carbon/xenomorph/X = owner
if (!istype(X))
/datum/action/xeno_action/activable/acid_shotgun/use_ability(atom/target)
var/mob/living/carbon/xenomorph/xeno = owner
if (!istype(xeno))
return

if (!action_cooldown_check())
return

if(!A || A.layer >= FLY_LAYER || !isturf(X.loc) || !X.check_state())
if(!target || target.layer >= FLY_LAYER || !isturf(xeno.loc) || !xeno.check_state())
return

X.visible_message(SPAN_XENOWARNING("The [X] fires a blast of acid at [A]!"), SPAN_XENOWARNING("You fire a blast of acid at [A]!"))

var/turf/target = locate(A.x, A.y, A.z)
var/obj/item/projectile/P = new /obj/item/projectile(X.loc, create_cause_data(initial(X.caste_type), X))
xeno.visible_message(SPAN_XENOWARNING("The [xeno] fires a blast of acid at [target]!"), SPAN_XENOWARNING("You fire a blast of acid at [target]!"))

var/turf/target_turf = locate(target.x, target.y, target.z)
var/obj/item/projectile/proj = new(xeno.loc, create_cause_data("acid shotgun", xeno))
var/datum/ammo/ammoDatum = new ammo_type()

P.generate_bullet(ammoDatum)

P.fire_at(target, X, X, ammoDatum.max_range, ammoDatum.shell_speed)
proj.generate_bullet(ammoDatum)
proj.fire_at(target_turf, xeno, xeno, ammoDatum.max_range, ammoDatum.shell_speed)

apply_cooldown()
return ..()
Expand Down Expand Up @@ -347,7 +346,7 @@
else if(stabbing_xeno.ammo == GLOB.ammo_list[/datum/ammo/xeno/boiler_gas])
var/datum/effects/neurotoxin/neuro_effect = locate() in carbon_target.effects_list
if(!neuro_effect)
neuro_effect = new /datum/effects/neurotoxin(carbon_target)
neuro_effect = new(carbon_target, owner)
neuro_effect.duration += 16
to_chat(carbon_target,SPAN_HIGHDANGER("You are injected with something from [stabbing_xeno]'s tailstab!"))
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -760,12 +760,12 @@
SPAN_XENOWARNING("You spit a [xeno.ammo.name] at [atom]!") )
playsound(xeno.loc, sound_to_play, 25, 1)

var/obj/item/projectile/proj = new (current_turf, create_cause_data(xeno.ammo.name, xeno))
proj.generate_bullet(xeno.ammo)
proj.permutated += xeno
proj.def_zone = xeno.get_limbzone_target()
proj.fire_at(spit_target, xeno, xeno, xeno.ammo.max_range, xeno.ammo.shell_speed)

var/obj/item/projectile/Proj = new (current_turf, create_cause_data(initial(xeno.caste_type), xeno))
Proj.generate_bullet(xeno.ammo)
Proj.permutated += xeno
Proj.def_zone = xeno.get_limbzone_target()
Proj.fire_at(spit_target, xeno, xeno, xeno.ammo.max_range, xeno.ammo.shell_speed)
spitting = FALSE

SEND_SIGNAL(xeno, COMSIG_XENO_POST_SPIT)
Expand Down
6 changes: 3 additions & 3 deletions code/modules/mob/living/carbon/xenomorph/death.dm
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@

switch(caste.caste_type) //This will need to be changed later, when we have proper xeno pathing. Might do it on caste or something.
if(XENO_CASTE_BOILER)
var/mob/living/carbon/xenomorph/boiler/B = src
var/mob/living/carbon/xenomorph/boiler/src_boiler = src
visible_message(SPAN_DANGER("[src] begins to bulge grotesquely, and explodes in a cloud of corrosive gas!"))
B.smoke.set_up(2, 0, get_turf(src))
B.smoke.start()
src_boiler.smoke.set_up(2, 0, get_turf(src), new_cause_data = src_boiler.smoke.cause_data)
src_boiler.smoke.start()
remains.icon_state = "gibbed-a-corpse"
if(XENO_CASTE_RUNNER)
remains.icon_state = "gibbed-a-corpse-runner"
Expand Down
7 changes: 4 additions & 3 deletions code/modules/projectiles/ammo_datums.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2740,7 +2740,7 @@
return
var/datum/effects/neurotoxin/neuro_effect = locate() in moob.effects_list
if(!neuro_effect)
neuro_effect = new /datum/effects/neurotoxin(moob)
neuro_effect = new /datum/effects/neurotoxin(moob, proj.firer)
neuro_effect.duration += 5
moob.apply_effect(3, DAZE)
to_chat(moob, SPAN_HIGHDANGER("Neurotoxic liquid spreads all over you and immediately soaks into your pores and orifices! Oh fuck!")) // Fucked up but have a chance to escape rather than being game-ended
Expand All @@ -2763,9 +2763,10 @@

/datum/ammo/xeno/boiler_gas/proc/drop_nade(turf/turf, obj/item/projectile/proj)
var/lifetime_mult = 1.0
var/datum/cause_data
if(isboiler(proj.firer))
smoke_system.cause_data = proj.weapon_cause_data
smoke_system.set_up(smokerange, 0, turf)
cause_data = proj.weapon_cause_data
smoke_system.set_up(smokerange, 0, turf, new_cause_data = cause_data)
smoke_system.lifetime = 12 * lifetime_mult
smoke_system.start()
turf.visible_message(SPAN_DANGER("A glob of acid lands with a splat and explodes into noxious fumes!"))
Expand Down