Allow click-dragging things into rechargers (#6749)

This commit is contained in:
TheGreatKitsune
2023-08-08 01:01:05 -05:00
committed by GitHub
parent 99aa54e36b
commit 8384f27582
2 changed files with 95 additions and 69 deletions

View File

@@ -31,12 +31,9 @@
if(C) // Sometimes we get things without cells in it.
. += "Current charge: [C.charge] / [C.maxcharge]"
/obj/machinery/recharger/attackby(obj/item/weapon/G as obj, mob/user as mob)
var/allowed = 0
for (var/allowed_type in allowed_devices)
if(istype(G, allowed_type)) allowed = 1
if(allowed)
//CHOMPEdit Start - Let borgs clickdrag things into chargers
/obj/machinery/recharger/proc/do_allowed_checks(obj/item/G, mob/user)
. = FALSE
if(charging)
to_chat(user, "<span class='warning'>\A [charging] is already charging here.</span>")
return
@@ -95,6 +92,33 @@
else
to_chat(user, "<span class='warning'>\The [ourcard] doesn't have a personality!</span>")
return
return TRUE
/obj/machinery/recharger/MouseDrop_T(obj/item/weapon/G as obj, mob/user as mob)
var/allowed = 0
for (var/allowed_type in allowed_devices)
if(istype(G, allowed_type)) allowed = 1
if(allowed)
if(!do_allowed_checks(G, user))
return
G.loc = src
charging = G
update_icon()
user.visible_message("[user] inserts [charging] into [src].", "You insert [charging] into [src].")
//CHOMPEdit End
/obj/machinery/recharger/attackby(obj/item/weapon/G as obj, mob/user as mob)
var/allowed = 0
for (var/allowed_type in allowed_devices)
if(istype(G, allowed_type)) allowed = 1
if(allowed)
//CHOMPEdit Start - move checks into their own proc
if(!do_allowed_checks(G, user))
return
//CHOMPEdit End
user.drop_item()
G.loc = src

View File

@@ -311,14 +311,16 @@
if(!canremove)
return
if (ishuman(usr) || issmall(usr)) //so monkeys can take off their backpacks -- Urist
//CHOMPEdit start - move these around so that nonhumans can actually click-drag guns at all
if (istype(usr.loc,/obj/mecha)) // stops inventory actions in a mech. why?
return
if (!( istype(over_object, /obj/screen) ))
return ..()
if (ishuman(usr) || issmall(usr)) //so monkeys can take off their backpacks -- Urist
//CHOMPEdit End
//makes sure that the thing is equipped, so that we can't drag it into our hand from miles away.
//there's got to be a better way of doing this.
if (!(src.loc == usr) || (src.loc && src.loc.loc == usr))