Skip to content

Commit

Permalink
Merge pull request #9 from MistakeNot4892/crux
Browse files Browse the repository at this point in the history
Updates from Neb
  • Loading branch information
MistakeNot4892 authored Jan 9, 2024
2 parents 8b806e4 + 9a1f226 commit 19ae03d
Show file tree
Hide file tree
Showing 109 changed files with 667 additions and 623 deletions.
3 changes: 1 addition & 2 deletions code/_onclick/hud/deity.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

/datum/hud/deity/FinalizeInstantiation()
action_intent = new /obj/screen/intent/deity(null, mymob)
src.adding = list(action_intent)
src.other = list()
adding += action_intent
..()
var/obj/screen/intent/deity/D = action_intent
D.sync_to_mob(mymob)
2 changes: 1 addition & 1 deletion code/_onclick/hud/fullscreen.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
return null

if(!screen)
screen = new type()
screen = new type(null, src)

screen.icon_state = "[initial(screen.icon_state)][severity]"
screen.severity = severity
Expand Down
5 changes: 1 addition & 4 deletions code/_onclick/hud/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@
if(hud_data.has_resist)
src.hotkeybuttons += new /obj/screen/resist(null, mymob, ui_style, ui_color, ui_alpha)

mymob.maneuver_icon = new
mymob.maneuver_icon.icon = ui_style
mymob.maneuver_icon.color = ui_color
mymob.maneuver_icon.alpha = ui_alpha
mymob.maneuver_icon = new(null, mymob, ui_style, ui_color, ui_alpha)
src.hotkeybuttons += mymob.maneuver_icon
hud_elements |= mymob.maneuver_icon

Expand Down
36 changes: 23 additions & 13 deletions code/_onclick/other_mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -63,27 +63,37 @@
/*
Animals
*/

/mob/living/simple_animal/UnarmedAttack(var/atom/A, var/proximity)

. = ..()
if(.)
return

setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
if(isliving(A))
if(a_intent == I_HELP || !get_natural_weapon())
custom_emote(1,"[friendly] [A]!")
setClickCooldown(attack_delay)
var/attacking_with = get_natural_weapon()
if(a_intent == I_HELP || !attacking_with)
return A.attack_animal(src)

var/decl/pronouns/G = get_pronouns()
face_atom(A)
if(attack_delay)
walk_to(src, 0) // Cancel any baked-in movement.
do_windup_animation(A, attack_delay, no_reset = TRUE)
if(!do_after(src, attack_delay, A) || !Adjacent(A))
visible_message(SPAN_NOTICE("\The [src] misses [G.his] attack on \the [A]!"))
animate(src, pixel_x = default_pixel_x, pixel_y = default_pixel_y, time = 2) // reset wherever the attack animation got us to.
MoveToTarget(TRUE) // Restart hostile mob tracking.
return TRUE
else if(ckey)
admin_attack_log(src, A, "Has attacked its victim.", "Has been attacked by its attacker.")
MoveToTarget(TRUE) // Restart hostile mob tracking.

if(ismob(A)) // Clientless mobs are too dum to move away, so they can be missed.
var/mob/mob = A
if(!mob.ckey && !prob(get_melee_accuracy()))
visible_message(SPAN_NOTICE("\The [src] misses [G.his] attack on \the [A]!"))
return TRUE
if(a_intent == I_HELP)
return A.attack_animal(src)
else
var/attacking_with = get_natural_weapon()
if(attacking_with)
return A.attackby(attacking_with, src)
return FALSE

return A.attackby(attacking_with, src)

// Attack hand but for simple animals
/atom/proc/attack_animal(mob/user)
Expand Down
9 changes: 5 additions & 4 deletions code/controllers/subsystems/zcopy.dm
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,11 @@ SUBSYSTEM_DEF(zcopy)
qo_idex = 1

/datum/controller/subsystem/zcopy/proc/flush_z_state(turf/T)
if (T.below.mimic_above_copy)
QDEL_NULL(T.below.mimic_above_copy)
if (T.below.mimic_proxy)
QDEL_NULL(T.below.mimic_proxy)
if(T.below)
if (T.below.mimic_above_copy)
QDEL_NULL(T.below.mimic_above_copy)
if (T.below.mimic_proxy)
QDEL_NULL(T.below.mimic_proxy)
for (var/atom/movable/openspace/OO in T)
if (istype(OO, /atom/movable/openspace/mimic))
qdel(OO)
Expand Down
16 changes: 8 additions & 8 deletions code/datums/extensions/cell/cell.dm
Original file line number Diff line number Diff line change
Expand Up @@ -147,20 +147,20 @@
/datum/extension/loaded_cell/proc/get_examine_text(var/obj/item/cell/current_cell)
. = list()
if(current_cell)
. += SPAN_NOTICE("\The [src] has \a [current_cell] installed.")
. += SPAN_NOTICE("\The [src] is [round(current_cell.percent())]% charged.")
. += SPAN_NOTICE("\The [holder] has \a [current_cell] installed.")
. += SPAN_NOTICE("\The [holder] is [round(current_cell.percent())]% charged.")
if(can_modify)
if(requires_tool)
var/decl/tool_archetype/needed_tool = GET_DECL(requires_tool)
. += SPAN_NOTICE("\The [src] power supply requires \a [needed_tool.name] to remove.")
. += SPAN_NOTICE("\The [holder] power supply requires \a [needed_tool.name] to remove.")
else
. += SPAN_NOTICE("Hold \the [src] in an off-hand and click it with an empty hand to remove the power supply.")
. += SPAN_NOTICE("Hold \the [holder] in an off-hand and click it with an empty hand to remove the power supply.")
else
. += SPAN_NOTICE("\The [src] power supply cannot be removed.")
. += SPAN_NOTICE("\The [holder] power supply cannot be removed.")
else
var/obj/item/cell = expected_cell_type
. += SPAN_WARNING("\The [src] has no power source installed.")
. += SPAN_WARNING("\The [holder] has no power source installed.")
if(can_modify)
. += SPAN_NOTICE("\The [src] is compatible with \a [initial(cell.name)].")
. += SPAN_NOTICE("\The [holder] is compatible with \a [initial(cell.name)].")
else
. += SPAN_NOTICE("\The [src] power supply cannot be replaced.")
. += SPAN_NOTICE("\The [holder] power supply cannot be replaced.")
2 changes: 1 addition & 1 deletion code/datums/inventory_slots/slots/slot_gloves.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
if(_holding && !(suit && suit.flags_inv & HIDEGLOVES))
user.set_current_mob_overlay(HO_GLOVES_LAYER, _holding.get_mob_overlay(user, slot_gloves_str, use_fallback_if_icon_missing = use_overlay_fallback_slot), redraw_mob)
return
var/mob_blood_overlay = user.get_bodytype().get_blood_overlays(src)
var/mob_blood_overlay = user.get_bodytype()?.get_blood_overlays(src)
if(mob_blood_overlay)
var/blood_color
for(var/obj/item/organ/external/grabber in user.get_hands_organs())
Expand Down
2 changes: 1 addition & 1 deletion code/datums/inventory_slots/slots/slot_shoes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
if(_holding && !((suit && suit.flags_inv & HIDESHOES) || (uniform && uniform.flags_inv & HIDESHOES)))
user.set_current_mob_overlay(HO_SHOES_LAYER, _holding.get_mob_overlay(user, slot_shoes_str, use_fallback_if_icon_missing = use_overlay_fallback_slot), redraw_mob)
return
var/mob_blood_overlay = user.get_bodytype().get_blood_overlays(src)
var/mob_blood_overlay = user.get_bodytype()?.get_blood_overlays(src)
if(mob_blood_overlay)
var/blood_color
for(var/foot_tag in list(BP_L_FOOT, BP_R_FOOT))
Expand Down
8 changes: 1 addition & 7 deletions code/datums/repositories/atom_info.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,7 @@ var/global/repository/atom_info/atom_info_repository = new()
var/atom/instance
if(!matter_cache[key])
instance = get_instance_of(path, material, amount)
var/matter_list = instance.building_cost()
if(istype(instance, /obj/item/ammo_magazine) || istype(instance, /obj/item/storage))
for(var/obj/thing in instance)
var/list/thing_matter = thing.building_cost()
for(var/mat in thing_matter)
matter_cache[mat] += thing_matter[mat]
matter_cache[key] = matter_list
matter_cache[key] = instance.get_contained_matter()
if(!combined_worth_cache[key])
instance = instance || get_instance_of(path, material, amount)
combined_worth_cache[key] = instance.get_combined_monetary_worth()
Expand Down
22 changes: 13 additions & 9 deletions code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,19 @@
SHOULD_CALL_PARENT(FALSE) //Don't call the stub plz
return

/**
* Returns the sum of this atoms's reagents plus the combined matter of all its contents.
* Obj adds matter contents. Other overrides may add extra handling for things like material storage.
* Most useful for calculating worth or deconstructing something along with its contents.
*/
/atom/proc/get_contained_matter()
if(length(reagents?.reagent_volumes))
LAZYINITLIST(.)
for(var/R in reagents.reagent_volumes)
.[R] += FLOOR(REAGENT_VOLUME(reagents, R) / REAGENT_UNITS_PER_MATERIAL_UNIT)
for(var/atom/contained_obj as anything in get_contained_external_atoms()) // machines handle component parts separately
. = MERGE_ASSOCS_WITH_NUM_VALUES(., contained_obj.get_contained_matter())

/// Return a list of all simulated atoms inside this one.
/atom/proc/get_contained_external_atoms()
for(var/atom/movable/AM in contents)
Expand Down Expand Up @@ -751,15 +764,6 @@
RETURN_TYPE(/obj/item/radio)
return

/**
Get the material cost of this atom.
- Return: An dictionary where key is the material and value is the amount.
*/
/atom/proc/building_cost()
RETURN_TYPE(/list)
. = list()

/atom/Topic(href, href_list)
var/mob/user = usr
if(href_list["look_at_me"] && istype(user))
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/cult/ghosts.dm
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@
return

to_chat(choice, "<span class='danger'>You feel as if something cold passed through you!</span>")
var/temp_threshold = choice.get_temperature_threshold(COLD_LEVEL_1)
var/temp_threshold = choice.get_mob_temperature_threshold(COLD_LEVEL_1)
if(choice.bodytemperature >= temp_threshold + 1)
choice.bodytemperature = max(temp_threshold + 1, choice.bodytemperature - 30)
to_chat(src, "<span class='notice'>You pass through \the [choice], giving them a sudden chill.</span>")
Expand Down
17 changes: 6 additions & 11 deletions code/game/machinery/_machines_base/machinery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -460,15 +460,6 @@ Class Procs:
if(battery && (!functional_only || battery.is_functional()))
return battery.get_cell()

/obj/machinery/building_cost()
. = ..()
var/list/component_types = types_of_component(/obj/item/stock_parts)
for(var/path in component_types)
var/obj/item/stock_parts/part = get_component_of_type(path)
var/list/part_costs = part.building_cost()
for(var/key in part_costs)
.[key] += part_costs[key] * component_types[path]

/obj/machinery/emag_act(remaining_charges, mob/user, emag_source)
. = ..()
for(var/obj/item/stock_parts/access_lock/lock in get_all_components_of_type(/obj/item/stock_parts/access_lock))
Expand All @@ -489,8 +480,12 @@ Class Procs:
// This only includes external atoms by default, so we need to add components back.
/obj/machinery/get_contained_matter()
. = ..()
for(var/obj/component in component_parts)
. = MERGE_ASSOCS_WITH_NUM_VALUES(., component.get_contained_matter())
var/list/component_types = types_of_component(/obj/item/stock_parts)
for(var/path in component_types)
for(var/obj/item/stock_parts/part in get_all_components_of_type(path))
var/list/part_costs = part.get_contained_matter()
for(var/key in part_costs)
.[key] += part_costs[key] * component_types[path]

/obj/machinery/proc/get_auto_access()
var/area/A = get_area(src)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@
materials = null
..()

/obj/item/stock_parts/building_material/building_cost()
/obj/item/stock_parts/building_material/get_contained_matter()
. = ..()
for(var/obj/item/thing in materials)
var/list/costs = thing.building_cost()
var/list/costs = thing.get_contained_matter()
for(var/key in costs)
.[key] += costs[key]
.[key] += costs[key]
10 changes: 6 additions & 4 deletions code/game/machinery/flasher.dm
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,12 @@
flash_time = round(H.getFlashMod() * flash_time)
if(flash_time <= 0)
return
var/obj/item/organ/internal/E = GET_INTERNAL_ORGAN(H, H.get_bodytype().vision_organ)
if(E && E.is_bruised() && prob(E.damage + 50))
H.flash_eyes()
E.damage += rand(1, 5)
var/vision_organ = H.get_bodytype()?.vision_organ
if(vision_organ)
var/obj/item/organ/internal/E = GET_INTERNAL_ORGAN(H, vision_organ)
if(E && E.is_bruised() && prob(E.damage + 50))
H.flash_eyes()
E.damage += rand(1, 5)

if(!O.is_blind())
do_flash(O, flash_time)
Expand Down
56 changes: 45 additions & 11 deletions code/game/machinery/suit_cycler.dm
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,40 @@

overlays = new_overlays

/obj/machinery/suit_cycler/proc/loaded_item_destroyed()
if(suit && QDELETED(suit))
suit = null
. = TRUE
if(helmet && QDELETED(helmet))
helmet = null
. = TRUE
if(boots && QDELETED(boots))
boots = null
. = TRUE
if(.)
update_icon()

/obj/machinery/suit_cycler/proc/set_suit(obj/item/new_suit)
if(istype(suit))
events_repository.unregister(/decl/observ/destroyed, suit, src)
suit = new_suit
if(istype(suit))
events_repository.register(/decl/observ/destroyed, suit, src, /obj/machinery/suit_cycler/proc/loaded_item_destroyed)

/obj/machinery/suit_cycler/proc/set_helmet(obj/item/new_helmet)
if(istype(helmet))
events_repository.unregister(/decl/observ/destroyed, helmet, src)
helmet = new_helmet
if(istype(helmet))
events_repository.register(/decl/observ/destroyed, helmet, src, /obj/machinery/suit_cycler/proc/loaded_item_destroyed)

/obj/machinery/suit_cycler/proc/set_boots(obj/item/new_boots)
if(istype(boots))
events_repository.unregister(/decl/observ/destroyed, boots, src)
boots = new_boots
if(istype(boots))
events_repository.register(/decl/observ/destroyed, boots, src, /obj/machinery/suit_cycler/proc/loaded_item_destroyed)

/obj/machinery/suit_cycler/Initialize(mapload, d=0, populate_parts = TRUE)
. = ..()
if(!length(available_modifications) || !length(available_bodytypes))
Expand All @@ -102,11 +136,11 @@

if(populate_parts)
if(ispath(suit))
suit = new suit(src)
set_suit(new suit(src))
if(ispath(helmet))
helmet = new helmet(src)
set_helmet(new helmet(src))
if(ispath(boots))
boots = new boots(src)
set_boots(new boots(src))

available_modifications = list_values(decls_repository.get_decls(available_modifications))

Expand Down Expand Up @@ -143,7 +177,7 @@

visible_message(SPAN_WARNING("\The [user] starts putting \the [target] into the suit cycler."))
if(do_after(user, 20, src))
if(!istype(target) || locked || suit || helmet || !target.Adjacent(user) || !user.Adjacent(src) || user.incapacitated())
if(!istype(target) || locked || suit || helmet || boots || !target.Adjacent(user) || !user.Adjacent(src) || user.incapacitated())
return FALSE
target.reset_view(src)
target.forceMove(src)
Expand Down Expand Up @@ -186,7 +220,7 @@
if(!user.try_unequip(I, src))
return
to_chat(user, "You fit \the [I] into the suit cycler.")
boots = I
set_boots(I)
update_icon()
updateUsrDialog()

Expand All @@ -202,7 +236,7 @@
if(!user.try_unequip(I, src))
return
to_chat(user, "You fit \the [I] into the suit cycler.")
helmet = I
set_helmet(I)
update_icon()
updateUsrDialog()
return
Expand All @@ -220,7 +254,7 @@
if(!user.try_unequip(I, src))
return
to_chat(user, "You fit \the [I] into the suit cycler.")
suit = I
set_suit(I)
update_icon()
updateUsrDialog()
return
Expand Down Expand Up @@ -275,7 +309,7 @@
dat += "<b>Suit: </b> [suit ? "\the [suit]" : "no suit stored" ]. <A href='?src=\ref[src];eject_suit=1'>Eject</a><br/>"
dat += "<b>Boots: </b> [boots ? "\the [boots]" : "no boots stored" ]. <A href='?src=\ref[src];eject_boots=1'>Eject</a>"

if(can_repair && suit && istype(suit))
if(can_repair && istype(suit))
dat += "[(suit.damage ? " <A href='?src=\ref[src];repair_suit=1'>Repair</a>" : "")]"

dat += "<br/><b>UV decontamination systems:</b> <font color = '[emagged ? "red'>SYSTEM ERROR" : "green'>READY"]</font><br>"
Expand All @@ -297,15 +331,15 @@
if(href_list["eject_suit"])
if(!suit) return
suit.dropInto(loc)
suit = null
set_suit(null)
else if(href_list["eject_helmet"])
if(!helmet) return
helmet.dropInto(loc)
helmet = null
set_helmet(null)
else if(href_list["eject_boots"])
if(!boots) return
boots.dropInto(loc)
boots = null
set_boots(null)
else if(href_list["select_department"])
var/choice = input("Please select the target department paintjob.", "Suit cycler", target_modification) as null|anything in available_modifications
if(choice && CanPhysicallyInteract(usr))
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/vending/medical.dm
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
/obj/item/clothing/mask/chewable/candy/lolli/meds = 8,
/obj/item/chems/pill/bromide = 3,
/obj/item/chems/pill/stox = 4,
/obj/item/chems/pill/antitox = 6
/obj/item/chems/pill/antitoxins = 6
)
idle_power_usage = 211 //refrigerator - believe it or not, this is actually the average power consumption of a refrigerated vending machine according to NRCan.

Expand Down
Loading

0 comments on commit 19ae03d

Please sign in to comment.