[MIRROR] Cleans up bot construction code (#4668)

* Merge pull request #42972 from TerraGS/bot-cleanup
This commit is contained in:
yogstation13-bot
2019-03-05 01:07:37 +01:00
committed by Gary Lafortune
parent 0f36168cdf
commit 1834fe1eca
4 changed files with 73 additions and 73 deletions

View File

@@ -234,3 +234,13 @@
theturf.MakeSlippery(TURF_WET_WATER, min_wet_time = 10 SECONDS, wet_time_to_add = 5 SECONDS)
user.visible_message("[user] empties out \the [src] onto the floor using the release valve.", "<span class='info'>You quietly empty out \the [src] using its release valve.</span>")
//firebot assembly
/obj/item/extinguisher/attackby(obj/O, mob/user, params)
if(istype(O, /obj/item/bodypart/l_arm/robot) || istype(O, /obj/item/bodypart/r_arm/robot))
to_chat(user, "<span class='notice'>You add [O] to [src].</span>")
qdel(O)
qdel(src)
user.put_in_hands(new /obj/item/bot_assembly/firebot)
else
..()

View File

@@ -174,6 +174,32 @@
new /obj/item/reagent_containers/pill/patch/silver_sulf(src)
new /obj/item/clothing/glasses/hud/health/night(src)
//medibot assembly
/obj/item/storage/firstaid/attackby(obj/item/bodypart/S, mob/user, params)
if((!istype(S, /obj/item/bodypart/l_arm/robot)) && (!istype(S, /obj/item/bodypart/r_arm/robot)))
return ..()
//Making a medibot!
if(contents.len >= 1)
to_chat(user, "<span class='warning'>You need to empty [src] out first!</span>")
return
var/obj/item/bot_assembly/medbot/A = new
if(istype(src, /obj/item/storage/firstaid/fire))
A.skin = "ointment"
else if(istype(src, /obj/item/storage/firstaid/toxin))
A.skin = "tox"
else if(istype(src, /obj/item/storage/firstaid/o2))
A.skin = "o2"
else if(istype(src, /obj/item/storage/firstaid/brute))
A.skin = "brute"
user.put_in_hands(A)
to_chat(user, "<span class='notice'>You add [S] to [src].</span>")
A.robot_arm = S.type
A.firstaid = type
qdel(S)
qdel(src)
/*
* Pill Bottles
*/

View File

@@ -86,7 +86,7 @@
/obj/item/storage/toolbox/mechanical/old/heirloom/PopulateContents()
return
/obj/item/storage/toolbox/mechanical/old/clean
name = "toolbox"
desc = "A old, blue toolbox, it looks robust."
@@ -248,3 +248,39 @@
new/obj/item/stack/cable_coil/orange(src)
new/obj/item/stack/cable_coil/cyan(src)
new/obj/item/stack/cable_coil/white(src)
//floorbot assembly
/obj/item/storage/toolbox/attackby(obj/item/stack/tile/plasteel/T, mob/user, params)
var/list/allowed_toolbox = list(/obj/item/storage/toolbox/emergency, //which toolboxes can be made into floorbots
/obj/item/storage/toolbox/electrical,
/obj/item/storage/toolbox/mechanical,
/obj/item/storage/toolbox/artistic,
/obj/item/storage/toolbox/syndicate)
if(!istype(T, /obj/item/stack/tile/plasteel))
..()
return
if(!is_type_in_list(src, allowed_toolbox))
return
if(contents.len >= 1)
to_chat(user, "<span class='warning'>They won't fit in, as there is already stuff inside!</span>")
return
if(T.use(10))
var/obj/item/bot_assembly/floorbot/B = new
B.toolbox = type
switch(B.toolbox)
if(/obj/item/storage/toolbox/emergency)
B.toolbox_color = "r"
if(/obj/item/storage/toolbox/electrical)
B.toolbox_color = "y"
if(/obj/item/storage/toolbox/artistic)
B.toolbox_color = "g"
if(/obj/item/storage/toolbox/syndicate)
B.toolbox_color = "s"
user.put_in_hands(B)
B.update_icon()
to_chat(user, "<span class='notice'>You add the tiles into the empty [src.name]. They protrude from the top.</span>")
qdel(src)
else
to_chat(user, "<span class='warning'>You need 10 floor tiles to start building a floorbot!</span>")
return

View File

@@ -227,41 +227,6 @@
name = "incomplete floorbot assembly"
icon_state = "[toolbox_color]toolbox_tiles_sensor"
/obj/item/storage/toolbox/attackby(obj/item/stack/tile/plasteel/T, mob/user, params)
var/list/allowed_toolbox = list(/obj/item/storage/toolbox/emergency, //which toolboxes can be made into floorbots
/obj/item/storage/toolbox/electrical,
/obj/item/storage/toolbox/mechanical,
/obj/item/storage/toolbox/artistic,
/obj/item/storage/toolbox/syndicate)
if(!istype(T, /obj/item/stack/tile/plasteel))
..()
return
if(!is_type_in_list(src, allowed_toolbox))
return
if(contents.len >= 1)
to_chat(user, "<span class='warning'>They won't fit in, as there is already stuff inside!</span>")
return
if(T.use(10))
var/obj/item/bot_assembly/floorbot/B = new
B.toolbox = type
switch(B.toolbox)
if(/obj/item/storage/toolbox/emergency)
B.toolbox_color = "r"
if(/obj/item/storage/toolbox/electrical)
B.toolbox_color = "y"
if(/obj/item/storage/toolbox/artistic)
B.toolbox_color = "g"
if(/obj/item/storage/toolbox/syndicate)
B.toolbox_color = "s"
user.put_in_hands(B)
B.update_icon()
to_chat(user, "<span class='notice'>You add the tiles into the empty [src.name]. They protrude from the top.</span>")
qdel(src)
else
to_chat(user, "<span class='warning'>You need 10 floor tiles to start building a floorbot!</span>")
return
/obj/item/bot_assembly/floorbot/attackby(obj/item/W, mob/user, params)
..()
switch(build_step)
@@ -303,32 +268,6 @@
if(skin)
add_overlay("kit_skin_[skin]")
/obj/item/storage/firstaid/attackby(obj/item/bodypart/S, mob/user, params)
if((!istype(S, /obj/item/bodypart/l_arm/robot)) && (!istype(S, /obj/item/bodypart/r_arm/robot)))
return ..()
//Making a medibot!
if(contents.len >= 1)
to_chat(user, "<span class='warning'>You need to empty [src] out first!</span>")
return
var/obj/item/bot_assembly/medbot/A = new
if(istype(src, /obj/item/storage/firstaid/fire))
A.skin = "ointment"
else if(istype(src, /obj/item/storage/firstaid/toxin))
A.skin = "tox"
else if(istype(src, /obj/item/storage/firstaid/o2))
A.skin = "o2"
else if(istype(src, /obj/item/storage/firstaid/brute))
A.skin = "brute"
user.put_in_hands(A)
to_chat(user, "<span class='notice'>You add [S] to [src].</span>")
A.robot_arm = S.type
A.firstaid = type
qdel(S)
qdel(src)
/obj/item/bot_assembly/medbot/attackby(obj/item/W, mob/user, params)
..()
switch(build_step)
@@ -526,17 +465,6 @@
new /obj/item/melee/transforming/energy/sword/saber(Tsec)
// Fire extinguisher + borg arm = firebot assembly
/obj/item/extinguisher/attackby(obj/O, mob/user, params)
if(istype(O, /obj/item/bodypart/l_arm/robot) || istype(O, /obj/item/bodypart/r_arm/robot))
to_chat(user, "<span class='notice'>You add [O] to [src].</span>")
qdel(O)
qdel(src)
user.put_in_hands(new /obj/item/bot_assembly/firebot)
else
..()
//Firebot Assembly
/obj/item/bot_assembly/firebot
name = "incomplete firebot assembly"