Skip to content

Commit

Permalink
Merge branch 'stable' of github.com:NebulaSS13/Nebula into stagingupdate
Browse files Browse the repository at this point in the history
  • Loading branch information
MistakeNot4892 committed Jan 25, 2025
2 parents 01133c3 + c86a66c commit 3e47c07
Show file tree
Hide file tree
Showing 12 changed files with 168 additions and 160 deletions.
1 change: 1 addition & 0 deletions code/__defines/species.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#define SPECIES_FLAG_NO_BLOCK BITFLAG(6) // Unable to block or defend itself from attackers.
#define SPECIES_FLAG_NEED_DIRECT_ABSORB BITFLAG(7) // This species can only have their DNA taken by direct absorption.
#define SPECIES_FLAG_LOW_GRAV_ADAPTED BITFLAG(8) // This species is used to lower than standard gravity, affecting stamina in high-grav
#define SPECIES_FLAG_ABSORB_ELECTRICITY BITFLAG(9) // This species can absorb electricity; snowflake flag for old slime people.

// Species spawn flags
#define SPECIES_IS_WHITELISTED BITFLAG(0) // Must be whitelisted to play.
Expand Down
78 changes: 39 additions & 39 deletions code/datums/wires/smes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,68 +9,68 @@
new /datum/wire_description(SMES_WIRE_FAILSAFES, "This wire appears to connect to a failsafe mechanism.")
)

var/global/const/SMES_WIRE_RCON = 1 // Remote control (AI and consoles), cut to disable
var/global/const/SMES_WIRE_INPUT = 2 // Input wire, cut to disable input, pulse to disable for 60s
var/global/const/SMES_WIRE_OUTPUT = 4 // Output wire, cut to disable output, pulse to disable for 60s
var/global/const/SMES_WIRE_GROUNDING = 8 // Cut to quickly discharge causing sparks, pulse to only create few sparks
var/global/const/SMES_WIRE_FAILSAFES = 16 // Cut to disable failsafes, mend to reenable


/datum/wires/smes/CanUse(var/mob/living/L)
var/obj/machinery/power/smes/buildable/S = holder
if(!S.grounding && S.powernet && S.powernet.avail)
electrocute_mob(L, S.powernet, S, S.safeties_enabled? 0.1 : 1)
if(S.panel_open)
return 1
return 0
/// Remote control (AI and consoles), cut to disable
var/global/const/SMES_WIRE_RCON = BITFLAG(0)
/// Input wire, cut to disable input, pulse to disable for 60s
var/global/const/SMES_WIRE_INPUT = BITFLAG(1)
/// Output wire, cut to disable output, pulse to disable for 60s
var/global/const/SMES_WIRE_OUTPUT = BITFLAG(2)
/// Cut to quickly discharge causing sparks, pulse to only create few sparks
var/global/const/SMES_WIRE_GROUNDING = BITFLAG(3)
/// Cut to disable failsafes, mend to reenable
var/global/const/SMES_WIRE_FAILSAFES = BITFLAG(4)

/datum/wires/smes/CanUse(var/mob/living/user)
var/obj/machinery/power/smes/buildable/storage = holder
if(!storage.grounding && storage.powernet && storage.powernet.avail)
electrocute_mob(user, storage.powernet, storage, (storage.safeties_enabled? 0.1 : 1))
return storage.panel_open

/datum/wires/smes/GetInteractWindow(mob/user)
var/obj/machinery/power/smes/buildable/S = holder
var/obj/machinery/power/smes/buildable/storage = holder
. += ..()
. += "The green light is [(S.input_cut || S.input_pulsed || S.output_cut || S.output_pulsed) ? "off" : "on"]<br>"
. += "The red light is [(S.safeties_enabled || S.grounding) ? "off" : "blinking"]<br>"
. += "The blue light is [S.RCon ? "on" : "off"]"

. += "The green light is [(storage.input_cut || storage.input_pulsed || storage.output_cut || storage.output_pulsed) ? "off" : "on"]<br>"
. += "The red light is [(storage.safeties_enabled || storage.grounding) ? "off" : "blinking"]<br>"
. += "The blue light is [storage.RCon ? "on" : "off"]"

/datum/wires/smes/UpdateCut(var/index, var/mended)
var/obj/machinery/power/smes/buildable/S = holder
var/obj/machinery/power/smes/buildable/storage = holder
switch(index)
if(SMES_WIRE_RCON)
S.RCon = mended
storage.RCon = mended
if(SMES_WIRE_INPUT)
S.input_cut = !mended
storage.input_cut = !mended
if(SMES_WIRE_OUTPUT)
S.output_cut = !mended
storage.output_cut = !mended
if(SMES_WIRE_GROUNDING)
S.grounding = mended
storage.grounding = mended
if(SMES_WIRE_FAILSAFES)
S.safeties_enabled = mended
storage.safeties_enabled = mended

/datum/wires/smes/proc/reset_rcon()
var/obj/machinery/power/smes/buildable/S = holder
if(S)
S.RCon = TRUE
var/obj/machinery/power/smes/buildable/storage = holder
if(storage)
storage.RCon = TRUE

/datum/wires/smes/proc/reset_safeties()
var/obj/machinery/power/smes/buildable/S = holder
if(S)
S.safeties_enabled = TRUE
var/obj/machinery/power/smes/buildable/storage = holder
if(storage)
storage.safeties_enabled = TRUE

/datum/wires/smes/UpdatePulsed(var/index)
var/obj/machinery/power/smes/buildable/S = holder
var/obj/machinery/power/smes/buildable/storage = holder
switch(index)
if(SMES_WIRE_RCON)
if(S.RCon)
S.RCon = 0
if(storage.RCon)
storage.RCon = 0
addtimer(CALLBACK(src, PROC_REF(reset_rcon)), 1 SECOND)
if(SMES_WIRE_INPUT)
S.toggle_input()
storage.toggle_input()
if(SMES_WIRE_OUTPUT)
S.toggle_output()
storage.toggle_output()
if(SMES_WIRE_GROUNDING)
S.grounding = 0
storage.grounding = 0
if(SMES_WIRE_FAILSAFES)
if(S.safeties_enabled)
S.safeties_enabled = 0
if(storage.safeties_enabled)
storage.safeties_enabled = 0
addtimer(CALLBACK(src, PROC_REF(reset_safeties)), 1 SECOND)
2 changes: 1 addition & 1 deletion code/game/objects/items/weapons/material/shards.dm
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
playsound(src.loc, 'sound/effects/glass_step.ogg', 50, 1) // not sure how to handle metal shards with sounds

var/decl/species/walker_species = victim.get_species()
if(walker_species && (walker_species.get_shock_vulnerability(victim) < 0.5 || (walker_species.species_flags & (SPECIES_FLAG_NO_EMBED|SPECIES_FLAG_NO_MINOR_CUT)))) //Thick skin.
if(walker_species?.species_flags & (SPECIES_FLAG_NO_EMBED|SPECIES_FLAG_NO_MINOR_CUT)) //Thick skin.
return

var/obj/item/shoes = victim.get_equipped_item(slot_shoes_str)
Expand Down
33 changes: 16 additions & 17 deletions code/game/objects/structures/grille.dm
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@
add_overlay(I)

/obj/structure/grille/Bumped(atom/user)
if(ismob(user)) shock(user, 70)
if(ismob(user))
shock(user, 70)

/obj/structure/grille/attack_hand(mob/user)

Expand Down Expand Up @@ -229,25 +230,23 @@
// returns 1 if shocked, 0 otherwise
/obj/structure/grille/proc/shock(mob/user, prb)
if(!anchored || destroyed) // anchored/destroyed grilles are never connected
return 0
return FALSE
if(!(material.conductive))
return 0
return FALSE
if(!prob(prb))
return 0
return FALSE
if(!in_range(src, user))//To prevent TK and exosuit users from getting shocked
return 0
var/turf/T = get_turf(src)
var/obj/structure/cable/C = T.get_cable_node()
if(C)
if(electrocute_mob(user, C, src))
if(C.powernet)
C.powernet.trigger_warning()
spark_at(src, cardinal_only = TRUE)
if(HAS_STATUS(user, STAT_STUN))
return 1
else
return 0
return 0
return FALSE
var/turf/my_turf = get_turf(src)
var/obj/structure/cable/cable = my_turf.get_cable_node()
if(!cable)
return FALSE
if(!electrocute_mob(user, cable, src))
return FALSE
if(cable.powernet)
cable.powernet.trigger_warning()
spark_at(src, cardinal_only = TRUE)
return !!HAS_STATUS(user, STAT_STUN)

/obj/structure/grille/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
if(!destroyed)
Expand Down
6 changes: 6 additions & 0 deletions code/modules/mob/inventory.dm
Original file line number Diff line number Diff line change
Expand Up @@ -449,3 +449,9 @@
var/org = GET_EXTERNAL_ORGAN(src, hand_slot)
if(org)
LAZYDISTINCTADD(., org)

/mob/proc/get_active_hand_bodypart_flags()
var/datum/inventory_slot/gripper/inv_slot = get_inventory_slot_datum(get_active_held_item_slot())
if(istype(inv_slot))
. = inv_slot.covering_slot_flags
. ||= SLOT_HANDS
56 changes: 1 addition & 55 deletions code/modules/mob/living/human/human_defense.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ meteor_act

return blocked

/mob/living/human/stun_effect_act(var/stun_amount, var/agony_amount, var/def_zone)
/mob/living/human/stun_effect_act(stun_amount, agony_amount, def_zone, used_weapon)
var/obj/item/organ/external/affected = GET_EXTERNAL_ORGAN(src, def_zone)
if(!affected)
return
Expand Down Expand Up @@ -346,60 +346,6 @@ meteor_act
fire_act(air, temperature)
return FALSE

//Removed the horrible safety parameter. It was only being used by ninja code anyways.
//Now checks siemens_coefficient of the affected area by default
/mob/living/human/electrocute_act(var/shock_damage, var/obj/source, var/base_siemens_coeff = 1.0, var/def_zone = null)

if(status_flags & GODMODE) return 0 //godmode

if(species.get_shock_vulnerability(src) == -1)
if(stored_shock_by_ref["\ref[src]"])
stored_shock_by_ref["\ref[src]"] += shock_damage
else
stored_shock_by_ref["\ref[src]"] = shock_damage
return

if (!def_zone)
def_zone = pick(BP_L_HAND, BP_R_HAND)

shock_damage = apply_shock(shock_damage, def_zone, base_siemens_coeff)

if(!shock_damage)
return 0

stun_effect_act(agony_amount=shock_damage, def_zone=def_zone)

playsound(loc, "sparks", 50, 1, -1)
if (shock_damage > 15)
src.visible_message(
"<span class='warning'>[src] was electrocuted[source ? " by the [source]" : ""]!</span>", \
"<span class='danger'>You feel a powerful shock course through your body!</span>", \
"<span class='warning'>You hear a heavy electrical crack.</span>" \
)
else
src.visible_message(
"<span class='warning'>[src] was shocked[source ? " by the [source]" : ""].</span>", \
"<span class='warning'>You feel a shock course through your body.</span>", \
"<span class='warning'>You hear a zapping sound.</span>" \
)

switch(shock_damage)
if(11 to 15)
SET_STATUS_MAX(src, STAT_STUN, 1)
if(16 to 20)
SET_STATUS_MAX(src, STAT_STUN, 2)
if(21 to 25)
SET_STATUS_MAX(src, STAT_WEAK, 2)
if(26 to 30)
SET_STATUS_MAX(src, STAT_WEAK, 5)
if(31 to INFINITY)
SET_STATUS_MAX(src, STAT_WEAK, 10) //This should work for now, more is really silly and makes you lay there forever

set_status(STAT_JITTER, min(shock_damage*5, 200))

spark_at(loc, amount=5, cardinal_only = TRUE)

return shock_damage

/mob/living/human/explosion_act(severity)
..()
Expand Down
59 changes: 52 additions & 7 deletions code/modules/mob/living/living_defense.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
var/obj/item/assembly/signaler/signaler = get_active_held_item()
if(istype(signaler) && signaler.deadman)
log_and_message_admins("has triggered a signaler deadman's switch")
src.visible_message("<span class='warning'>[src] triggers their deadman's switch!</span>")
visible_message(SPAN_WARNING("[src] triggers their deadman's switch!"))
signaler.signal()
//Armor
var/damage = P.damage
Expand Down Expand Up @@ -83,7 +83,7 @@


//Handles the effects of "stun" weapons
/mob/living/proc/stun_effect_act(var/stun_amount, var/agony_amount, var/def_zone, var/used_weapon=null)
/mob/living/proc/stun_effect_act(stun_amount, agony_amount, def_zone, used_weapon)
flash_pain()

if (stun_amount)
Expand All @@ -97,8 +97,53 @@
apply_effect(agony_amount/10, STUTTER)
apply_effect(agony_amount/10, EYE_BLUR)

/mob/living/proc/electrocute_act(var/shock_damage, var/obj/source, var/siemens_coeff = 1.0, def_zone = null)
return 0 // No root logic, implemented separately on human and silicon.
/mob/living/proc/electrocute_act(shock_damage, obj/source, siemens_coeff = 1, def_zone)
SHOULD_CALL_PARENT(TRUE)
if(status_flags & GODMODE)
return 0

var/decl/species/my_species = get_species()
if(my_species?.species_flags & SPECIES_FLAG_ABSORB_ELECTRICITY)
spark_at(loc, amount=5, cardinal_only = TRUE)
LAZYADD(global.stored_shock_by_ref["\ref[src]"], shock_damage)
return 0

if(!shock_damage)
return 0

stun_effect_act(agony_amount=shock_damage, def_zone=def_zone)

playsound(loc, "sparks", 50, 1, -1)
if (shock_damage > 15)
visible_message(
SPAN_DANGER("\The [src] was electrocuted[source ? " by \the [source]" : ""]!"),
SPAN_DANGER("You feel a powerful shock course through your body!"),
SPAN_WARNING("You hear a heavy electrical crack.")
)
else
visible_message(
SPAN_DANGER("\The [src] was shocked[source ? " by \the [source]" : ""]."),
SPAN_DANGER("You feel a shock course through your body."),
SPAN_WARNING("You hear a zapping sound.")
)

switch(shock_damage)
if(11 to 15)
SET_STATUS_MAX(src, STAT_STUN, 1)
if(16 to 20)
SET_STATUS_MAX(src, STAT_STUN, 2)
if(21 to 25)
SET_STATUS_MAX(src, STAT_WEAK, 2)
if(26 to 30)
SET_STATUS_MAX(src, STAT_WEAK, 5)
if(31 to INFINITY)
SET_STATUS_MAX(src, STAT_WEAK, 10) //This should work for now, more is really silly and makes you lay there forever

set_status(STAT_JITTER, min(shock_damage*5, 200))

spark_at(loc, amount=5, cardinal_only = TRUE)

return shock_damage

/mob/living/emp_act(severity)
for(var/obj/O in get_mob_contents())
Expand Down Expand Up @@ -259,13 +304,13 @@

//This is called when the mob is thrown into a dense turf
/mob/living/proc/turf_collision(var/turf/T, var/speed)
visible_message("<span class='danger'>[src] slams into \the [T]!</span>")
visible_message(SPAN_DANGER("\The [src] slams into \the [T]!"))
playsound(T, 'sound/effects/bangtaper.ogg', 50, 1, 1)//so it plays sounds on the turf instead, makes for awesome carps to hull collision and such
apply_damage(speed*5, BRUTE)

/mob/living/proc/near_wall(var/direction,var/distance=1)
var/turf/T = get_step(get_turf(src),direction)
var/turf/last_turf = src.loc
var/turf/last_turf = loc
var/i = 1

while(i>0 && i<=distance)
Expand All @@ -286,7 +331,7 @@

admin_attack_log(user, src, "Attacked", "Was attacked", "attacked")

src.visible_message("<span class='danger'>\The [user] has [attack_message] \the [src]!</span>")
visible_message(SPAN_DANGER("\The [user] has [attack_message] \the [src]!"))
take_damage(damage)
user.do_attack_animation(src)
return 1
Expand Down
13 changes: 0 additions & 13 deletions code/modules/mob/living/living_electrocution.dm
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
//this proc returns the Siemens coefficient of electrical resistivity for a particular external organ.
/mob/living/proc/get_siemens_coefficient_organ(var/obj/item/organ/external/def_zone)
if (!def_zone)
return 1.0

var/siemens_coefficient = max(get_species()?.get_shock_vulnerability(src), 0)
for(var/slot in global.standard_clothing_slots)
var/obj/item/clothing/C = get_equipped_item(slot)
if(istype(C) && (C.body_parts_covered & def_zone.body_part)) // Is that body part being targeted covered?
siemens_coefficient *= C.siemens_coefficient

return siemens_coefficient

//Electrical shock
/mob/living/proc/apply_shock(var/shock_damage, var/def_zone, var/base_siemens_coeff = 1.0)

Expand Down
Loading

0 comments on commit 3e47c07

Please sign in to comment.