From 1caf34f0df29c5bd6fa494a147d925584232a504 Mon Sep 17 00:00:00 2001 From: oranges Date: Tue, 23 Jan 2018 20:42:54 +1300 Subject: [PATCH] Merge pull request #34733 from ShizCalev/box-fixes Fixes bot drop & bot assembly issues --- .../mob/living/simple_animal/bot/bot.dm | 4 +++ .../living/simple_animal/bot/construction.dm | 32 +++++++++++++------ .../mob/living/simple_animal/bot/floorbot.dm | 4 +-- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index bd769d2d7b..9050ba0ffa 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -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 diff --git a/code/modules/mob/living/simple_animal/bot/construction.dm b/code/modules/mob/living/simple_animal/bot/construction.dm index 2d5fd57a1e..f2333ef713 100644 --- a/code/modules/mob/living/simple_animal/bot/construction.dm +++ b/code/modules/mob/living/simple_animal/bot/construction.dm @@ -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, "You must take [src] out of [loc] first!") + 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, "You complete the ED-209.") @@ -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, "You add the tiles into the empty [src.name]. They protrude from the top.") qdel(src) @@ -243,16 +252,21 @@ switch(build_step) if(ASSEMBLY_FIRST_STEP) if(isprox(W)) + if(!user.temporarilyRemoveItemFromInventory(W)) + return to_chat(user, "You add [W] to [src].") 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, "You add [W] to [src]. Boop beep!") qdel(W) qdel(src) @@ -311,13 +325,13 @@ healthanalyzer = W.type to_chat(user, "You add [W] to [src].") 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, "You add the [I] to [src]! Honk!") 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, "You complete the Securitron! Beep boop.") var/mob/living/simple_animal/bot/secbot/S = new(Tsec) diff --git a/code/modules/mob/living/simple_animal/bot/floorbot.dm b/code/modules/mob/living/simple_animal/bot/floorbot.dm index c4cdcbf675..80493f526e 100644 --- a/code/modules/mob/living/simple_animal/bot/floorbot.dm +++ b/code/modules/mob/living/simple_animal/bot/floorbot.dm @@ -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("[src] blows apart!") 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)