Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/datums/elements/world_icon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
SIGNAL_HANDLER

if(!world_icon_state)
source.icon_state = source.item_state
source.icon_state = source.icon_state
return

INVOKE_ASYNC(src, PROC_REF(check_world_icon_state), source)
Expand Down
32 changes: 24 additions & 8 deletions code/game/machinery/defibrillator_mount.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
//Holds defibs and recharges them from the powernet
//You can activate the mount with an empty hand to grab the paddles
//Not being adjacent will cause the paddles to snap back

//TODO: directionals / wallmount dir system
/obj/machinery/defibrillator_mount
name = "defibrillator mount"
desc = "Holds defibrillators. You can grab the paddles if one is mounted."
Expand All @@ -25,6 +27,7 @@

/obj/machinery/defibrillator_mount/Destroy()
if(defib)
UnregisterSignal(defib, COMSIG_ATOM_UPDATE_APPEARANCE)
QDEL_NULL(defib)
. = ..()

Expand All @@ -45,15 +48,20 @@

. += "defib"

if(!defib.on)
. += "paddles"

if(defib.powered)
var/obj/item/stock_parts/cell/C = get_cell()
. += (defib.safety ? "online" : "emagged")
var/ratio = C.charge / C.maxcharge
ratio = CEILING(ratio * 4, 1) * 25
. += "charge[ratio]"
var/obj/item/stock_parts/cell/defibs_cell = get_cell()
. += (defib.safety ? "powered" : "emagged")
if(!QDELETED(defibs_cell))
var/ratio = defibs_cell.charge / defibs_cell.maxcharge
ratio = CEILING(ratio * 4, 1) * 25
. += "charge[ratio]"

if(!get_cell())
. += "nocell"

if(clamps_locked)
. += "clamps"

/obj/machinery/defibrillator_mount/get_cell()
if(defib)
Expand All @@ -67,7 +75,9 @@
if(defib.paddles.loc != defib)
to_chat(user, span_warning("[defib.paddles.loc == user ? "You are already" : "Someone else is"] holding [defib]'s paddles!"))
return
defib.on = TRUE
user.put_in_hands(defib.paddles)
update_appearance()

/obj/machinery/defibrillator_mount/attackby(obj/item/I, mob/living/user, params)
if(istype(I, /obj/item/defibrillator))
Expand All @@ -83,11 +93,13 @@
return
user.visible_message(span_notice("[user] hooks up [I] to [src]!"), \
span_notice("You press [I] into the mount, and it clicks into place."))
playsound(src, 'sound/machines/click.ogg', 50, TRUE)
playsound(src, 'sound/items/taperecorder_close.ogg', 50, TRUE)
// Make sure the defib is set before processing begins.
defib = I
begin_processing()
RegisterSignal(defib, COMSIG_ATOM_UPDATE_APPEARANCE, PROC_REF(defib_update_appearance))
update_appearance()

return
else if(defib && I == defib.paddles)
defib.paddles.snap_back()
Expand Down Expand Up @@ -158,6 +170,7 @@
playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
// Make sure processing ends before the defib is nulled
end_processing()
UnregisterSignal(defib, COMSIG_ATOM_UPDATE_APPEARANCE)
defib = null
update_appearance()

Expand Down Expand Up @@ -191,6 +204,9 @@
C.give(40 * seconds_per_tick)
update_appearance()

/obj/machinery/defibrillator_mount/proc/defib_update_appearance()
update_appearance()

//wallframe, for attaching the mounts easily
/obj/item/wallframe/defib_mount
name = "unhooked defibrillator mount"
Expand Down
4 changes: 4 additions & 0 deletions code/game/objects/items/defib.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
name = "defibrillator"
desc = "A device that delivers powerful shocks to detachable paddles that resuscitate incapacitated patients."
icon = 'icons/obj/defib.dmi'
world_file = 'icons/obj/world/defib_world.dmi'
icon_state = "defibunit"
item_state = "defibunit"
lefthand_file = 'icons/mob/inhands/equipment/medical_lefthand.dmi'
Expand Down Expand Up @@ -235,11 +236,13 @@
paddles.update_appearance()
update_power()

//when you touch up defib code, maybe just remove?
/obj/item/defibrillator/compact
name = "compact defibrillator"
desc = "A belt-equipped defibrillator that can be rapidly deployed."
icon_state = "defibcompact"
item_state = "defibcompact"
world_file = null
w_class = WEIGHT_CLASS_NORMAL
slot_flags = ITEM_SLOT_BELT

Expand All @@ -257,6 +260,7 @@
desc = "A belt-equipped blood-red defibrillator. Can revive through spacesuits, has an experimental self-recharging battery, and can be utilized in combat via applying the paddles in a disarming or agressive manner."
icon_state = "defibcombat" //needs defib inhand sprites
item_state = "defibcombat"
world_file = null
combat = TRUE
safety = FALSE
cooldown_duration = 2.5 SECONDS
Expand Down
4 changes: 3 additions & 1 deletion code/game/objects/items/robot/robot_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,9 @@
if(stored)
var/obj/item/reagent_containers/C = stored
C.SplashReagents(get_turf(src))
qdel(stored)
C.forceMove(get_turf(src))
stored = null
qdel(C)
. = ..()

/obj/item/borg/apparatus/beaker/examine()
Expand Down
3 changes: 1 addition & 2 deletions code/game/objects/items/storage/firstaid.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/obj/item/storage/firstaid
name = "first-aid kit"
desc = "An emergency medical aid kit."
icon = 'icons/obj/storage.dmi'
icon = 'icons/obj/storage/medkit.dmi'
icon_state = "firstaid"
lefthand_file = 'icons/mob/inhands/equipment/medical_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/medical_righthand.dmi'
Expand Down Expand Up @@ -126,7 +126,6 @@
generate_items_inside(items_inside,src)

/obj/item/storage/firstaid/ancient
icon = 'icons/obj/storage.dmi'
icon_state = "firstaid_old"
desc = "A basic first aid kit. It looks a little old..."

Expand Down
1 change: 1 addition & 0 deletions code/modules/food_and_drinks/coffee/items/condiment.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
name = "syrup bottle"
desc = "A bottle with a syrup pump to dispense the delicious substance directly into your coffee cup."
icon = 'icons/obj/item/coffee.dmi'
world_file = null
icon_state = "syrup"
fill_icon_state = "syrup"
fill_icon_thresholds = list(0, 20, 40, 60, 80, 100)
Expand Down
18 changes: 17 additions & 1 deletion code/modules/reagents/reagent_containers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,25 @@

/obj/item/reagent_containers/update_overlays()
. = ..()
//no other way to check if it's a world icon
var/is_world = FALSE
if(world_file && icon == world_file)
is_world = TRUE
if(cap_overlay)
cap_overlay.icon = icon

if(cap_on)
. += cap_overlay
if(!fill_icon_thresholds)
return
if(!reagents.total_volume)
if(!reagents || !reagents.total_volume)
return


var/fill_name = fill_icon_state? fill_icon_state : icon_state
if(is_world)
fill_name += "_world"

var/mutable_appearance/filling = mutable_appearance(fill_icon, "[fill_name][fill_icon_thresholds[1]]")

var/percent = round((reagents.total_volume / volume) * 100)
Expand All @@ -297,3 +308,8 @@
var/datum/reagent/R = reagent
list_reagents[R.type] = R.volume
return ..() + "list_reagents"

/obj/item/reagent_containers/Destroy()
. = ..()
QDEL_NULL(cap_overlay)
QDEL_NULL(reagents)
4 changes: 4 additions & 0 deletions code/modules/reagents/reagent_containers/bottle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
/obj/item/reagent_containers/glass/bottle
name = "bottle"
desc = "A small bottle."
icon = 'icons/obj/chemical/beakers.dmi'
world_file = 'icons/obj/chemical/beakers_world.dmi'
icon_state = "bottle"
lefthand_file = 'icons/mob/inhands/equipment/medical_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/medical_righthand.dmi'
item_state = "atoxinbottle"
possible_transfer_amounts = list(5,10,15,25,30)
volume = 30
Expand Down
3 changes: 2 additions & 1 deletion code/modules/reagents/reagent_containers/dropper.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/obj/item/reagent_containers/dropper
name = "dropper"
desc = "A dropper. Holds up to 5 units."
world_file = 'icons/obj/chemical/beakers_world.dmi'
icon = 'icons/obj/chemical/beakers.dmi'
icon_state = "dropper0"
amount_per_transfer_from_this = 5
Expand Down Expand Up @@ -84,7 +85,7 @@

/obj/item/reagent_containers/dropper/update_overlays()
. = ..()
if(!reagents.total_volume)
if(!reagents || !reagents.total_volume)
return
var/mutable_appearance/filling = mutable_appearance('icons/obj/reagentfillings.dmi', "dropper")
filling.color = mix_color_from_reagents(reagents.reagent_list)
Expand Down
6 changes: 6 additions & 0 deletions code/modules/reagents/reagent_containers/glass.dm
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,11 @@
name = "beaker"
desc = "A beaker. It can hold up to 50 units."
icon = 'icons/obj/chemical/beakers.dmi'
world_file = 'icons/obj/chemical/beakers_world.dmi'
icon_state = "beaker"
item_state = "beaker"
lefthand_file = 'icons/mob/inhands/equipment/medical_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/medical_righthand.dmi'
custom_materials = list(/datum/material/glass=500)
fill_icon_thresholds = list(1, 40, 60, 80, 100)
can_have_cap = TRUE
Expand Down Expand Up @@ -180,6 +183,8 @@
name = "cryostasis beaker"
desc = "A cryostasis beaker that allows for chemical storage without \
reactions. Can hold up to 50 units."
// No clue if this is obtainable, but it's so rare i havent really seen one in forever
world_file = null
icon_state = "beakernoreact"
custom_materials = list(/datum/material/iron=3000)
reagent_flags = NO_REACT
Expand Down Expand Up @@ -312,6 +317,7 @@
/obj/item/reagent_containers/glass/filter
name = "seperatory funnel"
desc = "A crude tool created by welding several beakers together. It would probably be useful for seperating reagents."
world_file = 'icons/obj/chemical/beakers_world.dmi'
icon_state = "beakerfilter"
item_state = "beaker"
volume = 100
Expand Down
79 changes: 43 additions & 36 deletions code/modules/reagents/reagent_containers/hypovial.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
name = "broken hypovial"
desc = "A hypovial compatible with most hyposprays."
icon = 'icons/obj/chemical/hypovial.dmi'
//almost missed this, TODO: basic check for all items with 'world_file' var that their icon state is valid?
world_file = null
icon_state = "hypovial"
spillable = FALSE
var/comes_with = list() //Easy way of doing this.
Expand Down Expand Up @@ -38,24 +40,26 @@

/obj/item/reagent_containers/glass/bottle/vial/update_appearance()
cut_overlays()
if(reagents.total_volume)
var/mutable_appearance/filling = mutable_appearance('icons/obj/reagentfillings.dmi', "hypovial10")

var/percent = round((reagents.total_volume / volume) * 100)
switch(percent)
if(0 to 9)
filling.icon_state = "hypovial10"
if(10 to 29)
filling.icon_state = "hypovial25"
if(30 to 49)
filling.icon_state = "hypovial50"
if(50 to 85)
filling.icon_state = "hypovial75"
if(86 to INFINITY)
filling.icon_state = "hypovial100"

filling.color = mix_color_from_reagents(reagents.reagent_list)
add_overlay(filling)
if(!reagents || !reagents.total_volume)
return ..()

var/mutable_appearance/filling = mutable_appearance('icons/obj/reagentfillings.dmi', "hypovial10")

var/percent = round((reagents.total_volume / volume) * 100)
switch(percent)
if(0 to 9)
filling.icon_state = "hypovial10"
if(10 to 29)
filling.icon_state = "hypovial25"
if(30 to 49)
filling.icon_state = "hypovial50"
if(50 to 85)
filling.icon_state = "hypovial75"
if(86 to INFINITY)
filling.icon_state = "hypovial100"

filling.color = mix_color_from_reagents(reagents.reagent_list)
add_overlay(filling)
return ..()

/obj/item/reagent_containers/glass/bottle/vial/tiny
Expand Down Expand Up @@ -93,26 +97,29 @@
)
unique_reskin_changes_name = TRUE

//TODO: When you resprite this, make this code... less copy and pasted
/obj/item/reagent_containers/glass/bottle/vial/large/update_appearance()
cut_overlays()
if(reagents.total_volume)
var/mutable_appearance/filling = mutable_appearance('icons/obj/reagentfillings.dmi', "hypoviallarge10")

var/percent = round((reagents.total_volume / volume) * 100)
switch(percent)
if(0 to 9)
filling.icon_state = "hypoviallarge10"
if(10 to 29)
filling.icon_state = "hypoviallarge25"
if(30 to 49)
filling.icon_state = "hypoviallarge50"
if(50 to 85)
filling.icon_state = "hypoviallarge75"
if(86 to INFINITY)
filling.icon_state = "hypoviallarge100"

filling.color = mix_color_from_reagents(reagents.reagent_list)
add_overlay(filling)
if(!reagents || !reagents.total_volume)
return ..()

var/mutable_appearance/filling = mutable_appearance('icons/obj/reagentfillings.dmi', "hypoviallarge10")

var/percent = round((reagents.total_volume / volume) * 100)
switch(percent)
if(0 to 9)
filling.icon_state = "hypoviallarge10"
if(10 to 29)
filling.icon_state = "hypoviallarge25"
if(30 to 49)
filling.icon_state = "hypoviallarge50"
if(50 to 85)
filling.icon_state = "hypoviallarge75"
if(86 to INFINITY)
filling.icon_state = "hypoviallarge100"

filling.color = mix_color_from_reagents(reagents.reagent_list)
add_overlay(filling)
return ..()

/obj/item/reagent_containers/glass/bottle/vial/large/bluespace
Expand Down
3 changes: 2 additions & 1 deletion code/modules/reagents/reagent_containers/jug.dm
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/obj/item/reagent_containers/glass/chem_jug
name = "chemical jug"
desc = "A large jug used for storing bulk quantities of chemicals. Provided with an anti-tamper seal which ensures that the contents are pure."
icon = 'icons/obj/chemical/chem_jug.dmi' // the coloring of labels for elemental chemicals is based on the chemical group block coloring at https://pubchem.ncbi.nlm.nih.gov/periodic-table/ . Everything else is whatever.
icon = 'icons/obj/chemical/chem_jug.dmi'
world_file = 'icons/obj/chemical/chem_jug_world.dmi'
icon_state = "chem_jug"
item_state = "sheet-plastic"
w_class = WEIGHT_CLASS_BULKY
Expand Down
2 changes: 2 additions & 0 deletions code/modules/reagents/reagent_containers/mortar.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ to accommodate additional materials.
desc = "An ancient, simple tool used in conjunction with a mortar to grind or juice items."
w_class = WEIGHT_CLASS_SMALL
icon = 'icons/obj/chemical/mortar.dmi'
world_file = 'icons/obj/chemical/mortar_world.dmi'
icon_state = "pestle"
force = 7

/obj/item/reagent_containers/glass/mortar
name = "mortar"
desc = "A specially formed bowl of ancient design. It is possible to crush or juice items placed in it using a pestle; however the process, unlike modern methods, is slow and physically exhausting. Alt click to eject the item."
icon = 'icons/obj/chemical/mortar.dmi'
world_file = 'icons/obj/chemical/mortar_world.dmi'
icon_state = "mortar_wood"
fill_icon_state = "mortar"
fill_icon_thresholds = list(1, 20, 40, 80, 100)
Expand Down
1 change: 1 addition & 0 deletions code/modules/reagents/reagent_containers/patch.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "chemical patch"
desc = "A chemical patch for touch based applications."
icon = 'icons/obj/chemical/medicine.dmi'
world_file = null
icon_state = "bandaid"
item_state = "bandaid"
possible_transfer_amounts = list()
Expand Down
Loading
Loading