Merge pull request #34733 from ShizCalev/box-fixes

Fixes bot drop & bot assembly issues
This commit is contained in:
oranges
2018-01-23 20:42:54 +13:00
committed by CitadelStationBot
parent 5e1ff26276
commit 1caf34f0df
3 changed files with 28 additions and 12 deletions
@@ -379,6 +379,10 @@
dropped_cell.charge = 0
dropped_cell.update_icon()
else if(istype(dropped_item, /obj/item/storage))
var/obj/item/storage/S = dropped_item
S.contents = list()
else if(istype(dropped_item, /obj/item/gun/energy))
var/obj/item/gun/energy/dropped_gun = dropped_item
dropped_gun.cell.charge = 0
@@ -24,6 +24,13 @@
return
created_name = t
/obj/item/bot_assembly/proc/can_finish_build(obj/item/I, mob/user)
if(istype(loc, /obj/item/storage/backpack))
to_chat(user, "<span class='warning'>You must take [src] out of [loc] first!</span>")
return FALSE
if(!I || !user || !user.temporarilyRemoveItemFromInventory(I))
return FALSE
return TRUE
//Cleanbot assembly
/obj/item/bot_assembly/cleanbot
@@ -33,10 +40,10 @@
throwforce = 5
created_name = "Cleanbot"
/obj/item/bot_assembly/cleanbot/attackby(obj/item/W, mob/user as mob, params)
/obj/item/bot_assembly/cleanbot/attackby(obj/item/W, mob/user, params)
..()
if(istype(W, /obj/item/bodypart/l_arm/robot) || istype(W, /obj/item/bodypart/r_arm/robot))
if(!user.temporarilyRemoveItemFromInventory(W))
if(!can_finish_build(W, user))
return
var/mob/living/simple_animal/bot/cleanbot/A = new(drop_location())
A.name = created_name
@@ -185,7 +192,7 @@
if(9)
if(istype(W, /obj/item/stock_parts/cell))
if(!user.temporarilyRemoveItemFromInventory(W))
if(!can_finish_build(W, user))
return
var/mob/living/simple_animal/bot/ed209/B = new(drop_location(),created_name,lasercolor)
to_chat(user, "<span class='notice'>You complete the ED-209.</span>")
@@ -202,6 +209,7 @@
icon_state = "toolbox_tiles"
throwforce = 10
created_name = "Floorbot"
var/toolbox = /obj/item/storage/toolbox/mechanical
/obj/item/bot_assembly/floorbot/Initialize()
. = ..()
@@ -231,6 +239,7 @@
if(user.s_active)
user.s_active.close(user)
var/obj/item/bot_assembly/floorbot/B = new
B.toolbox = type
user.put_in_hands(B)
to_chat(user, "<span class='notice'>You add the tiles into the empty [src.name]. They protrude from the top.</span>")
qdel(src)
@@ -243,16 +252,21 @@
switch(build_step)
if(ASSEMBLY_FIRST_STEP)
if(isprox(W))
if(!user.temporarilyRemoveItemFromInventory(W))
return
to_chat(user, "<span class='notice'>You add [W] to [src].</span>")
qdel(W)
build_step++
update_icon()
if(ASSEMBLY_SECOND_STEP)
if(ASSEMBLY_SECOND_STEP)
if(istype(W, /obj/item/bodypart/l_arm/robot) || istype(W, /obj/item/bodypart/r_arm/robot))
if(!can_finish_build(W, user))
return
var/mob/living/simple_animal/bot/floorbot/A = new(drop_location())
A.name = created_name
A.robot_arm = W.type
A.toolbox = toolbox
to_chat(user, "<span class='notice'>You add [W] to [src]. Boop beep!</span>")
qdel(W)
qdel(src)
@@ -311,13 +325,13 @@
healthanalyzer = W.type
to_chat(user, "<span class='notice'>You add [W] to [src].</span>")
qdel(W)
name = "First aid/robot arm/health analyzer assembly"
name = "first aid/robot arm/health analyzer assembly"
add_overlay("na_scanner")
build_step++
if(ASSEMBLY_SECOND_STEP)
if(isprox(W))
if(!user.temporarilyRemoveItemFromInventory(W))
if(!can_finish_build(W, user))
return
qdel(W)
var/mob/living/simple_animal/bot/medbot/S = new(drop_location(), skin)
@@ -351,9 +365,7 @@
if(ASSEMBLY_SECOND_STEP)
if(istype(I, /obj/item/bikehorn))
if(istype(loc, /obj/item/storage/backpack)) //don't build them in your backpacks!
return
if(!user.temporarilyRemoveItemFromInventory(I))
if(!can_finish_build(I, user))
return
to_chat(user, "<span class='notice'>You add the [I] to [src]! Honk!</span>")
var/mob/living/simple_animal/bot/honkbot/S = new(drop_location())
@@ -427,7 +439,7 @@
if(ASSEMBLY_FOURTH_STEP)
if(istype(I, /obj/item/melee/baton))
if(!user.temporarilyRemoveItemFromInventory(I))
if(!can_finish_build(I, user))
return
to_chat(user, "<span class='notice'>You complete the Securitron! Beep boop.</span>")
var/mob/living/simple_animal/bot/secbot/S = new(Tsec)
@@ -31,6 +31,7 @@
var/max_targets = 50
var/turf/target
var/oldloc = null
var/toolbox = /obj/item/storage/toolbox/mechanical
#define HULL_BREACH 1
#define LINE_SPACE_MODE 2
@@ -366,8 +367,7 @@
visible_message("<span class='boldannounce'>[src] blows apart!</span>")
var/atom/Tsec = drop_location()
var/obj/item/storage/toolbox/mechanical/N = new (Tsec)
N.contents = list()
drop_part(toolbox, Tsec)
new /obj/item/device/assembly/prox_sensor(Tsec)