Skip to content

Commit

Permalink
Merge pull request #4682 from out-of-phaze/codequality/mind-unoriginal
Browse files Browse the repository at this point in the history
Remove mind.original
  • Loading branch information
MistakeNot4892 authored Jan 2, 2025
2 parents 105aee6 + f092387 commit 34a0976
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 37 deletions.
6 changes: 1 addition & 5 deletions code/datums/communication/dsay.dm
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,8 @@

keyname = C.key
if(C.mob) //Most of the time this is the dead/observer mob; we can totally use him if there is no better name
var/mindname
var/mindname = C.mob.mind?.name // the mind's "original name"
var/realname = C.mob.real_name
if(C.mob.mind)
mindname = C.mob.mind.name
if(C.mob.mind.original && C.mob.mind.original.real_name)
realname = C.mob.mind.original.real_name
if(mindname && mindname != realname)
name = "[realname] died as [mindname]"
else
Expand Down
8 changes: 0 additions & 8 deletions code/datums/mind/mind.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
var/key
var/name //replaces mob/var/original_name
var/mob/living/current
var/mob/living/original //TODO: remove.not used in any meaningful way ~Carn. First I'll need to tweak the way silicon-mobs handle minds.
var/active = 0

var/gen_relations_info
Expand Down Expand Up @@ -71,18 +70,12 @@
if(current?.mind == src)
current.mind = null
current = null
if(original?.mind == src)
original.mind = null
original = null
. = ..()

/datum/mind/proc/handle_mob_deletion(mob/living/deleted_mob)
if (current == deleted_mob)
current = null

if (original == deleted_mob)
original = null

/datum/mind/proc/transfer_to(mob/living/new_character)
if(!istype(new_character))
to_world_log("## DEBUG: transfer_to(): Some idiot has tried to transfer_to() a non mob/living mob. Please inform Carn")
Expand Down Expand Up @@ -505,7 +498,6 @@
mind.key = key
else
mind = new /datum/mind(key)
mind.original = src
SSticker.minds += mind
if(!mind.name) mind.name = real_name
mind.current = src
Expand Down
1 change: 0 additions & 1 deletion code/game/antagonist/antagonist_update.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
player.current = new mob_path(get_turf(player.current))
player.transfer_to(player.current)
if(holder) qdel(holder)
player.original = player.current
if(!preserve_appearance && (flags & ANTAG_SET_APPEARANCE))
spawn(3)
var/mob/living/human/H = player.current
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/game_mode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ var/global/list/additional_antag_types = list()

continue //Happy connected client
for(var/mob/observer/ghost/D in SSmobs.mob_list)
if(D.mind && (D.mind.original == L || D.mind.current == L))
if(D.mind && D.mind.current == L)
if(L.stat == DEAD)
msg += "<b>[L.name]</b> ([ckey(D.mind.key)]), the [L.job] (Dead)\n"
continue //Dead mob, ghost abandoned
Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/computer/message.dm
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
dat += "<dd><A href='byond://?src=\ref[src];pass=1'>&#09;[++i]. Set Custom Key</a><br></dd>"
else
dat += "<br><hr><dd><span class='notice'>Please authenticate with the server in order to show additional options.</span>"
if((isAI(user) || isrobot(user)) && (user.mind.assigned_special_role && user.mind.original == user))
if((isAI(user) || isrobot(user)) && player_is_antag(user.mind))
//Malf/Traitor AIs can bruteforce into the system to gain the Key.
dat += "<dd><A href='byond://?src=\ref[src];hack=1'><i><font color='Red'>*&@#. Bruteforce Key</font></i></font></a></dd>"

Expand Down Expand Up @@ -283,7 +283,7 @@

//Hack the Console to get the password
if (href_list["hack"])
if((isAI(usr) || isrobot(usr)) && usr.mind.assigned_special_role && usr.mind.original == usr)
if((isAI(usr) || isrobot(usr)) && player_is_antag(usr.mind))
src.hacking = 1
src.screen = 2
update_icon()
Expand Down
8 changes: 4 additions & 4 deletions code/game/machinery/computer/robot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
return TOPIC_HANDLED

// Antag AI checks
if(!isAI(user) || !(user.mind.assigned_special_role && user.mind.original == user))
if(!isAI(user) || !player_is_antag(user.mind))
to_chat(user, "<span class='warning'>Access Denied</span>")
return TOPIC_HANDLED

Expand Down Expand Up @@ -103,9 +103,9 @@
. = TOPIC_REFRESH

// Proc: get_cyborgs()
// Parameters: 1 (operator - mob which is operating the console.)
// Parameters: 1 (user - mob which is operating the console.)
// Description: Returns NanoUI-friendly list of accessible cyborgs.
/obj/machinery/computer/robotics/proc/get_cyborgs(var/mob/operator)
/obj/machinery/computer/robotics/proc/get_cyborgs(var/mob/user)
var/list/robots = list()

for(var/mob/living/silicon/robot/R in global.silicon_mob_list)
Expand Down Expand Up @@ -145,7 +145,7 @@
robot["master_ai"] = R.connected_ai ? R.connected_ai.name : "None"
robot["hackable"] = 0
// Antag AIs know whether linked cyborgs are hacked or not.
if(operator && isAI(operator) && (R.connected_ai == operator) && (operator.mind.assigned_special_role && operator.mind.original == operator))
if(user && isAI(user) && (R.connected_ai == user) && player_is_antag(user.mind))
robot["hacked"] = R.emagged ? 1 : 0
robot["hackable"] = R.emagged? 0 : 1
robots.Add(list(robot))
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/items/robot/robot_frame.dm
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
O.custom_name = created_name
O.updatename("Default")

clear_antag_roles(brainmob.mind, implanted = TRUE) // some antag roles persist
brainmob.mind.transfer_to(O)
if(O.mind && O.mind.assigned_role)
O.job = O.mind.assigned_role
Expand Down
7 changes: 5 additions & 2 deletions code/modules/mob/living/silicon/robot/laws.dm
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@
var/datum/ai_laws/master = connected_ai && lawupdate ? connected_ai.laws : null
if (master)
master.sync(src)
..()
return
. = ..()
// if we aren't malfunctioning and we have a law 0, it's presumably shared
// if we are malfunctioning and we don't have a law 0, we don't need to worry about this
if(connected_ai && is_malfunctioning() && has_zeroth_law())
to_chat(src, SPAN_BOLD("Remember, your AI does NOT share or know about your law 0."))

/mob/living/silicon/robot/proc/robot_checklaws()
set category = "Silicon Commands"
Expand Down
2 changes: 0 additions & 2 deletions code/modules/mob/mob_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,6 @@ var/global/list/global/organ_rel_size = list(
var/datum/mind/M = O
if(M.current && M.current.client)
C = M.current.client
else if(M.original && M.original.client)
C = M.original.client

if(C)
if(C.get_preference_value(/datum/client_preference/anon_say) == PREF_YES)
Expand Down
1 change: 0 additions & 1 deletion code/modules/mob/new_player/new_player.dm
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,6 @@ INITIALIZE_IMMEDIATE(/mob/new_player)

if(mind)
mind.active = 0 //we wish to transfer the key manually
mind.original = new_character
var/memory = client.prefs.records[PREF_MEM_RECORD]
if(memory)
mind.StoreMemory(memory)
Expand Down
2 changes: 0 additions & 2 deletions code/modules/mob/transform_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
O.aiRestorePowerRoutine = 0
if(mind)
mind.transfer_to(O)
O.mind.original = O
else
O.key = key

Expand Down Expand Up @@ -128,7 +127,6 @@
mind.active = TRUE
mind.transfer_to(O)
if(O.mind && O.mind.assigned_role == ASSIGNMENT_ROBOT)
O.mind.original = O
var/mmi_type = SSrobots.get_brain_type_by_title(O.mind.role_alt_title ? O.mind.role_alt_title : O.mind.assigned_role)
if(mmi_type)
O.central_processor = new mmi_type(O)
Expand Down
10 changes: 2 additions & 8 deletions mods/gamemodes/traitor/overrides.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,12 @@
return mind && traitors.is_antagonist(mind)

/mob/living/silicon/robot/show_master(mob/who)
// TODO: Update to new antagonist system.
if (mind?.assigned_special_role == /decl/special_role/traitor && mind.original == src && connected_ai)
var/decl/special_role/traitor/traitor_role = IMPLIED_DECL
if(traitor_role.is_antagonist(mind) && connected_ai)
to_chat(who, "<b>Remember, [connected_ai.name] is technically your master, but your objective comes first.</b>")
return
return ..()

/mob/living/silicon/robot/lawsync()
. = ..()
// TODO: Update to new antagonist system.
if(mind?.assigned_special_role == /decl/special_role/traitor && mind.original == src)
to_chat(src, SPAN_BOLD("Remember, your AI does NOT share or know about your law 0."))

/mob/living/silicon/robot/handle_regular_hud_updates()
. = ..()
if(!.)
Expand Down
2 changes: 1 addition & 1 deletion mods/species/vox/datum/heist_compatibility.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

var/decl/species/my_species = user?.get_species()
var/decl/special_role/raider/raiders = GET_DECL(/decl/special_role/raider)
if(!istype(user) || !user.mind || !user.mind.assigned_special_role != raiders || !my_species || my_species.name == SPECIES_VOX || !is_alien_whitelisted(user, SPECIES_VOX))
if(!istype(user) || !user.mind || !raiders.is_antagonist(user.mind) || !my_species || my_species.name == SPECIES_VOX || !is_alien_whitelisted(user, SPECIES_VOX))
return ..()

var/choice = input("Do you wish to become a vox of the Shoal? This is not reversible.") as null|anything in list("No","Yes")
Expand Down

0 comments on commit 34a0976

Please sign in to comment.