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 1 commit
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
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
2 changes: 1 addition & 1 deletion code/modules/antagonists/devil/true_devil/_true_devil.dm
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
return FALSE
return TRUE

/mob/living/carbon/true_devil/assess_threat(judgment_criteria, lasercolor = "", datum/callback/weaponcheck=null)
/mob/living/carbon/true_devil/assess_threat(judgement_criteria, lasercolor = "", datum/callback/weaponcheck=null)
return 666

/mob/living/carbon/true_devil/flash_act(intensity = 1, override_blindness_check = 0, affect_silicon = 0, visual = 0)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/alien/alien.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
internal_organs += new /obj/item/organ/ears
return ..()

/mob/living/carbon/alien/assess_threat(judgment_criteria, lasercolor = "", datum/callback/weaponcheck=null) // beepsky won't hunt aliums
/mob/living/carbon/alien/assess_threat(judgement_criteria, lasercolor = "", datum/callback/weaponcheck=null) // beepsky won't hunt aliums
return -10

/mob/living/carbon/alien/handle_environment(datum/gas_mixture/environment)
Expand Down
10 changes: 5 additions & 5 deletions code/modules/mob/living/carbon/human/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,8 @@
return FALSE
return TRUE

/mob/living/carbon/human/assess_threat(judgment_criteria, lasercolor = "", datum/callback/weaponcheck=null)
if(judgment_criteria & JUDGE_EMAGGED)
/mob/living/carbon/human/assess_threat(judgement_criteria, lasercolor = "", datum/callback/weaponcheck=null)
if(judgement_criteria & JUDGE_EMAGGED)
return 10 //Everyone is a criminal!

var/threatcount = 0
Expand All @@ -476,11 +476,11 @@

//Check for ID
var/obj/item/card/id/idcard = get_idcard(FALSE)
if( (judgment_criteria & JUDGE_IDCHECK) && !idcard && name=="Unknown")
if( (judgement_criteria & JUDGE_IDCHECK) && !idcard && name=="Unknown")
threatcount += 4

//Check for weapons
if( (judgment_criteria & JUDGE_WEAPONCHECK) && weaponcheck)
if( (judgement_criteria & JUDGE_WEAPONCHECK) && weaponcheck)
if(!idcard || !(ACCESS_WEAPONS in idcard.access))
for(var/obj/item/I in held_items) //if they're holding a gun
if(weaponcheck.Invoke(I))
Expand All @@ -489,7 +489,7 @@
threatcount += 2 //not enough to trigger look_for_perp() on it's own unless they also have criminal status.

//Check for arrest warrant
if(judgment_criteria & JUDGE_RECORDCHECK)
if(judgement_criteria & JUDGE_RECORDCHECK)
var/perpname = get_face_name(get_id_name())
var/datum/data/record/R = find_record("name", perpname, GLOB.data_core.security)
if(R && R.fields["criminal"])
Expand Down
8 changes: 4 additions & 4 deletions code/modules/mob/living/carbon/monkey/monkey.dm
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,14 @@ GLOBAL_LIST_INIT(strippable_monkey_items, create_strippable_list(list(
/mob/living/carbon/monkey/canBeHandcuffed()
return TRUE

/mob/living/carbon/monkey/assess_threat(judgment_criteria, lasercolor = "", datum/callback/weaponcheck=null)
if(judgment_criteria & JUDGE_EMAGGED)
/mob/living/carbon/monkey/assess_threat(judgement_criteria, lasercolor = "", datum/callback/weaponcheck=null)
if(judgement_criteria & JUDGE_EMAGGED)
return 10 //Everyone is a criminal!

var/threatcount = 0

//Securitrons can't identify monkeys
if( !(judgment_criteria & JUDGE_IGNOREMONKEYS) && (judgment_criteria & JUDGE_IDCHECK) )
if( !(judgement_criteria & JUDGE_IGNOREMONKEYS) && (judgement_criteria & JUDGE_IDCHECK) )
threatcount += 4

//Lasertag bullshit
Expand All @@ -144,7 +144,7 @@ GLOBAL_LIST_INIT(strippable_monkey_items, create_strippable_list(list(
return threatcount

//Check for weapons
if( (judgment_criteria & JUDGE_WEAPONCHECK) && weaponcheck )
if( (judgement_criteria & JUDGE_WEAPONCHECK) && weaponcheck )
for(var/obj/item/I in held_items) //if they're holding a gun
if(weaponcheck.Invoke(I))
threatcount += 4
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/silicon/silicon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@
return 0


/mob/living/silicon/assess_threat(judgment_criteria, lasercolor = "", datum/callback/weaponcheck=null) //Secbots won't hunt silicon units
/mob/living/silicon/assess_threat(judgement_criteria, lasercolor = "", datum/callback/weaponcheck=null) //Secbots won't hunt silicon units
return -10

/mob/living/silicon/proc/remove_sensors()
Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/living/simple_animal/bot/SuperBeepsky.dm
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@

/mob/living/simple_animal/bot/secbot/grievous/look_for_perp()
anchored = FALSE
var/judgment_criteria = judgment_criteria()
var/judgement_criteria = judgement_criteria()
for (var/mob/living/carbon/C in view(7,src)) //Let's find us a criminal
if((C.stat) || (C.handcuffed))
continue

if((C.name == oldtarget_name) && (world.time < last_found + 100))
continue

threatlevel = C.assess_threat(judgment_criteria, weaponcheck=CALLBACK(src, .proc/check_for_weapons))
threatlevel = C.assess_threat(judgement_criteria, weaponcheck=CALLBACK(src, .proc/check_for_weapons))

if(!threatlevel)
continue
Expand Down
93 changes: 26 additions & 67 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,27 +118,15 @@
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(!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(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(5)
Tsar-Salat marked this conversation as resolved.
Show resolved Hide resolved
if(isprox(W))
Expand All @@ -155,8 +136,8 @@
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(istype(W, /obj/item/stack/cable_coil))
Expand All @@ -173,46 +154,24 @@
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(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++
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(8)
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))
name = "armed [name]"
to_chat(user, "<span class='notice'>The gun is now securely fastened to the frame.</span>")
build_step++

if(9)
Tsar-Salat marked this conversation as resolved.
Show resolved Hide resolved
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)
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)

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>")
qdel(src)

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