Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Medical items now apply to yourself if you use them in-hand #25

Merged
merged 2 commits into from
Jul 20, 2024
Merged
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
41 changes: 0 additions & 41 deletions code/game/objects/items/reagent_containers/hypospray.dm
Original file line number Diff line number Diff line change
Expand Up @@ -107,47 +107,6 @@

return TRUE

//Копипипаста с кода выше, переделать
/obj/item/reagent_containers/hypospray/unique_action(mob/living/carbon/user)
. = ..()
if(user.species.species_flags & ROBOTIC_LIMBS)
return FALSE

if(inject_mode == HYPOSPRAY_INJECT_MODE_DRAW)
balloon_alert(user, "You don't think this is a good idea...")
return FALSE

if(!reagents.total_volume)
balloon_alert(user, "Hypospray is empty!")
return FALSE

if(skilllock && user.skills.getRating(SKILL_MEDICAL) < SKILL_MEDICAL_NOVICE)
user.visible_message(span_notice("[user] fumbles around figuring out how to use the [src]."),
span_notice("You fumble around figuring out how to use the [src]."))
if(!do_after(user, SKILL_TASK_EASY, NONE, user_display = BUSY_ICON_UNSKILLED))
return FALSE

if(!user.can_inject(user, TRUE, user.zone_selected, TRUE))
return FALSE

var/list/injected = list()
for(var/datum/reagent/R in reagents.reagent_list)
injected += R.name

to_chat(user, span_notice("You inject yourself with [src]!"))
record_reagent_consumption(min(amount_per_transfer_from_this, reagents.total_volume), injected, user)

// /mob/living/carbon/human/attack_hand causes
// changeNext_move(7) which creates a delay
// This line overrides the delay, and will absolutely break everything
user.changeNext_move(3) // please don't break the game

playsound(loc, 'sound/items/hypospray.ogg', 50, 1)
reagents.reaction(user, INJECT, min(amount_per_transfer_from_this, reagents.total_volume) / reagents.total_volume)
var/trans = reagents.trans_to(user, amount_per_transfer_from_this)
to_chat(user, span_notice("[trans] units injected. [reagents.total_volume] units remaining in [src]. ")) // better to not balloon
return TRUE

/obj/item/reagent_containers/hypospray/afterattack_alternate(atom/A, mob/living/user)
if(!istype(user))
return FALSE
Expand Down
10 changes: 3 additions & 7 deletions code/game/objects/items/reagent_containers/reagent_container.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,11 @@
if(!possible_transfer_amounts)
verbs -= /obj/item/reagent_containers/verb/set_APTFT

/obj/item/reagent_containers/attack_hand_alternate(mob/living/user)
/obj/item/reagent_containers/attack_self(mob/living/user)
. = ..()
if(!possible_transfer_amounts)
return
var/result = tgui_input_list(user, "Amount per transfer from this:","[src]", possible_transfer_amounts)
if(result)
amount_per_transfer_from_this = result
afterattack(user, user) //If player uses the container, use it on themselves

/obj/item/reagent_containers/interact(mob/user)
/obj/item/reagent_containers/unique_action(mob/user, special_treatment)
. = ..()
if(.)
return
Expand Down
4 changes: 4 additions & 0 deletions code/game/objects/items/stacks/medical.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@

var/alien = FALSE

/obj/item/stack/medical/attack_self(mob/user)
. = ..()
attack(user, user)

/obj/item/stack/medical/attack(mob/living/M, mob/living/user)
. = ..()
if(.)
Expand Down
Loading