Merge pull request #7204 from Crazylemon64/tk_refactor

Tk refactor+Remote tool use
This commit is contained in:
Fox McCloud
2017-06-26 16:55:04 -04:00
committed by GitHub
20 changed files with 200 additions and 122 deletions
+1 -1
View File
@@ -2097,7 +2097,7 @@
return
if(boxes.len > 0)
if(user.get_inactive_hand() != src)
if(user.is_in_inactive_hand(src))
..()
return
@@ -52,7 +52,7 @@
friendly_fire_check = !friendly_fire_check
to_chat(user, "<span class='warning'>You toggle friendly fire [friendly_fire_check ? "off":"on"]!</span>")
return
if(user.get_active_hand() != src && user.get_inactive_hand() != src) //you need to hold the staff to teleport
if(user.is_in_active_hand(src) && user.is_in_inactive_hand(src)) //you need to hold the staff to teleport
to_chat(user, "<span class='warning'>You need to hold the staff in your hands to [rune ? "teleport with it" : "create a rune"]!</span>")
return
if(!rune)
+14
View File
@@ -6,11 +6,22 @@
if(hand) return l_hand
else return r_hand
/mob/proc/is_in_active_hand(obj/item/I)
var/obj/item/item_to_test = get_active_hand()
return item_to_test && item_to_test.is_equivalent(I)
//Returns the thing in our inactive hand
/mob/proc/get_inactive_hand()
if(hand) return r_hand
else return l_hand
/mob/proc/is_in_inactive_hand(obj/item/I)
var/obj/item/item_to_test = get_inactive_hand()
return item_to_test && item_to_test.is_equivalent(I)
//Returns if a certain item can be equipped to a certain slot.
// Currently invalid for two-handed items - call obj/item/mob_can_equip() instead.
/mob/proc/can_equip(obj/item/I, slot, disable_warning = 0)
@@ -119,6 +130,9 @@
else if(I == l_hand)
l_hand = null
update_inv_l_hand()
else if(I in tkgrabbed_objects)
var/obj/item/tk_grab/tkgrab = tkgrabbed_objects[I]
unEquip(tkgrab, force)
if(I)
if(client)
+7 -6
View File
@@ -535,18 +535,19 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump,
return
/mob/living/carbon/throw_item(atom/target)
throw_mode_off()
if(!target || !isturf(loc))
return
if(istype(target, /obj/screen))
if(!target || !isturf(loc) || istype(target, /obj/screen))
throw_mode_off()
return
var/atom/movable/thrown_thing
var/obj/item/I = src.get_active_hand()
if(!I || (I.flags & NODROP))
if(!I || I.override_throw(src, target) || (I.flags & NODROP))
throw_mode_off()
return
throw_mode_off()
var/atom/movable/thrown_thing
if(istype(I, /obj/item/weapon/grab))
var/obj/item/weapon/grab/G = I
var/mob/throwable_mob = G.get_mob_if_throwable() //throw the person instead of the grab
+4
View File
@@ -11,6 +11,10 @@
for(var/mob/dead/observer/M in following_mobs)
M.following = null
following_mobs = null
QDEL_LIST_ASSOC_VAL(tkgrabbed_objects)
for(var/I in tkgrabbed_objects)
qdel(tkgrabbed_objects[I])
tkgrabbed_objects = null
if(buckled)
buckled.unbuckle_mob()
if(viewing_alternate_appearances)
+2
View File
@@ -198,3 +198,5 @@
var/list/actions = list()
var/list/progressbars = null //for stacking do_after bars
var/list/tkgrabbed_objects = list() // Assoc list of items to TK grabs
+1 -1
View File
@@ -4,7 +4,7 @@
/var/global/datum/topic_state/inventory_state/inventory_state = new()
/datum/topic_state/inventory_state/can_use_topic(var/src_object, var/mob/user)
if(!(src_object in user))
if(!((src_object in user) || user.is_in_active_hand(src_object) || user.is_in_inactive_hand(src_object)))
return STATUS_CLOSE
return user.shared_nano_interaction()
+1 -1
View File
@@ -87,7 +87,7 @@
user.visible_message("[class][user] burns right through \the [src], turning it to ash. It flutters through the air before settling on the floor in a heap.", \
"[class]You burn right through \the [src], turning it to ash. It flutters through the air before settling on the floor in a heap.")
if(user.get_inactive_hand() == src)
if(user.is_in_inactive_hand(src))
user.unEquip(src)
new /obj/effect/decal/cleanable/ash(get_turf(src))
+1 -1
View File
@@ -64,7 +64,7 @@
user.visible_message("[class][user] burns right through \the [src], turning it to ash. It flutters through the air before settling on the floor in a heap.", \
"[class]You burn right through \the [src], turning it to ash. It flutters through the air before settling on the floor in a heap.")
if(user.get_inactive_hand() == src)
if(user.is_in_inactive_hand(src))
user.unEquip(src)
new /obj/effect/decal/cleanable/ash(get_turf(src))