Skip to content

Commit

Permalink
Merge pull request #4803 from MistakeNot4892/devupdate
Browse files Browse the repository at this point in the history
Dev update from staging
  • Loading branch information
MistakeNot4892 authored Jan 25, 2025
2 parents ead9e47 + 36e2640 commit 471587d
Show file tree
Hide file tree
Showing 27 changed files with 351 additions and 268 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
4 changes: 2 additions & 2 deletions code/_onclick/click.dm
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,10 @@
return A.CtrlClick(src)

/atom/proc/CtrlClick(var/mob/user)
if(loc == user)
if(get_recursive_loc_of_type(/mob) == user)
var/decl/interaction_handler/handler = get_quick_interaction_handler(user)
if(handler)
var/using_item = user.get_active_held_item() || user.get_usable_hand_slot_organ()
var/using_item = user.get_active_held_item()
if(handler.is_possible(src, user, using_item))
return handler.invoked(src, user, using_item)
return FALSE
Expand Down
63 changes: 61 additions & 2 deletions code/datums/extensions/holster/holster.dm
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
to_chat(user, "It is empty.")

/datum/extension/holster/proc/check_holster()
if(holstered.loc != storage)
if(holstered.loc != storage.holder)
clear_holster()

/atom/proc/holster_verb(var/holster_name in get_holsters())
Expand Down Expand Up @@ -154,4 +154,63 @@
else
for(var/i = 1 to holster_accessories.len)
var/holster_name = "[accessory_name] [i]"
.[holster_name] = get_extension(holster_accessories[i], /datum/extension/holster)
.[holster_name] = get_extension(holster_accessories[i], /datum/extension/holster)

// Basic unholster for an item at the top level.
/decl/interaction_handler/unholster
name = "Unholster"

/decl/interaction_handler/unholster/is_possible(atom/target, mob/user, obj/item/prop)
. = ..() && !prop
if(.)
var/datum/extension/holster/holster = get_extension(target, /datum/extension/holster)
return !!holster?.holstered

/decl/interaction_handler/unholster/invoked(atom/target, mob/user, obj/item/prop)
var/datum/extension/holster/holster = get_extension(target, /datum/extension/holster)
return holster?.unholster(user, avoid_intent = TRUE)

// Interaction procs for getting this interaction for basic items.
/obj/item/get_quick_interaction_handler(mob/user)
if(!(. = ..()))
var/datum/extension/holster/holster = get_extension(src, /datum/extension/holster)
if(holster?.holstered)
return GET_DECL(/decl/interaction_handler/unholster)

// More complex version of the above that iterates clothing accessories.
/decl/interaction_handler/unholster_accessory
name = "Unholster From Accessory"
expected_target_type = /obj/item/clothing

/decl/interaction_handler/unholster_accessory/is_possible(atom/target, mob/user, obj/item/prop)
. = ..() && !prop
if(.)
var/obj/item/clothing/clothes = target
for(var/obj/item/thing in clothes.accessories)
var/datum/extension/holster/holster = get_extension(thing, /datum/extension/holster)
if(holster?.holstered)
return TRUE
return FALSE

/decl/interaction_handler/unholster_accessory/invoked(atom/target, mob/user, obj/item/prop)
var/obj/item/clothing/clothes = target
for(var/obj/item/thing in clothes.accessories)
var/datum/extension/holster/holster = get_extension(thing, /datum/extension/holster)
if(holster?.unholster(user, avoid_intent = TRUE))
return TRUE
return FALSE

// Interaction procs for getting this interaction for clothing accessories.
/obj/item/clothing/get_alt_interactions(mob/user)
. = ..()
for(var/obj/item/thing in accessories)
var/datum/extension/holster/holster = get_extension(thing, /datum/extension/holster)
if(holster?.holstered)
LAZYADD(., GET_DECL(/decl/interaction_handler/unholster_accessory))

/obj/item/clothing/get_quick_interaction_handler(mob/user)
if(!(. = ..()))
for(var/obj/item/thing in accessories)
var/datum/extension/holster/holster = get_extension(thing, /datum/extension/holster)
if(holster?.holstered)
return GET_DECL(/decl/interaction_handler/unholster_accessory)
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 @@ -96,7 +96,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
37 changes: 15 additions & 22 deletions code/game/objects/items/weapons/storage/belt.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
. = ..()
if(overlay_flags & BELT_OVERLAY_ITEMS)
var/list/cur_overlays
for(var/obj/item/I in contents)
if(I.use_single_icon)
LAZYADD(cur_overlays, I.get_on_belt_overlay())
for(var/obj/item/thing in contents)
if(thing.use_single_icon)
LAZYADD(cur_overlays, thing.get_on_belt_overlay())
else
LAZYADD(cur_overlays, overlay_image('icons/obj/clothing/obj_belt_overlays.dmi', I.icon_state))
LAZYADD(cur_overlays, overlay_image('icons/obj/clothing/obj_belt_overlays.dmi', thing.icon_state))

if(LAZYLEN(cur_overlays))
add_overlay(cur_overlays)
Expand All @@ -37,8 +37,8 @@
/obj/item/belt/get_mob_overlay(mob/user_mob, slot, bodypart, use_fallback_if_icon_missing = TRUE, skip_adjustment = FALSE)
var/image/ret = ..()
if(ret && slot == slot_belt_str && length(contents))
for(var/obj/item/I in contents)
var/image/new_overlay = I.get_mob_overlay(user_mob, slot, bodypart, use_fallback_if_icon_missing, TRUE)
for(var/obj/item/thing in contents)
var/image/new_overlay = thing.get_mob_overlay(user_mob, slot, bodypart, use_fallback_if_icon_missing, TRUE)
if(new_overlay)
ret.overlays += new_overlay
return ret
Expand All @@ -57,13 +57,6 @@
. = ..()
set_extension(src, /datum/extension/holster, storage, sound_in, sound_out, can_holster)

/obj/item/belt/holster/get_stored_inventory()
. = ..()
if(length(.))
var/datum/extension/holster/holster = get_extension(src, /datum/extension/holster)
if(holster.holstered)
. -= holster.holstered

/obj/item/belt/holster/attackby(obj/item/used_item, mob/user)
var/datum/extension/holster/holster = get_extension(src, /datum/extension/holster)
if(holster?.holster(used_item, user))
Expand All @@ -73,27 +66,27 @@
/obj/item/belt/holster/attack_hand(mob/user)
if(!user.check_dexterity(DEXTERITY_HOLD_ITEM, TRUE))
return ..()
var/datum/extension/holster/H = get_extension(src, /datum/extension/holster)
if(H.unholster(user))
var/datum/extension/holster/holster = get_extension(src, /datum/extension/holster)
if(holster?.unholster(user))
return TRUE
return ..()

/obj/item/belt/holster/examine(mob/user)
. = ..()
var/datum/extension/holster/H = get_extension(src, /datum/extension/holster)
H.examine_holster(user)
var/datum/extension/holster/holster = get_extension(src, /datum/extension/holster)
holster.examine_holster(user)

/obj/item/belt/holster/on_update_icon()
. = ..()
var/datum/extension/holster/H = get_extension(src, /datum/extension/holster)
var/datum/extension/holster/holster = get_extension(src, /datum/extension/holster)
if(overlay_flags)
var/list/cur_overlays
for(var/obj/item/I in contents)
if(I == H.holstered)
for(var/obj/item/thing in contents)
if(thing == holster.holstered)
if(overlay_flags & BELT_OVERLAY_HOLSTER)
LAZYADD(cur_overlays, overlay_image('icons/obj/clothing/obj_belt_overlays.dmi', I.icon_state))
LAZYADD(cur_overlays, overlay_image('icons/obj/clothing/obj_belt_overlays.dmi', thing.icon_state))
else if(overlay_flags & BELT_OVERLAY_ITEMS)
LAZYADD(cur_overlays, overlay_image('icons/obj/clothing/obj_belt_overlays.dmi', I.icon_state))
LAZYADD(cur_overlays, overlay_image('icons/obj/clothing/obj_belt_overlays.dmi', thing.icon_state))

if(LAZYLEN(cur_overlays))
add_overlay(cur_overlays)
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 @@ -227,25 +228,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
2 changes: 1 addition & 1 deletion code/game/turfs/turf_fluids.dm
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
create_reagents(FLUID_MAX_DEPTH)
return ..()

/turf/add_to_reagents(reagent_type, amount, data, safety = FALSE, defer_update = FALSE, phase)
/turf/add_to_reagents(reagent_type, amount, data, safety = FALSE, defer_update = FALSE, phase = null)
if(!reagents)
create_reagents(FLUID_MAX_DEPTH)
return ..()
Expand Down
8 changes: 4 additions & 4 deletions code/modules/clothing/_clothing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -302,12 +302,12 @@
update_clothing_icon()

/obj/item/clothing/get_examine_name()
var/list/ensemble = list(name)
var/list/ensemble = list(..())
for(var/obj/item/clothing/accessory in accessories)
if(accessory.accessory_visibility == ACCESSORY_VISIBILITY_ENSEMBLE)
LAZYADD(ensemble, accessory.get_examine_name())
if(length(ensemble) <= 1)
return ..()
ensemble += accessory.get_examine_name()
if(length(ensemble) == 1) // don't worry about it being empty, we always have a minimum of one
return ensemble[1]
return english_list(ensemble, summarize = TRUE)

/obj/item/clothing/get_examine_line()
Expand Down
Loading

0 comments on commit 471587d

Please sign in to comment.