Merge branch 'master' into init_update_and_stuff

This commit is contained in:
alberyk
2022-03-05 17:05:46 -03:00
46 changed files with 347 additions and 405 deletions
@@ -8,6 +8,7 @@
var/amount_per_transfer_from_this = 5
var/possible_transfer_amounts = list(5,10,15,25,30)
var/volume = 30
var/filling_states // List of percentages full that have icons
var/accuracy = 1
var/fragile = 0 // If nonzero, above what force do we shatter?
var/shatter_sound = /decl/sound_category/glass_break_sound
@@ -58,6 +59,21 @@
/obj/item/reagent_containers/attack_self(mob/user)
return
/obj/item/reagent_containers/proc/get_filling_state()
var/percent = round((reagents.total_volume / volume) * 100)
var/list/increments = cached_number_list_decode(filling_states)
if(!length(increments))
return
var/last_increment = increments[1]
for(var/increment in increments)
if(percent < increment)
break
last_increment = increment
return last_increment
/obj/item/reagent_containers/throw_impact(atom/hit_atom, var/speed)
. = ..()
if(ismob(loc))
@@ -17,7 +17,8 @@
name = "blood pack"
desc = "Contains blood used for transfusion."
icon = 'icons/obj/bloodpack.dmi'
icon_state = "empty"
icon_state = "bloodpack"
filling_states = "-10;10;25;50;75;80;100"
w_class = ITEMSIZE_SMALL
volume = 200
@@ -55,15 +56,12 @@
/obj/item/reagent_containers/blood/update_icon()
cut_overlays()
if(volume)
var/percent = round(reagents.total_volume / volume * 100)
if(reagents.total_volume)
var/image/filling = image('icons/obj/bloodpack.dmi', "[round(percent,25)]")
filling.color = reagents.get_color()
add_overlay(filling)
add_overlay(image('icons/obj/bloodpack.dmi', "top"))
if(attached_mob)
add_overlay(image('icons/obj/bloodpack.dmi', "dongle"))
if(attached_mob)
add_overlay(image('icons/obj/bloodpack.dmi', "dongle"))
if(reagents && reagents.total_volume)
add_overlay(overlay_image('icons/obj/bloodpack.dmi', "[icon_state][get_filling_state()]", color = reagents.get_color()))
/obj/item/reagent_containers/blood/attack(mob/living/carbon/human/M as mob, mob/living/carbon/human/user as mob, var/target_zone)
if(user == M && (MODE_VAMPIRE in user.mind?.antag_datums))
@@ -259,7 +257,7 @@
/obj/item/reagent_containers/blood/empty
name = "empty blood pack"
desc = "Seems pretty useless... Maybe if there were a way to fill it?"
icon_state = "empty"
icon_state = "bloodpack"
/obj/item/reagent_containers/blood/ripped
name = "ripped blood pack"
@@ -8,6 +8,8 @@
)
icon_state = "dropper"
item_state = "dropper"
worn_overlay = "filling"
build_from_parts = TRUE
amount_per_transfer_from_this = 5
possible_transfer_amounts = list(1,2,3,4,5)
w_class = ITEMSIZE_TINY
@@ -93,9 +95,9 @@
/obj/item/reagent_containers/dropper/update_icon()
cut_overlays()
if(reagents)
var/image/filling = image('icons/obj/reagentfillings.dmi', src, "[icon_state]")
filling.color = reagents.get_color()
add_overlay(filling)
add_overlay(overlay_image('icons/obj/reagentfillings.dmi', "[icon_state]", color = reagents.get_color()))
worn_overlay_color = reagents.get_color() // handles inhands
update_held_icon()
/obj/item/reagent_containers/dropper/AltClick(mob/user)
var/N = input("Amount per transfer from this:", "[src]") as null|anything in possible_transfer_amounts
@@ -326,6 +326,7 @@ If you add a drink with no empty icon sprite, ensure it is flagged as NO_EMPTY_I
desc = "A plastic medicine cup. Like a shot glass for medicine."
icon = 'icons/obj/chemical.dmi'
icon_state = "medcup"
filling_states = "25;50;75;100"
drop_sound = 'sound/items/drop/drinkglass.ogg'
pickup_sound = 'sound/items/pickup/drinkglass.ogg'
possible_transfer_amounts = null
@@ -342,26 +343,6 @@ If you add a drink with no empty icon sprite, ensure it is flagged as NO_EMPTY_I
..()
update_icon()
/obj/item/reagent_containers/food/drinks/medcup/update_icon()
cut_overlays()
if(reagents.total_volume)
var/image/filling = image('icons/obj/reagentfillings.dmi', src, "[icon_state]25")
var/percent = round((reagents.total_volume / volume) * 100)
switch(percent) // offset by about 12.5 so it seems more gradual
if(0 to 37)
filling.icon_state = "[icon_state]25"
if(38 to 62)
filling.icon_state = "[icon_state]50"
if(63 to 87)
filling.icon_state = "[icon_state]75"
if(87 to INFINITY)
filling.icon_state = "[icon_state]100"
filling.color = reagents.get_color()
add_overlay(filling)
//////////////////////////JUICES AND STUFF ///////////////////////
/obj/item/reagent_containers/food/drinks/carton
@@ -596,4 +577,4 @@ If you add a drink with no empty icon sprite, ensure it is flagged as NO_EMPTY_I
drop_sound = 'sound/items/drop/papercup.ogg'
pickup_sound = 'sound/items/pickup/papercup.ogg'
center_of_mass = list("x"=16, "y"=14)
reagents_to_add = list(/decl/reagent/drink/milk/strawberry = 20)
reagents_to_add = list(/decl/reagent/drink/milk/strawberry = 20)
@@ -5,6 +5,7 @@
desc = "A glass jar. You can put the lid back on and use it for other things."
icon = 'icons/obj/drinks.dmi'
icon_state = "jar"
filling_states = "-10;10;25;50;75;80;100"
matter = list(MATERIAL_GLASS = 5000)
center_of_mass = list("x"=15, "y"=8)
w_class = ITEMSIZE_NORMAL
@@ -15,10 +16,10 @@
/obj/item/reagent_containers/glass/beaker/jar/attack_self(var/mob/user)
if(reagents.total_volume > 0)
to_chat(user, "<span class='warning'>You need to empty \the [src] first!</span>")
to_chat(user, SPAN_WARNING("You need to empty \the [src] first!"))
return
else
to_chat(user, "<span class='notice'>You put the lid on \the [src].</span>")
to_chat(user, SPAN_NOTICE("You put the lid on \the [src]."))
user.drop_from_inventory(src)
user.put_in_hands(new /obj/item/glass_jar) //found in glassjar.dm
qdel(src)
@@ -78,6 +78,7 @@
to_chat(user, "<span class='notice'>You set the label to \"[tmp_label]\".</span>")
label_text = tmp_label
update_name_label()
update_icon()
return
. = ..() // in the case of nitroglycerin, explode BEFORE it shatters
@@ -98,6 +99,7 @@
)
icon_state = "beaker"
item_state = "beaker"
filling_states = "20;40;60;80;100"
center_of_mass = list("x" = 15,"y" = 11)
matter = list(MATERIAL_GLASS = 500)
drop_sound = 'sound/items/drop/drinkglass.ogg'
@@ -129,24 +131,20 @@
/obj/item/reagent_containers/glass/beaker/update_icon()
cut_overlays()
if(reagents.total_volume)
var/image/filling = image('icons/obj/reagentfillings.dmi', src, "[icon_state]10")
var/percent = round((reagents.total_volume / volume) * 100)
switch(percent)
if(0 to 9) filling.icon_state = "[icon_state]-10"
if(10 to 24) filling.icon_state = "[icon_state]10"
if(25 to 49) filling.icon_state = "[icon_state]25"
if(50 to 74) filling.icon_state = "[icon_state]50"
if(75 to 79) filling.icon_state = "[icon_state]75"
if(80 to 90) filling.icon_state = "[icon_state]80"
if(91 to INFINITY) filling.icon_state = "[icon_state]100"
if(reagents?.total_volume)
var/mutable_appearance/filling = mutable_appearance('icons/obj/reagentfillings.dmi', "[icon_state]-[get_filling_state()]")
filling.color = reagents.get_color()
add_overlay(filling)
if (!is_open_container())
add_overlay("lid_[initial(icon_state)]")
if(!is_open_container())
var/lid_icon = "lid_[icon_state]"
var/mutable_appearance/lid = mutable_appearance(icon, lid_icon)
add_overlay(lid)
if(label_text)
var/label_icon = "label_[icon_state]"
var/mutable_appearance/label = mutable_appearance(icon, label_icon)
add_overlay(label)
/obj/item/reagent_containers/glass/beaker/large
name = "large beaker"
@@ -11,6 +11,7 @@
)
icon_state = null
item_state = "bottle"
filling_states = "20;40;60;80;100"
amount_per_transfer_from_this = 5
possible_transfer_amounts = list(5,10,15,25,30,60)
flags = 0
@@ -38,27 +39,23 @@
update_icon()
/obj/item/reagent_containers/glass/bottle/update_icon()
/obj/item/reagent_containers/glass/bottle/update_icon() // You know, bottles should be a subtype of beakers. But not gonna change a million and one paths today. - Wezzy.
cut_overlays()
if(reagents.total_volume && (icon_state == "bottle-1" || icon_state == "bottle-2" || icon_state == "bottle-3" || icon_state == "bottle-4"))
var/image/filling = image('icons/obj/reagentfillings.dmi', src, "[icon_state]10")
var/percent = round((reagents.total_volume / volume) * 100)
switch(percent)
if(0 to 9) filling.icon_state = "[icon_state]--10"
if(10 to 24) filling.icon_state = "[icon_state]-10"
if(25 to 49) filling.icon_state = "[icon_state]-25"
if(50 to 74) filling.icon_state = "[icon_state]-50"
if(75 to 79) filling.icon_state = "[icon_state]-75"
if(80 to 90) filling.icon_state = "[icon_state]-80"
if(91 to INFINITY) filling.icon_state = "[icon_state]-100"
if(reagents?.total_volume)
var/mutable_appearance/filling = mutable_appearance('icons/obj/reagentfillings.dmi', "[icon_state]-[get_filling_state()]")
filling.color = reagents.get_color()
add_overlay(filling)
if (!is_open_container())
add_overlay("lid_bottle")
if(!is_open_container())
var/lid_icon = "lid_[icon_state]"
var/mutable_appearance/lid = mutable_appearance(icon, lid_icon)
add_overlay(lid)
if(label_text)
var/label_icon = "label_[icon_state]"
var/mutable_appearance/label = mutable_appearance(icon, label_icon)
add_overlay(label)
/obj/item/reagent_containers/glass/bottle/inaprovaline
name = "inaprovaline bottle"
@@ -15,9 +15,9 @@
slot_l_hand_str = 'icons/mob/items/lefthand_medical.dmi',
slot_r_hand_str = 'icons/mob/items/righthand_medical.dmi',
)
item_state = "syringe_0"
icon_state = "0"
center_of_mass = list("x" = 16,"y" = 14)
item_state = "syringe"
build_from_parts = TRUE
matter = list(MATERIAL_GLASS = 150)
amount_per_transfer_from_this = 5
possible_transfer_amounts = list(1, 2, 5, 10, 15)
@@ -28,15 +28,17 @@
noslice = 1
unacidable = 1 //glass
var/mode = SYRINGE_CAPPED
var/image/filling //holds a reference to the current filling overlay (used for syringe guns)
var/used = FALSE
var/dirtiness = 0
var/list/targets
var/list/datum/disease2/disease/viruses
var/image/filling //holds a reference to the current filling overlay
var/visible_name = "a syringe"
var/time = 30
var/last_jab = 0 //Spam prevention
center_of_mass = null
drop_sound = 'sound/items/drop/glass_small.ogg'
pickup_sound = 'sound/items/pickup/glass_small.ogg'
@@ -250,7 +252,7 @@
last_jab = 0
user.visible_message("<b>[user]</b> fumbles with \the [src]!", SPAN_NOTICE("You fumble with \the [src]!"))
return
user.visible_message(SPAN_WARNING("[user] injects [target] with \the [src]!"))
var/trans
if(ismob(target))
var/contained = reagentlist()
@@ -269,21 +271,23 @@
/obj/item/reagent_containers/syringe/update_icon()
cut_overlays()
var/matrix/tf = matrix()
if(istype(loc, /obj/item/storage))
tf.Turn(-90) //Vertical for storing compactly
tf.Translate(-3,0) //Could do this with pixel_x but let's just update the appearance once.
transform = tf
var/iconstring = initial(item_state)
if(mode == SYRINGE_BROKEN)
icon_state = "broken"
worn_overlay = null
return
if(mode == SYRINGE_CAPPED)
icon_state = "capped"
return
add_overlay("capped")
var/rounded_vol = round(reagents.total_volume, round(reagents.maximum_volume / 3))
if(reagents && reagents.total_volume)
worn_overlay = Clamp(round((reagents.total_volume / volume * 15),5), 1, 15) //rounded_vol
add_overlay(overlay_image('icons/obj/reagentfillings.dmi', "[iconstring][worn_overlay]", color = reagents.get_color()))
worn_overlay_color = reagents.get_color() // handles inhands
update_held_icon()
else
worn_overlay = 0
icon_state = "[worn_overlay]"
if(ismob(loc))
var/injoverlay
switch(mode)
@@ -292,16 +296,6 @@
if (SYRINGE_INJECT)
injoverlay = "inject"
add_overlay(injoverlay)
icon_state = "[rounded_vol]"
item_state = "syringe_[rounded_vol]"
if(reagents.total_volume)
filling = image('icons/obj/syringe.dmi', src, "syringe10")
filling.icon_state = "syringe[rounded_vol]"
filling.color = reagents.get_color()
add_overlay(filling)
/obj/item/reagent_containers/syringe/proc/syringestab(mob/living/carbon/target as mob, mob/living/carbon/user as mob)
if(mode == SYRINGE_CAPPED)
@@ -324,7 +318,7 @@
return
var/armor = H.get_blocked_ratio(target_zone, BRUTE, damage_flags = DAM_SHARP, damage = 5)*100
if (target != user && armor > 50 && prob(50))
if (target != user && armor > 50)
user.visible_message(SPAN_DANGER("[user] tries to stab \the [target] in the [hit_area] with \the [src], but the attack is deflected by [target.get_pronoun("his")] armor!"), SPAN_WARNING("You try to stab \the [target] in the [hit_area] with \the [src], but the attack is deflected by [target.get_pronoun("his")] armor!"))
user.remove_from_mob(src)
qdel(src)
@@ -344,7 +338,7 @@
user.visible_message(SPAN_DANGER("[user] stabs [target] with [src.name]!"))
target.take_organ_damage(3)// 7 is the same as crowbar punch
var/syringestab_amount_transferred = rand(0, (reagents.total_volume - 5)) //nerfed by popular demand
var/syringestab_amount_transferred = rand(0, (reagents.total_volume / 2)) //nerfed by popular demand
var/contained_reagents = reagents.get_reagents()
var/trans = reagents.trans_to_mob(target, syringestab_amount_transferred, CHEM_BLOOD)
if(isnull(trans)) trans = 0
@@ -359,16 +353,22 @@
if(user)
add_fingerprint(user)
update_icon()
/obj/item/reagent_containers/syringe/large
name = "large syringe"
desc = "A large syringe - for those patients who need a little more."
icon = 'icons/obj/large_syringe.dmi'
icon_state = "0"
possible_transfer_amounts = list(5, 15, 30)
volume = 30
/obj/item/reagent_containers/syringe/ld50_syringe
/obj/item/reagent_containers/syringe/large/ld50_syringe
name = "Lethal Injection Syringe"
desc = "A syringe used for lethal injections."
amount_per_transfer_from_this = 60
volume = 60
visible_name = "a giant syringe"
time = 300
/obj/item/reagent_containers/syringe/ld50_syringe/afterattack(obj/target, mob/user, flag)
/obj/item/reagent_containers/syringe/large/ld50_syringe/afterattack(obj/target, mob/user, flag)
if(mode == SYRINGE_DRAW && ismob(target)) // No drawing 50 units of blood at once
to_chat(user, SPAN_NOTICE("This needle isn't designed for drawing blood."))
return
@@ -376,6 +376,7 @@
to_chat(user, SPAN_NOTICE("This syringe is too big to stab someone with it."))
..()
////////////////////////////////////////////////////////////////////////////////
/// Syringes. END
////////////////////////////////////////////////////////////////////////////////
@@ -430,11 +431,10 @@
mode = SYRINGE_INJECT
update_icon()
/obj/item/reagent_containers/syringe/ld50_syringe/chloral
/obj/item/reagent_containers/syringe/large/ld50_syringe/chloral
reagents_to_add = list(/decl/reagent/polysomnine = 60)
/obj/item/reagent_containers/syringe/ld50_syringe/chloral/Initialize()
/obj/item/reagent_containers/syringe/large/ld50_syringe/chloral/Initialize()
. = ..()
mode = SYRINGE_INJECT
update_icon()