Fix building frames on walls and windows.

try_build() has long accepted `user` parameter, but nothing that called try_build actually passed it!
Upgraded try_build on APC to use the user parameter, and switched to use to_chat while I was there.
This commit is contained in:
Leshana
2018-04-11 19:45:04 -04:00
parent b427bca859
commit c481f01343
3 changed files with 11 additions and 11 deletions

View File

@@ -13,31 +13,31 @@
new /obj/item/stack/material/steel( get_turf(src.loc), 2 )
qdel(src)
/obj/item/frame/apc/try_build(turf/on_wall)
if (get_dist(on_wall,usr)>1)
/obj/item/frame/apc/try_build(turf/on_wall, mob/user as mob)
if (get_dist(on_wall, user)>1)
return
var/ndir = get_dir(usr,on_wall)
var/ndir = get_dir(user, on_wall)
if (!(ndir in cardinal))
return
var/turf/loc = get_turf(usr)
var/turf/loc = get_turf(user)
var/area/A = loc.loc
if (!istype(loc, /turf/simulated/floor))
usr << "<span class='warning'>APC cannot be placed on this spot.</span>"
to_chat(user, "<span class='warning'>APC cannot be placed on this spot.</span>")
return
if (A.requires_power == 0 || istype(A, /area/space))
usr << "<span class='warning'>APC cannot be placed in this area.</span>"
to_chat(user, "<span class='warning'>APC cannot be placed in this area.</span>")
return
if (A.get_apc())
usr << "<span class='warning'>This area already has an APC.</span>"
to_chat(user, "<span class='warning'>This area already has an APC.</span>")
return //only one APC per area
for(var/obj/machinery/power/terminal/T in loc)
if (T.master)
usr << "<span class='warning'>There is another network terminal here.</span>"
to_chat(user, "<span class='warning'>There is another network terminal here.</span>")
return
else
var/obj/item/stack/cable_coil/C = new /obj/item/stack/cable_coil(loc)
C.amount = 10
usr << "You cut the cables and disassemble the unused power terminal."
to_chat(user, "You cut the cables and disassemble the unused power terminal.")
qdel(T)
new /obj/machinery/power/apc(loc, ndir, 1)
qdel(src)

View File

@@ -311,7 +311,7 @@
qdel(src)
else if(istype(W,/obj/item/frame) && anchored)
var/obj/item/frame/F = W
F.try_build(src)
F.try_build(src, user)
else
user.setClickCooldown(user.get_attack_speed(W))
if(W.damtype == BRUTE || W.damtype == BURN)

View File

@@ -355,7 +355,7 @@
if(istype(W,/obj/item/frame))
var/obj/item/frame/F = W
F.try_build(src)
F.try_build(src, user)
return
else if(!istype(W,/obj/item/weapon/rcd) && !istype(W, /obj/item/weapon/reagent_containers))