mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +00:00
Allow click-dragging things into rechargers (#6749)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user