Merge pull request #6895 from Citadel-Station-13/upstream-merge-38023

[MIRROR] Fix various bugs with telekinesis
This commit is contained in:
LetterJay
2018-05-25 23:28:01 -05:00
committed by GitHub
10 changed files with 35 additions and 21 deletions
+8 -6
View File
@@ -944,7 +944,7 @@ GLOBAL_LIST_INIT(WALLITEMS_INVERSE, typecacheof(list(
else else
return "white" return "white"
/proc/params2turf(scr_loc, turf/origin) /proc/params2turf(scr_loc, turf/origin, client/C)
if(!scr_loc) if(!scr_loc)
return null return null
var/tX = splittext(scr_loc, ",") var/tX = splittext(scr_loc, ",")
@@ -953,11 +953,12 @@ GLOBAL_LIST_INIT(WALLITEMS_INVERSE, typecacheof(list(
tY = tY[1] tY = tY[1]
tX = splittext(tX[1], ":") tX = splittext(tX[1], ":")
tX = tX[1] tX = tX[1]
tX = CLAMP(origin.x + text2num(tX) - world.view - 1, 1, world.maxx) var/list/actual_view = getviewsize(C ? C.view : world.view)
tY = CLAMP(origin.y + text2num(tY) - world.view - 1, 1, world.maxy) tX = CLAMP(origin.x + text2num(tX) - round(actual_view[1] / 2) - 1, 1, world.maxx)
tY = CLAMP(origin.y + text2num(tY) - round(actual_view[2] / 2) - 1, 1, world.maxy)
return locate(tX, tY, tZ) return locate(tX, tY, tZ)
/proc/screen_loc2turf(text, turf/origin) /proc/screen_loc2turf(text, turf/origin, client/C)
if(!text) if(!text)
return null return null
var/tZ = splittext(text, ",") var/tZ = splittext(text, ",")
@@ -966,8 +967,9 @@ GLOBAL_LIST_INIT(WALLITEMS_INVERSE, typecacheof(list(
tX = splittext(tZ[2], "-") tX = splittext(tZ[2], "-")
tX = text2num(tX[2]) tX = text2num(tX[2])
tZ = origin.z tZ = origin.z
tX = CLAMP(origin.x + 7 - tX, 1, world.maxx) var/list/actual_view = getviewsize(C ? C.view : world.view)
tY = CLAMP(origin.y + 7 - tY, 1, world.maxy) tX = CLAMP(origin.x + round(actual_view[1] / 2) - tX, 1, world.maxx)
tY = CLAMP(origin.y + round(actual_view[2] / 2) - tY, 1, world.maxy)
return locate(tX, tY, tZ) return locate(tX, tY, tZ)
/proc/IsValidSrc(datum/D) /proc/IsValidSrc(datum/D)
+1 -1
View File
@@ -473,7 +473,7 @@
var/mob/living/carbon/C = usr var/mob/living/carbon/C = usr
C.swap_hand() C.swap_hand()
else else
var/turf/T = params2turf(modifiers["screen-loc"], get_turf(usr.client ? usr.client.eye : usr)) var/turf/T = params2turf(modifiers["screen-loc"], get_turf(usr.client ? usr.client.eye : usr), usr.client)
params += "&catcher=1" params += "&catcher=1"
if(T) if(T)
T.Click(location, control, params) T.Click(location, control, params)
+7 -1
View File
@@ -15,7 +15,7 @@
/atom/proc/attack_tk(mob/user) /atom/proc/attack_tk(mob/user)
if(user.stat || !tkMaxRangeCheck(user, src)) if(user.stat || !tkMaxRangeCheck(user, src))
return return
new /obj/effect/temp_visual/telekinesis(loc) new /obj/effect/temp_visual/telekinesis(get_turf(src))
user.UnarmedAttack(src,0) // attack_hand, attack_paw, etc user.UnarmedAttack(src,0) // attack_hand, attack_paw, etc
add_hiddenprint(user) add_hiddenprint(user)
return return
@@ -104,6 +104,12 @@
qdel(src) qdel(src)
return return
/obj/item/tk_grab/examine(user)
if (focus)
focus.examine(user)
else
..()
/obj/item/tk_grab/attack_self(mob/user) /obj/item/tk_grab/attack_self(mob/user)
if(!focus) if(!focus)
return return
+8 -6
View File
@@ -58,6 +58,8 @@
return return
if(user.a_intent != INTENT_HELP) if(user.a_intent != INTENT_HELP)
return return
if(I.flags_1 & ABSTRACT_1)
return
if((I.flags_1 & HOLOGRAM_1) || (I.item_flags & NO_MAT_REDEMPTION) || (tc && !is_type_in_typecache(I, tc))) if((I.flags_1 & HOLOGRAM_1) || (I.item_flags & NO_MAT_REDEMPTION) || (tc && !is_type_in_typecache(I, tc)))
to_chat(user, "<span class='warning'>[parent] won't accept [I]!</span>") to_chat(user, "<span class='warning'>[parent] won't accept [I]!</span>")
return return
@@ -77,13 +79,14 @@
/datum/component/material_container/proc/user_insert(obj/item/I, mob/living/user) /datum/component/material_container/proc/user_insert(obj/item/I, mob/living/user)
set waitfor = FALSE set waitfor = FALSE
var/requested_amount var/requested_amount
var/active_held = user.get_active_held_item() // differs from I when using TK
if(istype(I, /obj/item/stack) && precise_insertion) if(istype(I, /obj/item/stack) && precise_insertion)
var/atom/current_parent = parent var/atom/current_parent = parent
var/obj/item/stack/S = I var/obj/item/stack/S = I
requested_amount = input(user, "How much do you want to insert?", "Inserting [S.singular_name]s") as num|null requested_amount = input(user, "How much do you want to insert?", "Inserting [S.singular_name]s") as num|null
if(isnull(requested_amount) || (requested_amount <= 0)) if(isnull(requested_amount) || (requested_amount <= 0))
return return
if(QDELETED(I) || QDELETED(user) || QDELETED(src) || parent != current_parent || !user.canUseTopic(current_parent, BE_CLOSE) || !user.is_holding(I)) if(QDELETED(I) || QDELETED(user) || QDELETED(src) || parent != current_parent || user.physical_can_use_topic(current_parent) < UI_INTERACTIVE || user.get_active_held_item() != active_held)
return return
if(!user.temporarilyRemoveItemFromInventory(I)) if(!user.temporarilyRemoveItemFromInventory(I))
to_chat(user, "<span class='warning'>[I] is stuck to you and cannot be placed into [parent].</span>") to_chat(user, "<span class='warning'>[I] is stuck to you and cannot be placed into [parent].</span>")
@@ -93,16 +96,15 @@
if(istype(I, /obj/item/stack)) if(istype(I, /obj/item/stack))
var/obj/item/stack/S = I var/obj/item/stack/S = I
to_chat(user, "<span class='notice'>You insert [inserted] [S.singular_name][inserted>1 ? "s" : ""] into [parent].</span>") to_chat(user, "<span class='notice'>You insert [inserted] [S.singular_name][inserted>1 ? "s" : ""] into [parent].</span>")
if(!QDELETED(I)) if(!QDELETED(I) && I == active_held && !user.put_in_hands(I))
if(!user.put_in_hands(I)) stack_trace("Warning: User could not put object back in hand during material container insertion, line [__LINE__]! This can lead to issues.")
stack_trace("Warning: User could not put object back in hand during material container insertion, line [__LINE__]! This can lead to issues.") I.forceMove(user.drop_location())
I.forceMove(user.drop_location())
else else
to_chat(user, "<span class='notice'>You insert a material total of [inserted] into [parent].</span>") to_chat(user, "<span class='notice'>You insert a material total of [inserted] into [parent].</span>")
qdel(I) qdel(I)
if(after_insert) if(after_insert)
after_insert.Invoke(I.type, last_inserted_id, inserted) after_insert.Invoke(I.type, last_inserted_id, inserted)
else else if(I == active_held)
user.put_in_active_hand(I) user.put_in_active_hand(I)
//For inserting an amount of material //For inserting an amount of material
@@ -84,9 +84,10 @@ GLOBAL_LIST_INIT(sandbag_recipes, list ( \
if(istype(W, /obj/item/stack/ore/glass)) if(istype(W, /obj/item/stack/ore/glass))
var/obj/item/stack/ore/glass/G = W var/obj/item/stack/ore/glass/G = W
to_chat(user, "<span class='notice'>You fill the sandbag.</span>") to_chat(user, "<span class='notice'>You fill the sandbag.</span>")
var/obj/item/stack/sheet/mineral/sandbags/I = new /obj/item/stack/sheet/mineral/sandbags var/obj/item/stack/sheet/mineral/sandbags/I = new /obj/item/stack/sheet/mineral/sandbags(drop_location())
qdel(src) qdel(src)
user.put_in_hands(I) if (Adjacent(user) && !issilicon(user))
user.put_in_hands(I)
G.use(1) G.use(1)
else else
return ..() return ..()
+1 -1
View File
@@ -82,7 +82,7 @@
/obj/item/crowbar/power/attack_self(mob/user) /obj/item/crowbar/power/attack_self(mob/user)
playsound(get_turf(user), 'sound/items/change_jaws.ogg', 50, 1) playsound(get_turf(user), 'sound/items/change_jaws.ogg', 50, 1)
var/obj/item/wirecutters/power/cutjaws = new /obj/item/wirecutters/power var/obj/item/wirecutters/power/cutjaws = new /obj/item/wirecutters/power(drop_location())
to_chat(user, "<span class='notice'>You attach the cutting jaws to [src].</span>") to_chat(user, "<span class='notice'>You attach the cutting jaws to [src].</span>")
qdel(src) qdel(src)
user.put_in_active_hand(cutjaws) user.put_in_active_hand(cutjaws)
+1 -1
View File
@@ -123,7 +123,7 @@
/obj/item/screwdriver/power/attack_self(mob/user) /obj/item/screwdriver/power/attack_self(mob/user)
playsound(get_turf(user),'sound/items/change_drill.ogg',50,1) playsound(get_turf(user),'sound/items/change_drill.ogg',50,1)
var/obj/item/wrench/power/b_drill = new /obj/item/wrench/power var/obj/item/wrench/power/b_drill = new /obj/item/wrench/power(drop_location())
to_chat(user, "<span class='notice'>You attach the bolt driver bit to [src].</span>") to_chat(user, "<span class='notice'>You attach the bolt driver bit to [src].</span>")
qdel(src) qdel(src)
user.put_in_active_hand(b_drill) user.put_in_active_hand(b_drill)
+1 -1
View File
@@ -107,7 +107,7 @@
/obj/item/wirecutters/power/attack_self(mob/user) /obj/item/wirecutters/power/attack_self(mob/user)
playsound(get_turf(user), 'sound/items/change_jaws.ogg', 50, 1) playsound(get_turf(user), 'sound/items/change_jaws.ogg', 50, 1)
var/obj/item/crowbar/power/pryjaws = new /obj/item/crowbar/power var/obj/item/crowbar/power/pryjaws = new /obj/item/crowbar/power(drop_location())
to_chat(user, "<span class='notice'>You attach the pry jaws to [src].</span>") to_chat(user, "<span class='notice'>You attach the pry jaws to [src].</span>")
qdel(src) qdel(src)
user.put_in_active_hand(pryjaws) user.put_in_active_hand(pryjaws)
+1 -1
View File
@@ -62,7 +62,7 @@
/obj/item/wrench/power/attack_self(mob/user) /obj/item/wrench/power/attack_self(mob/user)
playsound(get_turf(user),'sound/items/change_drill.ogg',50,1) playsound(get_turf(user),'sound/items/change_drill.ogg',50,1)
var/obj/item/wirecutters/power/s_drill = new /obj/item/screwdriver/power var/obj/item/wirecutters/power/s_drill = new /obj/item/screwdriver/power(drop_location())
to_chat(user, "<span class='notice'>You attach the screw driver bit to [src].</span>") to_chat(user, "<span class='notice'>You attach the screw driver bit to [src].</span>")
qdel(src) qdel(src)
user.put_in_active_hand(s_drill) user.put_in_active_hand(s_drill)
@@ -30,6 +30,7 @@ God bless America.
use_power = IDLE_POWER_USE use_power = IDLE_POWER_USE
idle_power_usage = 5 idle_power_usage = 5
container_type = OPENCONTAINER container_type = OPENCONTAINER
layer = BELOW_OBJ_LAYER
var/obj/item/reagent_containers/food/snacks/deepfryholder/frying //What's being fried RIGHT NOW? var/obj/item/reagent_containers/food/snacks/deepfryholder/frying //What's being fried RIGHT NOW?
var/cook_time = 0 var/cook_time = 0
var/oil_use = 0.05 //How much cooking oil is used per tick var/oil_use = 0.05 //How much cooking oil is used per tick
@@ -127,7 +128,9 @@ God bless America.
to_chat(user, "<span class='notice'>You eject [frying] from [src].</span>") to_chat(user, "<span class='notice'>You eject [frying] from [src].</span>")
frying.fry(cook_time) frying.fry(cook_time)
icon_state = "fryer_off" icon_state = "fryer_off"
user.put_in_hands(frying) frying.forceMove(drop_location())
if(Adjacent(user) && !issilicon(user))
user.put_in_hands(frying)
frying = null frying = null
cook_time = 0 cook_time = 0
frying_fried = FALSE frying_fried = FALSE