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 all 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
9 changes: 1 addition & 8 deletions _maps/map_files/BoxStation/BoxStation.dmm

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 1 addition & 8 deletions _maps/map_files/CorgStation/CorgStation.dmm

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 1 addition & 8 deletions _maps/map_files/FlandStation/FlandStation.dmm

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 1 addition & 8 deletions _maps/map_files/KiloStation/KiloStation.dmm

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 1 addition & 8 deletions _maps/map_files/MetaStation/MetaStation.dmm

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 1 addition & 8 deletions _maps/map_files/RadStation/RadStation.dmm

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

193 changes: 151 additions & 42 deletions code/__DEFINES/robots.dm
Original file line number Diff line number Diff line change
@@ -1,41 +1,152 @@
/*ALL DEFINES FOR AIS, CYBORGS, AND SIMPLE ANIMAL BOTS*/
/** AI defines */

#define DEFAULT_AI_LAWID "default"
#define LAW_VALENTINES "valentines"
#define LAW_DEVIL "devil"
#define LAW_ZEROTH "zeroth"
#define LAW_INHERENT "inherent"
#define LAW_SUPPLIED "supplied"
#define LAW_ION "ion"
#define LAW_HACKED "hacked"

//AI notification defines
///Alert when a new Cyborg is created.
#define AI_NOTIFICATION_NEW_BORG 1
///Alert when a Cyborg selects a model.
#define AI_NOTIFICATION_NEW_MODEL 2
///Alert when a Cyborg changes their name.
#define AI_NOTIFICATION_CYBORG_RENAMED 3
///Alert when an AI disconnects themselves from their shell.
#define AI_NOTIFICATION_AI_SHELL 4
///Alert when a Cyborg gets disconnected from their AI.
#define AI_NOTIFICATION_CYBORG_DISCONNECTED 5

/** Cyborg defines */

/// Special value to reset cyborg's lamp_cooldown
#define BORG_LAMP_CD_RESET -1

//Module slot define
///The third module slots is disabed.
#define BORG_MODULE_THREE_DISABLED (1<<0)
///The second module slots is disabed.
#define BORG_MODULE_TWO_DISABLED (1<<1)
///All modules slots are disabled.
#define BORG_MODULE_ALL_DISABLED (1<<2)

//Cyborg module selection
///First Borg module slot.
#define BORG_CHOOSE_MODULE_ONE 1
///Second Borg module slot.
#define BORG_CHOOSE_MODULE_TWO 2
///Third Borg module slot.
#define BORG_CHOOSE_MODULE_THREE 3

#define SKIN_ICON "skin_icon"
#define SKIN_ICON_STATE "skin_icon_state"
#define SKIN_PIXEL_X "skin_pixel_x"
#define SKIN_PIXEL_Y "skin_pixel_y"
#define SKIN_LIGHT_KEY "skin_light_key"
#define SKIN_HAT_OFFSET "skin_hat_offset"
#define SKIN_TRAITS "skin_traits"

/** Simple Animal BOT defines */

//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_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.


//Bot defines, placed here so they can be read by other things!
#define BOT_STEP_DELAY 4 //Delay between movemements
#define BOT_STEP_MAX_RETRIES 5 //Maximum times a bot will retry to step from its position
/// Delay between movemements
#define BOT_STEP_DELAY 4
/// Maximum times a bot will retry to step from its position
#define BOT_STEP_MAX_RETRIES 5
/// Default view range for finding targets.
#define DEFAULT_SCAN_RANGE 7

#define DEFAULT_SCAN_RANGE 7 //default view range for finding targets.
//Bot types
/// Secutritrons (Beepsky)
#define SEC_BOT (1<<0)
/// ED-209s
#define ADVANCED_SEC_BOT (1<<1)
/// MULEbots
#define MULE_BOT (1<<2)
/// Floorbots
#define FLOOR_BOT (1<<3)
/// Cleanbots
#define CLEAN_BOT (1<<4)
/// Medibots
#define MED_BOT (1<<5)
/// Honkbots & ED-Honks
#define HONK_BOT (1<<6)
/// Firebots
#define FIRE_BOT (1<<7)
/// Hygienebots
//#define HYGIENE_BOT (1<<8)
/// Vibe bots
#define VIBE_BOT (1<<9)

//Mode defines
#define BOT_IDLE 0 //! idle
#define BOT_HUNT 1 //! found target, hunting
#define BOT_PREP_ARREST 2 //! at target, preparing to arrest
#define BOT_ARREST 3 //! arresting target
#define BOT_START_PATROL 4 //! start patrol
#define BOT_PATROL 5 //! patrolling
#define BOT_SUMMON 6 //! summoned by PDA
#define BOT_CLEANING 7 //! cleaning (cleanbots)
#define BOT_REPAIRING 8 //! repairing hull breaches (floorbots)
#define BOT_MOVING 9 //! for clean/floor/med bots, when moving.
#define BOT_HEALING 10 //! healing people (medbots)
#define BOT_RESPONDING 11 //! responding to a call from the AI
#define BOT_DELIVER 12 //! moving to deliver
#define BOT_GO_HOME 13 //! returning to home
#define BOT_BLOCKED 14 //! blocked
#define BOT_NAV 15 //! computing navigation
#define BOT_WAIT_FOR_NAV 16 //! waiting for nav computation
#define BOT_NO_ROUTE 17 //! no destination beacon found (or no route)
/// Idle
#define BOT_IDLE 0
/// Found target, hunting
#define BOT_HUNT 1
/// Currently tipped over.
#define BOT_TIPPED 2
/// Start patrol
#define BOT_START_PATROL 3
/// Patrolling
#define BOT_PATROL 4
/// Summoned to a location
#define BOT_SUMMON 5
/// Currently moving
#define BOT_MOVING 6
/// Secbot - At target, preparing to arrest
#define BOT_PREP_ARREST 7
/// Secbot - Arresting target
#define BOT_ARREST 8

//Bot types
#define SEC_BOT (1<<0) //! Secutritrons (Beepsky) and ED-209s
#define MULE_BOT (1<<1) //! MULEbots
#define FLOOR_BOT (1<<2) //! Floorbots
#define CLEAN_BOT (1<<3) //! Cleanbots
#define MED_BOT (1<<4) //! Medibots
#define HONK_BOT (1<<5) //! Honkbots & ED-Honks
#define FIRE_BOT (1<<6) //! Firebots
/// Cleanbot - Cleaning
#define BOT_CLEANING 9
/// Hygienebot - Cleaning unhygienic humans
//#define BOT_SHOWERSTANCE 10
/// Floorbots - Repairing hull breaches
#define BOT_REPAIRING 11
/// Medibots - Healing people
#define BOT_HEALING 12
/// Responding to a call from the AI
#define BOT_RESPONDING 13
/// MULEbot - Moving to deliver
#define BOT_DELIVER 14
/// MULEbot - Returning to home
#define BOT_GO_HOME 15
/// MULEbot - Blocked
#define BOT_BLOCKED 16
/// MULEbot - Computing navigation
#define BOT_NAV 17
/// MULEbot - Waiting for nav computation
#define BOT_WAIT_FOR_NAV 18
/// MULEbot - No destination beacon found (or no route)
#define BOT_NO_ROUTE 19

//SecBOT defines on arresting
///Whether arrests should be broadcasted over the Security radio
#define SECBOT_DECLARE_ARRESTS (1<<0)
///Will arrest people who lack an ID card
#define SECBOT_CHECK_IDS (1<<1)
///Will check for weapons, taking Weapons access into account
#define SECBOT_CHECK_WEAPONS (1<<2)
///Will check Security record on whether to arrest
#define SECBOT_CHECK_RECORDS (1<<3)
///Whether we will stun & cuff or endlessly stun
#define SECBOT_HANDCUFF_TARGET (1<<4)

//transfer_ai() defines. Main proc in ai_core.dm
///Downloading AI to InteliCard
Expand All @@ -46,15 +157,13 @@
#define AI_MECH_HACK 3

//AI notification defines
#define NEW_BORG 1
#define NEW_MODULE 2
#define RENAME 3
#define AI_SHELL 4
#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
///Alert when a new Cyborg is created.
#define NEW_BORG 1
///Alert when a Cyborg selects a model.
#define NEW_MODULE 2
///Alert when a Cyborg changes their name.
#define RENAME 3
///Alert when an AI disconnects themselves from their shell.
#define AI_SHELL 4
///Alert when a Cyborg gets disconnected from their AI.
#define DISCONNECT 5
Comment on lines +160 to +169
Copy link
Contributor

Choose a reason for hiding this comment

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

Aren't these deprecated now?

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
8 changes: 0 additions & 8 deletions code/datums/ai_laws.dm
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
#define LAW_VALENTINES "valentines"
#define LAW_DEVIL "devil"
#define LAW_ZEROTH "zeroth"
#define LAW_INHERENT "inherent"
#define LAW_SUPPLIED "supplied"
#define LAW_ION "ion"
#define LAW_HACKED "hacked"


/datum/ai_laws
var/name = "Unknown Laws"
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
6 changes: 3 additions & 3 deletions code/datums/wires/robot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@
new_ai = select_active_ai(user)
else
new_ai = select_active_ai(R)
R.notify_ai(DISCONNECT)
R.notify_ai(AI_NOTIFICATION_CYBORG_DISCONNECTED)
if(new_ai && (new_ai != R.connected_ai))
log_combat(usr, R, "synced cyborg [R.connected_ai ? "from [ADMIN_LOOKUP(R.connected_ai)]": "false"] to [ADMIN_LOOKUP(new_ai)]")
R.connected_ai = new_ai
if(R.shell)
R.undeploy() //If this borg is an AI shell, disconnect the controlling AI and assign ti to a new AI
R.notify_ai(AI_SHELL)
R.notify_ai(AI_NOTIFICATION_AI_SHELL)
else
R.notify_ai(TRUE)
if(WIRE_CAMERA) // Pulse to disable the camera.
Expand Down Expand Up @@ -71,7 +71,7 @@
switch(wire)
if(WIRE_AI) // Cut the AI wire to reset AI control.
if(!mend)
R.notify_ai(DISCONNECT)
R.notify_ai(AI_NOTIFICATION_AI_SHELL)
log_combat(usr, R, "cut AI wire on cyborg[R.connected_ai ? " and disconnected from [ADMIN_LOOKUP(R.connected_ai)]": ""]")
if(R.shell)
R.undeploy()
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/transformer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,4 @@
sleep(30)
if(R)
R.SetLockdown(FALSE)
R.notify_ai(NEW_BORG)
R.notify_ai(AI_NOTIFICATION_NEW_BORG)
6 changes: 3 additions & 3 deletions code/game/objects/buckling.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
if(user_unbuckle_mob(buckled_mobs[1],user))
return TRUE

/atom/movable/attackby(obj/item/W, mob/user, params)
if(!can_buckle || !istype(W, /obj/item/riding_offhand) || !user.Adjacent(src))
/atom/movable/attackby(obj/item/attacking_item, mob/user, params)
if(!can_buckle || !istype(attacking_item, /obj/item/riding_offhand) || !user.Adjacent(src))
return ..()

var/obj/item/riding_offhand/riding_item = W
var/obj/item/riding_offhand/riding_item = attacking_item
var/mob/living/carried_mob = riding_item.rider
if(carried_mob == user) //Piggyback user.
return
Expand Down
Loading