First round of fixes:

- Fixed swap hands finding the wrong index
- Fixed dual HANDS_LAYER reading for abductors
- Fixed old comments
- Removed lingering pieces of a previous version
- Finish hooking up stripping
This commit is contained in:
Remie Richards
2016-09-02 17:57:59 +01:00
parent 00738bd2a3
commit e19b154d00
9 changed files with 39 additions and 22 deletions

View File

@@ -17,8 +17,8 @@
#define slot_back 1 #define slot_back 1
#define slot_wear_mask 2 #define slot_wear_mask 2
#define slot_handcuffed 3 #define slot_handcuffed 3
#define slot_hands 4 //wherever you provide a slot for hands you provide slot_hands AND a hand index (1 to held_items.len) #define slot_hands 4 //wherever you provide a slot for hands you provide slot_hands
//there are various helper procs to find an appropriate index //slot_hands as a slot will pick ANY available hand
#define slot_belt 5 #define slot_belt 5
#define slot_wear_id 6 #define slot_wear_id 6
#define slot_ears 7 #define slot_ears 7

View File

@@ -173,7 +173,7 @@
entry.name = target.name entry.name = target.name
entry.icon = target.icon entry.icon = target.icon
entry.icon_state = target.icon_state entry.icon_state = target.icon_state
entry.overlays = target.get_overlays_copy(list(HANDS_LAYER,HANDS_LAYER)) entry.overlays = target.get_overlays_copy(list(HANDS_LAYER))
for(var/i=1,i<=disguises.len,i++) for(var/i=1,i<=disguises.len,i++)
var/datum/icon_snapshot/temp = disguises[i] var/datum/icon_snapshot/temp = disguises[i]
if(temp.name == entry.name) if(temp.name == entry.name)

View File

@@ -228,10 +228,6 @@
return FALSE return FALSE
/*
/mob/proc/drop_l_hand() //pending re-implementation
/mob/proc/drop_r_hand()
*/
/mob/proc/drop_all_held_items() /mob/proc/drop_all_held_items()
if(!loc || !loc.allow_drop()) if(!loc || !loc.allow_drop())
return return

View File

@@ -81,7 +81,7 @@
/mob/living/carbon/swap_hand(held_index) /mob/living/carbon/swap_hand(held_index)
if(!held_index) if(!held_index)
held_index = (held_index % held_items.len)+1 held_index = (active_hand_index % held_items.len)+1
var/obj/item/item_in_hand = src.get_active_held_item() var/obj/item/item_in_hand = src.get_active_held_item()
if(item_in_hand) //this segment checks if the item in your hand is twohanded. if(item_in_hand) //this segment checks if the item in your hand is twohanded.
@@ -103,7 +103,7 @@
/mob/living/carbon/activate_hand(selhand) //l/r OR 1-held_items.len /mob/living/carbon/activate_hand(selhand) //l/r OR 1-held_items.len
if(!selhand) if(!selhand)
selhand = (selhand % held_items.len)+1 selhand = (active_hand_index % held_items.len)+1
if(istext(selhand)) if(istext(selhand))
selhand = lowertext(selhand) selhand = lowertext(selhand)

View File

@@ -458,7 +458,7 @@ There are several things that need to be remembered:
/mob/living/carbon/human/proc/get_overlays_copy(list/unwantedLayers) /mob/living/carbon/human/proc/get_overlays_copy(list/unwantedLayers)
var/list/out = new var/list/out = new
for(var/i=1;i<=TOTAL_LAYERS;i++) for(var/i in 1 to TOTAL_LAYERS)
if(overlays_standing[i]) if(overlays_standing[i])
if(i in unwantedLayers) if(i in unwantedLayers)
continue continue

View File

@@ -1,4 +1,4 @@
/mob/living/carbon/get_item_by_slot(slot_id, hand_index) /mob/living/carbon/get_item_by_slot(slot_id)
switch(slot_id) switch(slot_id)
if(slot_back) if(slot_back)
return back return back

View File

@@ -783,7 +783,13 @@
"<span class='userdanger'>[src] tries to remove [who]'s [what.name].</span>") "<span class='userdanger'>[src] tries to remove [who]'s [what.name].</span>")
what.add_fingerprint(src) what.add_fingerprint(src)
if(do_mob(src, who, what.strip_delay)) if(do_mob(src, who, what.strip_delay))
if(what && what == who.get_item_by_slot(where) && Adjacent(who)) if(what && Adjacent(who))
if(islist(where))
var/list/L = where
if(what == who.get_item_for_held_index(L[2]))
who.unEquip(what)
add_logs(src, who, "stripped", addition="of [what]")
if(what == who.get_item_by_slot(where))
who.unEquip(what) who.unEquip(what)
add_logs(src, who, "stripped", addition="of [what]") add_logs(src, who, "stripped", addition="of [what]")
@@ -795,6 +801,13 @@
src << "<span class='warning'>You can't put \the [what.name] on [who], it's stuck to your hand!</span>" src << "<span class='warning'>You can't put \the [what.name] on [who], it's stuck to your hand!</span>"
return return
if(what) if(what)
var/list/where_list
if(islist(where))
where_list = where
if(!what.mob_can_equip(who, src, where[1], 1))
src << "<span class='warning'>\The [what.name] doesn't fit in that place!</span>"
return
else
if(!what.mob_can_equip(who, src, where, 1)) if(!what.mob_can_equip(who, src, where, 1))
src << "<span class='warning'>\The [what.name] doesn't fit in that place!</span>" src << "<span class='warning'>\The [what.name] doesn't fit in that place!</span>"
return return
@@ -802,6 +815,9 @@
if(do_mob(src, who, what.put_on_delay)) if(do_mob(src, who, what.put_on_delay))
if(what && Adjacent(who)) if(what && Adjacent(who))
unEquip(what) unEquip(what)
if(where_list)
who.put_in_hand(what, where_list[2])
else
who.equip_to_slot_if_possible(what, where, 0, 1) who.equip_to_slot_if_possible(what, where, 0, 1)
add_logs(src, who, "equipped", what) add_logs(src, who, "equipped", what)

View File

@@ -621,7 +621,7 @@
if(!dextrous) if(!dextrous)
return ..() return ..()
if(!selhand) if(!selhand)
selhand = (selhand % held_items.len)+1 selhand = (active_hand_index % held_items.len)+1
if(istext(selhand)) if(istext(selhand))
selhand = lowertext(selhand) selhand = lowertext(selhand)
if(selhand == "right" || selhand == "r") if(selhand == "right" || selhand == "r")
@@ -637,7 +637,7 @@
if(!dextrous) if(!dextrous)
return ..() return ..()
if(!hand_index) if(!hand_index)
hand_index = (hand_index % held_items.len)+1 hand_index = (active_hand_index % held_items.len)+1
var/obj/item/held_item = get_active_held_item() var/obj/item/held_item = get_active_held_item()
if(held_item) if(held_item)
if(istype(held_item, /obj/item/weapon/twohanded)) if(istype(held_item, /obj/item/weapon/twohanded))

View File

@@ -528,8 +528,13 @@ var/next_mob_id = 0
if(usr.canUseTopic(src, BE_CLOSE, NO_DEXTERY)) if(usr.canUseTopic(src, BE_CLOSE, NO_DEXTERY))
if(href_list["item"]) if(href_list["item"])
var/slot = text2num(href_list["item"]) var/slot = text2num(href_list["item"])
var/obj/item/what = get_item_by_slot(slot) var/hand_index = text2num(href_list["hand_index"])
var/obj/item/what
if(hand_index)
what = get_item_for_held_index(hand_index)
slot = list(slot,hand_index)
else
what = get_item_by_slot(slot)
if(what) if(what)
usr.stripPanelUnequip(what,src,slot) usr.stripPanelUnequip(what,src,slot)
else else