Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactors secbot code, cleans up bot code in general. Centralizes defines #8492

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions code/__DEFINES/robots.dm
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,12 @@
#define DISCONNECT 5

//Assembly defines
#define ASSEMBLY_FIRST_STEP 0
#define ASSEMBLY_SECOND_STEP 1
#define ASSEMBLY_THIRD_STEP 2
#define ASSEMBLY_FOURTH_STEP 3
#define ASSEMBLY_FIFTH_STEP 4
#define ASSEMBLY_FIRST_STEP 0
#define ASSEMBLY_SECOND_STEP 1
#define ASSEMBLY_THIRD_STEP 2
#define ASSEMBLY_FOURTH_STEP 3
#define ASSEMBLY_FIFTH_STEP 4
#define ASSEMBLY_SIXTH_STEP 5
#define ASSEMBLY_SEVENTH_STEP 6
#define ASSEMBLY_EIGHTH_STEP 7
#define ASSEMBLY_NINTH_STEP 8
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add another one and replace the `if(9) with it.

4 changes: 2 additions & 2 deletions code/controllers/subsystem/traumas.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ SUBSYSTEM_DEF(traumas)
)

phobia_mobs = list("spiders" = typecacheof(list(/mob/living/simple_animal/hostile/poison/giant_spider)),
"security" = typecacheof(list(/mob/living/simple_animal/bot/secbot, /mob/living/simple_animal/bot/ed209)),
"security" = typecacheof(list(/mob/living/simple_animal/bot/secbot)),
"lizards" = typecacheof(list(/mob/living/simple_animal/hostile/lizard)),
"skeletons" = typecacheof(list(/mob/living/simple_animal/hostile/skeleton)),
"snakes" = typecacheof(list(/mob/living/simple_animal/hostile/retaliate/poison/snake)),
Expand All @@ -46,7 +46,7 @@ SUBSYSTEM_DEF(traumas)
"the supernatural" = typecacheof(list(/mob/living/simple_animal/hostile/construct,
/mob/living/simple_animal/revenant, /mob/living/simple_animal/shade)),
"aliens" = typecacheof(list(/mob/living/carbon/alien, /mob/living/simple_animal/slime)),
"conspiracies" = typecacheof(list(/mob/living/simple_animal/bot/secbot, /mob/living/simple_animal/bot/ed209, /mob/living/simple_animal/drone,
"conspiracies" = typecacheof(list(/mob/living/simple_animal/bot/secbot, /mob/living/simple_animal/drone,
/mob/living/simple_animal/pet/penguin)),
"birds" = typecacheof(list(/mob/living/simple_animal/parrot, /mob/living/simple_animal/chick, /mob/living/simple_animal/chicken,
/mob/living/simple_animal/pet/penguin)),
Expand Down
5 changes: 2 additions & 3 deletions code/datums/components/crafting/recipes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,15 @@

/datum/crafting_recipe/ed209
name = "ED209"
result = /mob/living/simple_animal/bot/ed209
result = /mob/living/simple_animal/bot/secbot/ed209
reqs = list(/obj/item/robot_suit = 1,
/obj/item/clothing/head/helmet = 1,
/obj/item/clothing/suit/armor/vest = 1,
/obj/item/bodypart/l_leg/robot = 1,
/obj/item/bodypart/r_leg/robot = 1,
/obj/item/stack/sheet/iron = 1,
/obj/item/stack/cable_coil = 1,
/obj/item/gun/energy/e_gun/dragnet = 1,
/obj/item/stock_parts/cell = 1,
/obj/item/gun/energy/disabler = 1,
Rukofamicom marked this conversation as resolved.
Show resolved Hide resolved
/obj/item/assembly/prox_sensor = 1)
tools = list(TOOL_WELDER, TOOL_SCREWDRIVER)
time = 60
Expand Down
93 changes: 30 additions & 63 deletions code/modules/mob/living/simple_animal/bot/construction.dm
Original file line number Diff line number Diff line change
Expand Up @@ -100,21 +100,14 @@
build_step++

if(ASSEMBLY_THIRD_STEP)
var/newcolor = ""
if(istype(W, /obj/item/clothing/suit/redtag))
newcolor = "r"
else if(istype(W, /obj/item/clothing/suit/bluetag))
newcolor = "b"
if(newcolor || istype(W, /obj/item/clothing/suit/armor/vest))
if(istype(W, /obj/item/clothing/suit/armor/vest))
if(!user.temporarilyRemoveItemFromInventory(W))
return
lasercolor = newcolor
vest_type = W.type
to_chat(user, "<span class='notice'>You add [W] to [src].</span>")
qdel(W)
name = "vest/legs/frame assembly"
item_state = "[lasercolor]ed209_shell"
icon_state = "[lasercolor]ed209_shell"
item_state = "ed209_shell"
icon_state = "ed209_shell"
build_step++

if(ASSEMBLY_FOURTH_STEP)
Expand All @@ -125,40 +118,28 @@
build_step++

if(ASSEMBLY_FIFTH_STEP)
switch(lasercolor)
if("b")
if(!istype(W, /obj/item/clothing/head/helmet/bluetaghelm))
return

if("r")
if(!istype(W, /obj/item/clothing/head/helmet/redtaghelm))
return

if("")
if(!istype(W, /obj/item/clothing/head/helmet))
return
if(istype(W, /obj/item/clothing/head/helmet))
if(!user.temporarilyRemoveItemFromInventory(W))
return
to_chat(user, "<span class='notice'>You add [W] to [src].</span>")
qdel(W)
name = "covered and shielded frame assembly"
item_state = "ed209_hat"
icon_state = "ed209_hat"
build_step++

if(!user.temporarilyRemoveItemFromInventory(W))
return
to_chat(user, "<span class='notice'>You add [W] to [src].</span>")
qdel(W)
name = "covered and shielded frame assembly"
item_state = "[lasercolor]ed209_hat"
icon_state = "[lasercolor]ed209_hat"
build_step++

if(5)
if(ASSEMBLY_SIXTH_STEP)
if(isprox(W))
if(!user.temporarilyRemoveItemFromInventory(W))
return
build_step++
to_chat(user, "<span class='notice'>You add [W] to [src].</span>")
qdel(W)
name = "covered, shielded and sensored frame assembly"
item_state = "[lasercolor]ed209_prox"
icon_state = "[lasercolor]ed209_prox"
item_state = "ed209_prox"
icon_state = "ed209_prox"

if(6)
if(ASSEMBLY_SEVENTH_STEP)
if(istype(W, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/coil = W
if(coil.get_amount() < 1)
Expand All @@ -172,29 +153,18 @@
name = "wired ED-209 assembly"
build_step++

if(7)
switch(lasercolor)
if("b")
if(!istype(W, /obj/item/gun/energy/laser/bluetag))
return
if("r")
if(!istype(W, /obj/item/gun/energy/laser/redtag))
return
if("")
if(!istype(W, /obj/item/gun/energy/disabler))
return
else
if(ASSEMBLY_EIGHTH_STEP)
if(istype(W, /obj/item/gun/energy/disabler))
if(!user.temporarilyRemoveItemFromInventory(W))
return
if(!user.temporarilyRemoveItemFromInventory(W))
return
name = "[W.name] ED-209 assembly"
to_chat(user, "<span class='notice'>You add [W] to [src].</span>")
item_state = "[lasercolor]ed209_taser"
icon_state = "[lasercolor]ed209_taser"
qdel(W)
build_step++

if(8)
name = "[W.name] ED-209 assembly"
to_chat(user, "<span class='notice'>You add [W] to [src].</span>")
item_state = "ed209_taser"
icon_state = "ed209_taser"
qdel(W)
build_step++

if(ASSEMBLY_NINTH_STEP)
if(W.tool_behaviour == TOOL_SCREWDRIVER)
to_chat(user, "<span class='notice'>You start attaching the gun to the frame...</span>")
if(W.use_tool(src, user, 40, volume=100))
Expand All @@ -206,13 +176,10 @@
if(istype(W, /obj/item/stock_parts/cell))
if(!can_finish_build(W, user))
return
var/mob/living/simple_animal/bot/ed209/B = new(drop_location(),created_name,lasercolor)
var/mob/living/simple_animal/bot/secbot/ed209/B = new(drop_location())
B.name = created_name
to_chat(user, "<span class='notice'>You complete the ED-209.</span>")
B.cell_type = W.type
qdel(W)
B.vest_type = vest_type
qdel(src)

qdel(src) //make sure to delete the unfinished recipe when spawning in the actual mob

//Floorbot assemblies
/obj/item/bot_assembly/floorbot
Expand Down
Loading
Loading