Ports the radiation subsystem and cleans up damage flags. (#15715)

This commit is contained in:
Matt Atlas
2023-02-07 13:22:47 +01:00
committed by GitHub
parent 5527fc0810
commit 31c73ead85
198 changed files with 981 additions and 649 deletions
@@ -74,7 +74,7 @@
/obj/effect/decal/cleanable/greenglow/radioactive/process()
for(var/mob/living/L in range(4,src))
L.apply_effect(25, IRRADIATE, blocked = 0)
L.apply_damage(25, DAMAGE_RADIATION, damage_flags = DAMAGE_FLAG_DISPERSED)
/obj/effect/decal/cleanable/cobweb
name = "cobweb"
+1 -1
View File
@@ -248,7 +248,7 @@
burst_out(O)
if (O.owner)
if(amount_grown > 40 && prob(1))
O.owner.apply_damage(1, TOX, O.limb_name)
O.owner.apply_damage(1, DAMAGE_TOXIN, O.limb_name)
if(world.time > last_itch + 30 SECONDS)
last_itch = world.time
O.owner.visible_message(
+82
View File
@@ -0,0 +1,82 @@
/obj/item/device/geiger
name = "geiger counter"
desc = "A handheld device used for detecting and measuring radiation in an area."
icon = 'icons/obj/geiger_counter.dmi'
icon_state = "geiger_off"
item_state = "multitool"
w_class = ITEMSIZE_SMALL
action_button_name = "Toggle geiger counter"
var/scanning = 0
var/radiation_count = 0
var/datum/sound_token/sound_token
var/geiger_volume = 0
var/sound_id
/obj/item/device/geiger/Initialize()
. = ..()
sound_id = "[type]_[sequential_id(type)]"
/obj/item/device/geiger/proc/update_sound(playing)
if(playing && !sound_token)
sound_token = sound_player.PlayLoopingSound(src, sound_id, "sound/items/geiger.ogg", volume = geiger_volume, range = 4, falloff = 3, prefer_mute = TRUE)
else if(!playing && sound_token)
QDEL_NULL(sound_token)
/obj/item/device/geiger/Destroy()
. = ..()
STOP_PROCESSING(SSprocessing, src)
update_sound(0)
/obj/item/device/geiger/process()
if(!scanning)
return
radiation_count = SSradiation.get_rads_at_turf(get_turf(src))
update_icon()
/obj/item/device/geiger/examine(mob/user)
. = ..()
var/msg = "[scanning ? "ambient" : "stored"] Radiation level: [radiation_count ? radiation_count : "0"] IU/s."
if(radiation_count > RAD_LEVEL_LOW)
to_chat(user, SPAN_WARNING("[msg]"))
else
to_chat(user, SPAN_NOTICE("[msg]"))
/obj/item/device/geiger/attack_self(mob/user)
scanning = !scanning
if(scanning)
START_PROCESSING(SSprocessing, src)
else
STOP_PROCESSING(SSprocessing, src)
update_icon()
to_chat(user, SPAN_NOTICE("[icon2html(src, user)] You switch [scanning ? "on" : "off"] [src]."))
/obj/item/device/geiger/update_icon()
if(!scanning)
icon_state = "geiger_off"
update_sound(0)
return 1
if(!sound_token) update_sound(1)
switch(radiation_count)
if(null) icon_state = "geiger_on_1"
if(-INFINITY to RAD_LEVEL_LOW)
icon_state = "geiger_on_1"
geiger_volume = 0
sound_token.SetVolume(geiger_volume)
if(RAD_LEVEL_LOW + 0.01 to RAD_LEVEL_MODERATE)
icon_state = "geiger_on_2"
geiger_volume = 10
sound_token.SetVolume(geiger_volume)
if(RAD_LEVEL_MODERATE + 0.1 to RAD_LEVEL_HIGH)
icon_state = "geiger_on_3"
geiger_volume = 25
sound_token.SetVolume(geiger_volume)
if(RAD_LEVEL_HIGH + 1 to RAD_LEVEL_VERY_HIGH)
icon_state = "geiger_on_4"
geiger_volume = 40
sound_token.SetVolume(geiger_volume)
if(RAD_LEVEL_VERY_HIGH + 1 to INFINITY)
icon_state = "geiger_on_5"
geiger_volume = 60
sound_token.SetVolume(geiger_volume)
@@ -43,7 +43,7 @@
to_chat(user, SPAN_WARNING("You break \the [src] apart, spilling its contents everywhere!"))
fuel = 0
new /obj/effect/decal/cleanable/greenglow(get_turf(user))
user.apply_damage(rand(15,30), IRRADIATE, damage_flags = DAM_DISPERSED)
user.apply_damage(rand(15,30), DAMAGE_RADIATION, damage_flags = DAMAGE_FLAG_DISPERSED)
qdel(src)
return
+1 -1
View File
@@ -51,7 +51,7 @@
/obj/item/target/bullet_act(var/obj/item/projectile/Proj)
var/p_x = Proj.p_x + pick(0,0,0,0,0,-1,1) // really ugly way of coding "sometimes offset Proj.p_x!"
var/p_y = Proj.p_y + pick(0,0,0,0,0,-1,1)
var/decaltype = (Proj.damage_flags & DAM_BULLET) ? DECAL_BULLET : DECAL_SCORCH
var/decaltype = (Proj.damage_flags & DAMAGE_FLAG_BULLET) ? DECAL_BULLET : DECAL_SCORCH
virtual_icon = new(icon, icon_state)
+2 -2
View File
@@ -69,8 +69,8 @@ obj/item/clothing/mask/chewable/Destroy()
/obj/item/clothing/mask/chewable/proc/damagecrunch(mob/living/carbon/human/user)
if(src == user.wear_mask) // are we still chewing the gum?
user.apply_damage(damage_per_crunch, BRUTE, BP_HEAD)
user.apply_damage(damage_per_crunch/2, PAIN, BP_HEAD)
user.apply_damage(damage_per_crunch, DAMAGE_BRUTE, BP_HEAD)
user.apply_damage(damage_per_crunch/2, DAMAGE_PAIN, BP_HEAD)
to_chat(user, SPAN_DANGER("You bite down hard on \the [name]!"))
crunching = FALSE
@@ -853,9 +853,9 @@ CIGARETTE PACKETS ARE IN FANCY.DM
if(user.IgniteMob())
user.visible_message(SPAN_DANGER("<b>[user]</b> accidentally sets themselves on fire!"))
if(user.l_hand == src)
user.apply_damage(2, BURN,BP_L_HAND)
user.apply_damage(2, DAMAGE_BURN,BP_L_HAND)
else
user.apply_damage(2, BURN,BP_R_HAND)
user.apply_damage(2, DAMAGE_BURN,BP_R_HAND)
if(last_open <= world.time - 20) //Spam limiter.
last_open = world.time
user.visible_message(SPAN_DANGER("After a few attempts, <b>[user]</b> manages to light \the [src], they however burn their finger in the process."), range = 3)
@@ -71,7 +71,7 @@
/obj/item/dnainjector/proc/inject(mob/M as mob, mob/user as mob)
if(istype(M,/mob/living))
var/mob/living/L = M
L.apply_effect(rand(5,20), IRRADIATE, blocked = 0)
L.apply_damage(rand(5,20), DAMAGE_RADIATION, damage_flags = DAMAGE_FLAG_DISPERSED)
if (NOT_FLAG(M.mutations, NOCLONE)) // prevents drained people from having their DNA changed
if (buf.types & DNA2_BUF_UI)
+1 -1
View File
@@ -136,7 +136,7 @@
H.attack_log += text("\[[time_stamp()]\] <span class='warning'>[s] ([H.ckey])</span>")
log_attack("[s] ([H.ckey])",ckey=key_name(H))
if(O.take_damage(3, 0, damage_flags = DAM_SHARP|DAM_EDGE, used_weapon = "teeth marks"))
if(O.take_damage(3, 0, damage_flags = DAMAGE_FLAG_SHARP|DAMAGE_FLAG_EDGE, used_weapon = "teeth marks"))
H:UpdateDamageIcon()
last_chew = world.time
@@ -45,7 +45,7 @@
part.take_damage(burn = 15, used_weapon = "Electronics meltdown")
else
var/mob/living/M = imp_in
M.apply_damage(15,BURN)
M.apply_damage(15,DAMAGE_BURN)
name = "melted implant"
desc = "Charred circuit in melted plastic case. Wonder what that used to be..."
icon_state = "implant_melted"
@@ -49,7 +49,7 @@
damage_coef -= 0.2
return
if(H.apply_damage(25 * damage_coef, BRUTE, affecting))
if(H.apply_damage(25 * damage_coef, DAMAGE_BRUTE, affecting))
H.updatehealth()
if(H.can_feel_pain())
@@ -54,7 +54,7 @@
for(var/thing in O.implants)
var/obj/S = thing
usr.visible_message("<span class='notice'>[usr] starts carefully digging out something in [H == usr ? "themselves" : H]...</span>")
O.take_damage(8, 0, DAM_SHARP|DAM_EDGE, src)
O.take_damage(8, 0, DAMAGE_FLAG_SHARP|DAMAGE_FLAG_EDGE, src)
H.custom_pain("<font size=3><span class='danger'>It burns!</span></font>", 50)
if(do_mob(usr, H, 100))
H.remove_implant(S, FALSE)
@@ -36,7 +36,7 @@
return FALSE
/obj/item/material/sword/perform_technique(var/mob/living/carbon/human/target, var/mob/living/carbon/human/user, var/target_zone)
var/armor_reduction = target.get_blocked_ratio(target_zone, BRUTE, DAM_EDGE|DAM_SHARP, damage = force)*100
var/armor_reduction = target.get_blocked_ratio(target_zone, DAMAGE_BRUTE, DAMAGE_FLAG_EDGE|DAMAGE_FLAG_SHARP, damage = force)*100
var/obj/item/organ/external/affecting = target.get_organ(target_zone)
if(!affecting)
return
@@ -605,7 +605,7 @@
icon_state = "flag_hegemony0"
base_icon = "flag_hegemony"
contained_sprite = TRUE
damtype = BURN
damtype = DAMAGE_BURN
/obj/item/material/twohanded/pike/silver/Initialize(newloc, material_key)
. = ..(newloc, MATERIAL_SILVER)
@@ -26,7 +26,7 @@
user.Weaken(3 * force)
if(ishuman(user))
var/mob/living/carbon/human/H = user
H.apply_damage(2*force, BRUTE, BP_HEAD)
H.apply_damage(2*force, DAMAGE_BRUTE, BP_HEAD)
else
user.take_organ_damage(2*force)
return
@@ -96,14 +96,14 @@
user.Weaken(3 * force)
if(ishuman(user))
var/mob/living/carbon/human/H = user
H.apply_damage(2 * force, BRUTE, BP_HEAD)
H.apply_damage(2 * force, DAMAGE_BRUTE, BP_HEAD)
else
user.take_organ_damage(2 * force)
return
if(..() && user.a_intent == I_DISARM)
if(ishuman(target))
var/mob/living/carbon/human/T = target
T.apply_damage(40, PAIN, target_zone)
T.apply_damage(40, DAMAGE_PAIN, target_zone)
return
return ..()
+4 -4
View File
@@ -533,7 +533,7 @@
T.visible_message("<span class='danger'>\The [src] turns on.</span>")
playsound(loc, 'sound/items/welder_activate.ogg', 50, 1)
force = 15
damtype = BURN
damtype = DAMAGE_BURN
w_class = ITEMSIZE_LARGE
welding = TRUE
hitsound = SOUNDS_LASER_MEAT
@@ -552,7 +552,7 @@
T.visible_message("<span class='warning'>\The [src] turns off.</span>")
playsound(loc, 'sound/items/welder_deactivate.ogg', 50, 1)
force = 3
damtype = BRUTE
damtype = DAMAGE_BRUTE
w_class = initial(w_class)
welding = FALSE
hitsound = /singleton/sound_category/swing_hit_sound
@@ -946,10 +946,10 @@
if(!user.gloves)
var/UserLoc = get_equip_slot()
if(UserLoc == slot_l_hand)
user.apply_damage(5, BURN, BP_L_HAND)
user.apply_damage(5, DAMAGE_BURN, BP_L_HAND)
to_chat(user, SPAN_DANGER("The steel wool burns your left hand!"))
else if(UserLoc == slot_r_hand)
user.apply_damage(5, BURN, BP_R_HAND)
user.apply_damage(5, DAMAGE_BURN, BP_R_HAND)
to_chat(user, SPAN_DANGER("The steel wool burns your right hand!"))
new /obj/effect/decal/cleanable/ash(get_turf(src))
+1 -1
View File
@@ -90,7 +90,7 @@
else
target_zone = pick(BP_L_FOOT, BP_R_FOOT, BP_L_LEG, BP_R_LEG)
var/success = L.apply_damage(30, BRUTE, target_zone, used_weapon = src, armor_pen = activated_armor_penetration)
var/success = L.apply_damage(30, DAMAGE_BRUTE, target_zone, used_weapon = src, armor_pen = activated_armor_penetration)
if(!success)
return FALSE
+5 -5
View File
@@ -13,7 +13,7 @@
var/sharp = 0 // whether this object cuts
var/edge = FALSE // whether this object is more likely to dismember
var/in_use = 0 // If we have a user using us, this will be set on. We will check if the user has stopped using us, and thus stop updating and LAGGING EVERYTHING!
var/damtype = BRUTE
var/damtype = DAMAGE_BRUTE
var/force = 0
var/armor_penetration = 0
var/noslice = 0 // To make it not able to slice things.
@@ -251,8 +251,8 @@
/obj/proc/damage_flags()
. = 0
if(has_edge(src))
. |= DAM_EDGE
. |= DAMAGE_FLAG_EDGE
if(is_sharp(src))
. |= DAM_SHARP
if(damtype == BURN)
. |= DAM_LASER
. |= DAMAGE_FLAG_SHARP
if(damtype == DAMAGE_BURN)
. |= DAMAGE_FLAG_LASER
+1 -1
View File
@@ -551,7 +551,7 @@
log_debug("random_obj (voidsuit): Type [suit.type] was unable to spawn a matching helmet!")
new /obj/item/clothing/shoes/magboots(loc)
if (damaged && prob(60))
suit.create_breaches(pick(BRUTE, BURN), rand(1, 5))
suit.create_breaches(pick(DAMAGE_BRUTE, DAMAGE_BURN), rand(1, 5))
//Random MRE stuff
@@ -136,7 +136,7 @@
playsound(src, barricade_hitsound, 50, 1)
if(is_wired)
visible_message(SPAN_DANGER("\The [src]'s barbed wire slices into [L]!"))
L.apply_damage(rand(5, 10), BRUTE, pick(BP_R_HAND, BP_L_HAND), "barbed wire", DAM_SHARP|DAM_EDGE, 25)
L.apply_damage(rand(5, 10), DAMAGE_BRUTE, pick(BP_R_HAND, BP_L_HAND), "barbed wire", DAMAGE_FLAG_SHARP|DAMAGE_FLAG_EDGE, 25)
L.do_attack_animation(src)
take_damage(damage)
@@ -203,6 +203,7 @@
new /obj/item/clothing/head/radiation(src)
new /obj/item/clothing/suit/radiation(src)
new /obj/item/clothing/glasses/safety/goggles(src)
new /obj/item/device/geiger(src)
for(var/i = 1 to 2)
new /obj/item/reagent_containers/hypospray/autoinjector/hyronalin(src)
+1 -1
View File
@@ -69,7 +69,7 @@
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
user.do_attack_animation(src, W)
var/force_damage = W.force
if(W.damtype == BURN)
if(W.damtype == DAMAGE_BURN)
force_damage *= 1.25
health -= force_damage
playsound(loc, 'sound/effects/attackblob.ogg', 80, TRUE)
+1 -1
View File
@@ -53,7 +53,7 @@
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
user.do_attack_animation(src, W)
var/force_damage = W.force
if(W.damtype == BURN)
if(W.damtype == DAMAGE_BURN)
force_damage *= 1.25
health -= force_damage
playsound(loc, 'sound/effects/attackblob.ogg', 80, TRUE)
+3 -3
View File
@@ -74,7 +74,7 @@
//20% chance that the grille provides a bit more cover than usual. Support structure for example might take up 20% of the grille's area.
//If they click on the grille itself then we assume they are aiming at the grille itself and the extra cover behaviour is always used.
switch(Proj.damage_type)
if(BRUTE)
if(DAMAGE_BRUTE)
//bullets
if(Proj.original == src || prob(20))
Proj.damage *= between(0, Proj.damage/60, 0.5)
@@ -83,7 +83,7 @@
else
Proj.damage *= between(0, Proj.damage/60, 1)
passthrough = 1
if(BURN)
if(DAMAGE_BURN)
//beams and other projectiles are either blocked completely by grilles or stop half the damage.
if(!(Proj.original == src || prob(20)))
Proj.damage *= 0.5
@@ -91,7 +91,7 @@
if(passthrough)
. = PROJECTILE_CONTINUE
damage = between(0, (damage - Proj.damage)*(Proj.damage_type == BRUTE? 0.4 : 1), 10) //if the bullet passes through then the grille avoids most of the damage
damage = between(0, (damage - Proj.damage)*(Proj.damage_type == DAMAGE_BRUTE? 0.4 : 1), 10) //if the bullet passes through then the grille avoids most of the damage
src.health -= damage*0.2
spawn(0) healthcheck() //spawn to make sure we return properly if the grille is deleted
+1 -1
View File
@@ -105,7 +105,7 @@
if(W.can_puncture())
user.visible_message(SPAN_DANGER("[user] pierces \the [src] with \the [W]!"), SPAN_WARNING("You pierce \the [src] with \the [W]!"))
deflate(TRUE)
else if(W.damtype == BRUTE || W.damtype == BURN)
else if(W.damtype == DAMAGE_BRUTE || W.damtype == DAMAGE_BURN)
hit(W.force)
..()
+3 -3
View File
@@ -41,7 +41,7 @@
if(!material || !material.radioactivity)
return
for(var/mob/living/L in range(1,src))
L.apply_damage(round(material.radioactivity / 20), IRRADIATE)
L.apply_damage(round(material.radioactivity / 20), DAMAGE_RADIATION)
/obj/structure/railing/Initialize()
. = ..()
@@ -213,7 +213,7 @@
playsound(get_turf(src), 'sound/effects/grillehit.ogg', 50, TRUE)
if(prob(30))
G.affecting.Weaken(5)
G.affecting.apply_damage(15, BRUTE, BP_HEAD)
G.affecting.apply_damage(15, DAMAGE_BRUTE, BP_HEAD)
else
G.affecting.forceMove(get_step(src, get_dir(user, src)))
G.affecting.Weaken(5)
@@ -273,7 +273,7 @@
update_icon()
return
if(W.force && (W.damtype == BURN || W.damtype == BRUTE))
if(W.force && (W.damtype == DAMAGE_BURN || W.damtype == DAMAGE_BRUTE))
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
visible_message(SPAN_WARNING("\The [src] has been [LAZYLEN(W.attack_verb) ? pick(W.attack_verb) : "attacked"] with \the [W] by \the [user]!"))
take_damage(W.force)
+2 -2
View File
@@ -168,7 +168,7 @@
else if(istype(W,/obj/item))
var/obj/item/I = W
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
if(I.damtype == BRUTE || I.damtype == BURN)
if(I.damtype == DAMAGE_BRUTE || I.damtype == DAMAGE_BURN)
if(I.force < 10)
user.visible_message("<span class='danger'>\The [user] hits \the [src] with \the [I] with no visible effect.</span>")
else
@@ -211,7 +211,7 @@
if(!material.radioactivity)
return
for(var/mob/living/L in range(1,src))
L.apply_damage(round(material.radioactivity/3),IRRADIATE, damage_flags = DAM_DISPERSED)
L.apply_damage(round(material.radioactivity/3),DAMAGE_RADIATION, damage_flags = DAMAGE_FLAG_DISPERSED)
/obj/structure/simple_door/iron/New(var/newloc,var/material_name, var/complexity)
..(newloc, MATERIAL_IRON, complexity)
@@ -292,7 +292,7 @@
occupant.apply_effect(6, STUN)
occupant.apply_effect(6, WEAKEN)
occupant.apply_effect(6, STUTTER)
occupant.apply_damage(10, BRUTE, def_zone)
occupant.apply_damage(10, DAMAGE_BRUTE, def_zone)
playsound(src.loc, "punch", 50, 1, -1)
if(isliving(A))
var/mob/living/victim = A
@@ -300,7 +300,7 @@
victim.apply_effect(6, STUN)
victim.apply_effect(6, WEAKEN)
victim.apply_effect(6, STUTTER)
victim.apply_damage(10, BRUTE, def_zone)
victim.apply_damage(10, DAMAGE_BRUTE, def_zone)
if(pulling)
occupant.visible_message(SPAN_DANGER("[pulling] has thrusted \the [name] into \the [A], throwing \the [occupant] out of it!"))
@@ -207,9 +207,9 @@
/obj/item/material/stool/apply_hit_effect(mob/living/target, mob/living/user, var/hit_zone)
if(prob(300 / force)) // Weaker materials are more likely to shatter on people randomly.
var/blocked = target.get_blocked_ratio(hit_zone, BRUTE)
var/blocked = target.get_blocked_ratio(hit_zone, DAMAGE_BRUTE)
target.Weaken(force * BLOCKED_MULT(blocked))
target.apply_damage(force * 2, BRUTE, hit_zone, blocked, src)
target.apply_damage(force * 2, DAMAGE_BRUTE, hit_zone, blocked, src)
user.visible_message(SPAN_DANGER("[user] [material.destruction_desc] \the [src] to pieces against \the [target]'s [hit_zone]!"), SPAN_DANGER("\The [src] [material.destruction_desc] to pieces against \the [target]'s [hit_zone]!"))
use_material_shatter = FALSE
shatter()
+1 -1
View File
@@ -38,7 +38,7 @@
hider = user
if(ishuman(user) && prob(5))
var/mob/living/carbon/human/H = user
H.take_overall_damage(5, 0, DAM_SHARP, src)
H.take_overall_damage(5, 0, DAMAGE_FLAG_SHARP, src)
to_chat(user, SPAN_WARNING("You cut yourself while climbing into \the [src]!"))
/obj/structure/trash_pile/relaymove(mob/user)
+5 -5
View File
@@ -247,7 +247,7 @@
if(istype(W, /obj/item/grab) && get_dist(src,user)<2)
var/obj/item/grab/G = W
if(istype(G.affecting,/mob/living))
grab_smash_attack(G, BRUTE)
grab_smash_attack(G, DAMAGE_BRUTE)
return
if(W.flags & NOBLUDGEON)
@@ -284,7 +284,7 @@
dismantle_window()
else
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
if(W.damtype == BRUTE || W.damtype == BURN)
if(W.damtype == DAMAGE_BRUTE || W.damtype == DAMAGE_BURN)
if(reinf)
user.do_attack_animation(src)
if(W.force >= REINFORCED_WINDOW_DAMAGE_FORCE)
@@ -305,7 +305,7 @@
playsound(src, hitsound, 10, 1)
return
/obj/structure/window/proc/grab_smash_attack(obj/item/grab/G, var/damtype = BRUTE)
/obj/structure/window/proc/grab_smash_attack(obj/item/grab/G, var/damtype = DAMAGE_BRUTE)
var/mob/living/M = G.affecting
var/mob/living/user = G.assailant
@@ -673,7 +673,7 @@
if(istype(W, /obj/item/grab) && get_dist(src,user)<2)
var/obj/item/grab/G = W
if(istype(G.affecting,/mob/living))
grab_smash_attack(G, BRUTE)
grab_smash_attack(G, DAMAGE_BRUTE)
return
if(W.flags & NOBLUDGEON)
@@ -709,7 +709,7 @@
dismantle_window()
else
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
if(W.damtype == BRUTE || W.damtype == BURN)
if(W.damtype == DAMAGE_BRUTE || W.damtype == DAMAGE_BURN)
if(reinf)
user.do_attack_animation(src)
if(W.force >= FULL_REINFORCED_WINDOW_DAMAGE_FORCE)