Skip to content

Commit

Permalink
Gas Update
Browse files Browse the repository at this point in the history
  • Loading branch information
realforest2001 committed Sep 7, 2023
1 parent 5d5f73d commit e78b760
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 14 deletions.
1 change: 1 addition & 0 deletions code/__DEFINES/atmospherics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ var/MAX_EXPLOSION_RANGE = 14
/// Used in /obj/structure/pipes/vents/proc/create_gas
#define VENT_GAS_SMOKE "Smoke"
#define VENT_GAS_CN20 "CN20 Nerve Gas"
#define VENT_GAS_CN20_XENO "CN20-X Nerve Gas"
3 changes: 3 additions & 0 deletions code/__DEFINES/vv.dm
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,6 @@
#define VV_HK_TOGGLEPOWER "togglepower"

#define VV_HK_ADD_ITEMS_TO_VENDOR "add_items_to_vendor"

// /obj/structure/pipes/vents
#define VV_HK_GAS "release_gas"
66 changes: 52 additions & 14 deletions code/game/objects/effects/effect_system/smoke.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
qdel(src)
return
else if(time_to_live == 1)
alpha = 180
if(alpha > 180)
alpha = 180
amount = 0
set_opacity(0)

Expand Down Expand Up @@ -254,45 +255,79 @@
name = "CN20 nerve gas"
smokeranking = SMOKE_RANK_HIGH
color = "#80c7e4"
var/xeno_affecting = FALSE
opacity = FALSE
alpha = 75

/obj/effect/particle_effect/smoke/cn20/xeno
name = "CN20-X nerve gas"
color = "#2da9da"
xeno_affecting = TRUE

/obj/effect/particle_effect/smoke/cn20/Move()
. = ..()
for(var/mob/living/carbon/human/creature in get_turf(src))
affect(creature)

/obj/effect/particle_effect/smoke/cn20/affect(mob/living/carbon/human/creature)
if(!xeno_affecting)
for(var/mob/living/carbon/human/human in get_turf(src))
affect(human)
else
for(var/mob/living/carbon/creature in get_turf(src))
affect(creature)

/obj/effect/particle_effect/smoke/cn20/affect(mob/living/carbon/creature)
var/mob/living/carbon/xenomorph/xeno_creature
var/mob/living/carbon/human/human_creature
if(isxeno(creature))
xeno_creature = creature
else if(ishuman(creature))
human_creature = creature
if(!istype(creature) || issynth(creature) || creature.stat == DEAD)
return FALSE
if(!xeno_affecting && xeno_creature)
return FALSE
if(isyautja(creature) && prob(75))
return FALSE

if (creature.wear_mask && (creature.wear_mask.flags_inventory & BLOCKGASEFFECT))
if(creature.wear_mask && (creature.wear_mask.flags_inventory & BLOCKGASEFFECT))
return FALSE
if(human_creature && (human_creature.head && (human_creature.head.flags_inventory & BLOCKGASEFFECT)))
return FALSE

var/effect_amt = round(6 + amount*6)

creature.apply_damage(12, OXY)
if(xeno_creature)
xeno_creature.interference = 20
else
creature.apply_damage(12, OXY)
creature.SetEarDeafness(max(creature.ear_deaf, round(effect_amt*1.5))) //Paralysis of hearing system, aka deafness
if(!creature.eye_blind) //Eye exposure damage
to_chat(creature, SPAN_DANGER("Your eyes sting. You can't see!"))
if(xeno_creature)
to_chat(xeno_creature, SPAN_XENODANGER("Your awareness dims to a small area!"))
else
to_chat(creature, SPAN_DANGER("Your eyes sting. You can't see!"))
creature.SetEyeBlind(round(effect_amt/3))
if(creature.coughedtime != 1 && !creature.stat) //Coughing/gasping
if(!xeno_creature && creature.coughedtime != 1 && !creature.stat) //Coughing/gasping
creature.coughedtime = 1
if(prob(50))
creature.emote("cough")
else
creature.emote("gasp")
addtimer(VARSET_CALLBACK(creature, coughedtime, 0), 1.5 SECONDS)
if (prob(20))
var/stun_chance = 20
if(xeno_affecting)
stun_chance = 35
if(prob(stun_chance))
creature.apply_effect(1, WEAKEN)

//Topical damage (neurotoxin on exposed skin)
to_chat(creature, SPAN_DANGER("Your body is going numb, almost as if paralyzed!"))
if(xeno_creature)
to_chat(xeno_creature, SPAN_XENODANGER("You are struggling to move, it's as if you're paralyzed!"))
else
to_chat(creature, SPAN_DANGER("Your body is going numb, almost as if paralyzed!"))
if(prob(60 + round(amount*15))) //Highly likely to drop items due to arms/hands seizing up
creature.drop_held_item()
if(ishuman(creature))
creature.temporary_slowdown = max(creature.temporary_slowdown, 4) //One tick every two second
creature.recalculate_move_delay = TRUE
if(human_creature)
human_creature.temporary_slowdown = max(human_creature.temporary_slowdown, 4) //One tick every two second
human_creature.recalculate_move_delay = TRUE
return TRUE

//////////////////////////////////////
Expand Down Expand Up @@ -595,6 +630,9 @@
/datum/effect_system/smoke_spread/cn20
smoke_type = /obj/effect/particle_effect/smoke/cn20

/datum/effect_system/smoke_spread/cn20/xeno
smoke_type = /obj/effect/particle_effect/smoke/cn20/xeno

// XENO SMOKES

/datum/effect_system/smoke_spread/xeno_acid
Expand Down
27 changes: 27 additions & 0 deletions code/game/objects/structures/pipes/vents/vents.dm
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,31 @@
initial_loc.air_vent_names -= id_tag
. = ..()

/obj/structure/pipes/vents/vv_get_dropdown()
. = ..()
VV_DROPDOWN_OPTION(VV_HK_GAS, "Release Gas")

/obj/structure/pipes/vents/vv_do_topic(list/href_list)
. = ..()
var/mob/user = usr
if(href_list[VV_HK_GAS] && check_rights(R_EVENT))
if(welded)
to_chat(usr, SPAN_WARNING("You cannot release gas from a welded vent."))
return FALSE
var/list/options = list(VENT_GAS_SMOKE, VENT_GAS_CN20, VENT_GAS_CN20_XENO)
var/gas_choice = tgui_input_list(user, "What gas do you wish to use?", "Gas Choice", options, 20 SECONDS)
if(!gas_choice)
return FALSE
var/radius_choice = tgui_input_number(user, "What radius do you wish to use?", "Gas Radius", 4, 10, 1, 20 SECONDS)
var/warn_choice = tgui_input_number(user, "How many seconds warning do you wish to give?", "Release Warning", 5, 30, 1, 20 SECONDS)
warn_choice = warn_choice SECONDS

var/confirm = alert(user, "Confirm gas setup. \n\nGas: '[gas_choice]'\n Radius: '[radius_choice]'\n Warn Time: '[warn_choice / 10] seconds' \n\n Is this correct?", "Confirmation", "Yes", "No")
if(confirm != "Yes")
return FALSE
create_gas(gas_choice, radius_choice, warn_choice)
return TRUE

/obj/structure/pipes/vents/proc/create_gas(gas_type = VENT_GAS_SMOKE, radius = 4, warning_time = 5 SECONDS)
if(welded)
to_chat(usr, SPAN_WARNING("You cannot release gas from a welded vent."))
Expand All @@ -138,6 +163,8 @@
spreader = new /datum/effect_system/smoke_spread/bad
if(VENT_GAS_CN20)
spreader = new /datum/effect_system/smoke_spread/cn20
if(VENT_GAS_CN20_XENO)
spreader = new /datum/effect_system/smoke_spread/cn20/xeno
if(!spreader)
return FALSE
gas_holder = spreader
Expand Down

0 comments on commit e78b760

Please sign in to comment.