Fixes for gripper interaction with frame parts and mecha equipment (#5025)

* possible fix

* truly a fix

* return of the lost comment

* and lost slash too

* stray not-my comment deleted

* added proper changelog

* replaced << with to_chat()
This commit is contained in:
Heroman3003
2018-03-20 04:50:05 +10:00
committed by Atermonera
parent 85e377f017
commit c8326c290c
4 changed files with 46 additions and 13 deletions

View File

@@ -29,7 +29,7 @@
update_type_list() update_type_list()
var/datum/frame/frame_types/frame_type var/datum/frame/frame_types/frame_type
if(!build_machine_type) if(!build_machine_type)
var/datum/frame/frame_types/response = input(usr, "What kind of frame would you like to make?", "Frame type request", null) in frame_types_floor var/datum/frame/frame_types/response = input(user, "What kind of frame would you like to make?", "Frame type request", null) in frame_types_floor
if(!response || response.name == "Cancel") if(!response || response.name == "Cancel")
return return
frame_type = response frame_type = response
@@ -37,10 +37,10 @@
build_machine_type = /obj/structure/frame build_machine_type = /obj/structure/frame
if(frame_type.frame_size != 5) if(frame_type.frame_size != 5)
new /obj/item/stack/material/steel(usr.loc, (5 - frame_type.frame_size)) new /obj/item/stack/material/steel(user.loc, (5 - frame_type.frame_size))
var/ndir var/ndir
ndir = usr.dir ndir = user.dir
if(!(ndir in cardinal)) if(!(ndir in cardinal))
return return
@@ -48,13 +48,15 @@
M.fingerprints = fingerprints M.fingerprints = fingerprints
M.fingerprintshidden = fingerprintshidden M.fingerprintshidden = fingerprintshidden
M.fingerprintslast = fingerprintslast M.fingerprintslast = fingerprintslast
if(istype(src.loc, /obj/item/weapon/gripper)) //Typical gripper shenanigans
user.drop_item()
qdel(src) qdel(src)
/obj/item/frame/proc/try_build(turf/on_wall, mob/user as mob) /obj/item/frame/proc/try_build(turf/on_wall, mob/user as mob)
update_type_list() update_type_list()
var/datum/frame/frame_types/frame_type var/datum/frame/frame_types/frame_type
if(!build_machine_type) if(!build_machine_type)
var/datum/frame/frame_types/response = input(usr, "What kind of frame would you like to make?", "Frame type request", null) in frame_types_wall var/datum/frame/frame_types/response = input(user, "What kind of frame would you like to make?", "Frame type request", null) in frame_types_wall
if(!response || response.name == "Cancel") if(!response || response.name == "Cancel")
return return
frame_type = response frame_type = response
@@ -62,38 +64,40 @@
build_machine_type = /obj/structure/frame build_machine_type = /obj/structure/frame
if(frame_type.frame_size != 5) if(frame_type.frame_size != 5)
new /obj/item/stack/material/steel(usr.loc, (5 - frame_type.frame_size)) new /obj/item/stack/material/steel(user.loc, (5 - frame_type.frame_size))
if(get_dist(on_wall, usr)>1) if(get_dist(on_wall, user)>1)
return return
var/ndir var/ndir
if(reverse) if(reverse)
ndir = get_dir(usr, on_wall) ndir = get_dir(user, on_wall)
else else
ndir = get_dir(on_wall, usr) ndir = get_dir(on_wall, user)
if(!(ndir in cardinal)) if(!(ndir in cardinal))
return return
var/turf/loc = get_turf(usr) var/turf/loc = get_turf(user)
var/area/A = loc.loc var/area/A = loc.loc
if(!istype(loc, /turf/simulated/floor)) if(!istype(loc, /turf/simulated/floor))
usr << "<span class='danger'>\The frame cannot be placed on this spot.</span>" to_chat(user, "<span class='danger'>\The frame cannot be placed on this spot.</span>")
return return
if(A.requires_power == 0 || A.name == "Space") if(A.requires_power == 0 || A.name == "Space")
usr << "<span class='danger'>\The [src] Alarm cannot be placed in this area.</span>" to_chat(user, "<span class='danger'>\The [src] Alarm cannot be placed in this area.</span>")
return return
if(gotwallitem(loc, ndir)) if(gotwallitem(loc, ndir))
usr << "<span class='danger'>There's already an item on this wall!</span>" to_chat(user, "<span class='danger'>There's already an item on this wall!</span>")
return return
var/obj/machinery/M = new build_machine_type(loc, ndir, 1, frame_type) var/obj/machinery/M = new build_machine_type(loc, ndir, 1, frame_type)
M.fingerprints = fingerprints M.fingerprints = fingerprints
M.fingerprintshidden = fingerprintshidden M.fingerprintshidden = fingerprintshidden
M.fingerprintslast = fingerprintslast M.fingerprintslast = fingerprintslast
if(istype(src.loc, /obj/item/weapon/gripper)) //Typical gripper shenanigans
user.drop_item()
qdel(src) qdel(src)
/obj/item/frame/light /obj/item/frame/light

View File

@@ -199,6 +199,21 @@
wrapped = null wrapped = null
//update_icon() //update_icon()
/obj/item/weapon/gripper/proc/drop_item_nm()
if(!wrapped)
for(var/obj/item/thing in src.contents)
thing.loc = get_turf(src)
return
if(wrapped.loc != src)
wrapped = null
return
wrapped.loc = get_turf(src)
wrapped = null
//update_icon()
/obj/item/weapon/gripper/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob) /obj/item/weapon/gripper/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob)
if(wrapped) //The force of the wrapped obj gets set to zero during the attack() and afterattack(). if(wrapped) //The force of the wrapped obj gets set to zero during the attack() and afterattack().
force_holder = wrapped.force force_holder = wrapped.force

View File

@@ -1105,3 +1105,9 @@
/mob/living/silicon/robot/is_sentient() /mob/living/silicon/robot/is_sentient()
return braintype != "Drone" return braintype != "Drone"
/mob/living/silicon/robot/drop_item()
if(module_active && istype(module_active,/obj/item/weapon/gripper))
var/obj/item/weapon/gripper/G = module_active
G.drop_item_nm()

View File

@@ -0,0 +1,8 @@
author: Heroman3003
delete-after: True
changes:
- bugfix: "Fixed a bug where same piece of exosuit equipment could be attached several times with exosuit gripper"
- bugfix: "Fixed a bug where frame parts could dupe frames with engineering gripper"