Skip to content

Commit

Permalink
[MIRROR] Port of "Fix niche bitrunner avatar name bug and make net av…
Browse files Browse the repository at this point in the history
…atar ID take on avatar name" (but without TGS DMAPI) (#5186)

* Port of "Fix niche bitrunner avatar name bug and make net avatar ID take on avatar name" (but without TGS DMAPI) (#4613)

Update avatar_connection.dm

* [MIRROR] Port of "Fix niche bitrunner avatar name bug and make net avatar ID take on avatar name" (but without TGS DMAPI)

---------

Co-authored-by: Stalkeros <[email protected]>
Co-authored-by: StealsThePRs <[email protected]>
  • Loading branch information
3 people authored Nov 21, 2024
1 parent 418c08a commit 00a1edc
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion code/modules/bitrunning/components/avatar_connection.dm
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@
var/alias = our_client?.prefs?.read_preference(/datum/preference/name/hacker_alias) || pick(GLOB.hacker_aliases)

if(alias && avatar.real_name != alias)
avatar.fully_replace_character_name(avatar.real_name, alias)
avatar.fully_replace_character_name(newname = alias)

update_avatar_id()

for(var/skill_type in old_mind.known_skills)
avatar.mind.set_experience(skill_type, old_mind.get_skill_exp(skill_type), silent = TRUE)
Expand Down Expand Up @@ -111,6 +113,20 @@
))


/// Updates our avatar's ID to match our avatar's name.
/datum/component/avatar_connection/proc/update_avatar_id()
var/mob/living/avatar = parent
var/obj/item/card/id/our_id = locate() in avatar.get_all_contents()
if(isnull(our_id))
return

our_id.registered_name = avatar.real_name
our_id.update_label()
our_id.update_icon()
if(our_id.registered_account)
our_id.registered_account.account_holder = avatar.real_name


/// Disconnects the avatar and returns the mind to the old_body.
/datum/component/avatar_connection/proc/full_avatar_disconnect(cause_damage = FALSE, datum/source)
#ifndef UNIT_TESTS
Expand Down

0 comments on commit 00a1edc

Please sign in to comment.