Skip to content

Commit

Permalink
fixes borgs linking to ais in mechs cards and modsuits (tgstation#87737)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fikou authored Nov 8, 2024
1 parent d131084 commit 438b16b
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 22 deletions.
3 changes: 2 additions & 1 deletion code/__HELPERS/level_traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ GLOBAL_VAR(station_level_z_scratch)
// Called a lot, somewhat slow, so has its own cache
#define is_station_level(z_level) \
( \
(z_level) && \
(z_level) && ( \
( \
/* The right hand side of this guarantees that we'll have the space to fill later on, while also not failing the condition */ \
(GLOB.station_levels_cache.len < (GLOB.station_level_z_scratch = (z_level)) && (GLOB.station_levels_cache.len = GLOB.station_level_z_scratch)) \
|| isnull(GLOB.station_levels_cache[GLOB.station_level_z_scratch]) \
) \
? (GLOB.station_levels_cache[GLOB.station_level_z_scratch] = !!SSmapping.level_trait(GLOB.station_level_z_scratch, ZTRAIT_STATION)) \
: GLOB.station_levels_cache[GLOB.station_level_z_scratch] \
) \
)

#define is_mining_level(z) SSmapping.level_trait(z, ZTRAIT_MINING)
Expand Down
9 changes: 4 additions & 5 deletions code/__HELPERS/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ GLOBAL_LIST_INIT(skin_tone_names, list(
. += borg

//Returns a list of AI's
/proc/active_ais(check_mind=FALSE, z = null, skip_syndicate, only_syndicate)
/proc/active_ais(check_mind = FALSE, z = null, skip_syndicate = FALSE, only_syndicate = FALSE)
. = list()
for(var/mob/living/silicon/ai/ai as anything in GLOB.ai_list)
if(ai.stat == DEAD)
Expand All @@ -501,10 +501,9 @@ GLOBAL_LIST_INIT(skin_tone_names, list(
continue
if(only_syndicate && !syndie_ai)
continue
if(check_mind)
if(!ai.mind)
continue
if(z && !(z == ai.z) && (!is_station_level(z) || !is_station_level(ai.z))) //if a Z level was specified, AND the AI is not on the same level, AND either is off the station...
if(check_mind && !ai.mind)
continue
if(!isnull(z) && z != ai.z && (!is_station_level(z) || !is_station_level(ai.z))) //if a Z level was specified, AND the AI is not on the same level, AND either is off the station...
continue
. += ai

Expand Down
8 changes: 4 additions & 4 deletions code/modules/mob/living/carbon/alien/alien.dm
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ Des: Removes all infected images from the alien.
)

new_xeno.setDir(dir)
new_xeno.change_name(name, real_name, numba)
new_xeno.change_name(name, real_name, identifier)

if(mind)
mind.name = new_xeno.real_name
Expand All @@ -153,7 +153,7 @@ Des: Removes all infected images from the alien.
qdel(src)

/// Changes the name of the xeno we are evolving into in order to keep the same numerical identifier the old xeno had.
/mob/living/carbon/alien/proc/change_name(old_name, old_real_name, old_number)
/mob/living/carbon/alien/proc/change_name(old_name, old_real_name, old_identifier)
if(!alien_name_regex.Find(old_name)) // check to make sure there's no admins doing funny stuff with naming these aliens
name = old_name
real_name = old_real_name
Expand All @@ -162,8 +162,8 @@ Des: Removes all infected images from the alien.
if(!unique_name)
return

if(old_number != 0)
numba = old_number
if(old_identifier != 0)
identifier = old_identifier
name = initial(name) // prevent chicanery like two different numerical identifiers tied to the same mob

set_name()
Expand Down
6 changes: 3 additions & 3 deletions code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1961,9 +1961,9 @@ GLOBAL_LIST_EMPTY(fire_appearances)
user.put_in_hands(holder)

/mob/living/proc/set_name()
if(numba == 0)
numba = rand(1, 1000)
name = "[name] ([numba])"
if(identifier == 0)
identifier = rand(1, 999)
name = "[name] ([identifier])"
real_name = name

/mob/living/proc/mob_try_pickup(mob/living/user, instant=FALSE)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/living_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
///if a mob's name should be appended with an id when created e.g. Mob (666)
var/unique_name = FALSE
///the id a mob gets when it's created
var/numba = 0
var/identifier = 0

///these will be yielded from butchering with a probability chance equal to the butcher item's effectiveness
var/list/butcher_results = null
Expand Down
13 changes: 7 additions & 6 deletions code/modules/mob/living/silicon/robot/robot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
inv2 = new /atom/movable/screen/robot/module2()
inv3 = new /atom/movable/screen/robot/module3()

ident = rand(1, 999)

previous_health = health

if(ispath(cell))
Expand Down Expand Up @@ -184,6 +182,9 @@

model.transform_to(model_list[input_model])

/mob/living/silicon/robot/set_name() //we have our name-making proc to call after we make our mmi, just set identifier here
if(identifier == 0)
identifier = rand(1, 999)

/// Used to setup the a basic and (somewhat) unique name for the robot.
/mob/living/silicon/robot/proc/setup_default_name()
Expand Down Expand Up @@ -219,7 +220,7 @@


/mob/living/silicon/robot/proc/get_standard_name()
return "[(designation ? "[designation] " : "")][mmi.braintype]-[ident]"
return "[(designation ? "[designation] " : "")][mmi.braintype]-[identifier]"

/mob/living/silicon/robot/proc/ionpulse()
if(!ionpulse_on)
Expand Down Expand Up @@ -842,7 +843,7 @@

shell = TRUE
braintype = "AI Shell"
name = "Empty AI Shell-[ident]"
name = "Empty AI Shell-[identifier]"
real_name = name
GLOB.available_ai_shells |= src
if(!QDELETED(builtInCamera))
Expand All @@ -861,7 +862,7 @@
qdel(boris)
shell = FALSE
GLOB.available_ai_shells -= src
name = "Unformatted Cyborg-[ident]"
name = "Unformatted Cyborg-[identifier]"
real_name = name
if(!QDELETED(builtInCamera))
builtInCamera.c_tag = real_name
Expand All @@ -874,7 +875,7 @@
* * AI - AI unit that initiated the deployment into the AI shell
*/
/mob/living/silicon/robot/proc/deploy_init(mob/living/silicon/ai/AI)
real_name = "[AI.real_name] [designation] Shell-[ident]"
real_name = "[AI.real_name] [designation] Shell-[identifier]"
name = real_name
if(!QDELETED(builtInCamera))
builtInCamera.c_tag = real_name //update the camera name too
Expand Down
3 changes: 1 addition & 2 deletions code/modules/mob/living/silicon/robot/robot_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
designation = "Default" //used for displaying the prefix & getting the current model of cyborg
has_limbs = TRUE
hud_type = /datum/hud/robot
unique_name = TRUE

///Represents the cyborg's model (engineering, medical, etc.)
var/obj/item/robot_model/model = null
Expand Down Expand Up @@ -110,8 +111,6 @@
var/ai_lockdown = FALSE
///Timer that allows the borg to self-unlock after a set amount of time
var/lockdown_timer = null
///Random serial number generated for each cyborg upon its initialization
var/ident = 0
var/locked = TRUE
req_one_access = list(ACCESS_ROBOTICS)

Expand Down

0 comments on commit 438b16b

Please sign in to comment.