Skip to content

Commit

Permalink
tweak(synthetics): multiple bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Doster-d committed Oct 26, 2023
1 parent 5cf7b67 commit 6344a7d
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 31 deletions.
51 changes: 22 additions & 29 deletions code/_helpers/roundend.dm
Original file line number Diff line number Diff line change
Expand Up @@ -91,39 +91,32 @@ GLOBAL_LIST_EMPTY(common_report)
var/list/parts = list()
var/borg_spacer = FALSE //inserts an extra linebreak to seperate AIs from independent borgs, and then multiple independent borgs.
//Silicon laws report
for (var/mob/living/silicon/ai/aiPlayer in SSmobs.mob_list)
if (!aiPlayer.is_ooc_dead())
parts += "<b>[aiPlayer.name] (Played by: [aiPlayer.key])'s laws at the end of the round were:</b>"
else
parts += "<b>[aiPlayer.name] (Played by: [aiPlayer.key])'s laws when it was deactivated were:</b>"


parts += aiPlayer.laws?.print_laws()

if (aiPlayer.connected_robots.len)
parts += "<b>The AI's loyal minions were:</b> "
for(var/mob/living/silicon/robot/robo in aiPlayer.connected_robots)
parts += "[robo.name][robo.stat?" (Deactivated) (Played by: [robo.key]), ":" (Played by: [robo.key]), "]"

if(!borg_spacer)
borg_spacer = TRUE

var/dronecount = 0

for (var/mob/living/silicon/robot/robo in SSmobs.mob_list)

if(istype(robo,/mob/living/silicon/robot/drone))
for(var/datum/mind/M in GLOB.all_synthetic_mind_to_data)
var/list/data = GLOB.all_synthetic_mind_to_data[M]
var/weakref/silicon_ref = data[3]
var/mob/living/silicon/ai/S = silicon_ref?.resolve()
if(data[2] in typesof(/mob/living/silicon/ai))
if(S && !S?.is_ooc_dead())
parts += "<b>[data[1]] (Played by: [M.key])'s laws at the end of the round were:</b>"
else
parts += "<b>[data[1]] (Played by: [M.key])'s laws when it was deactivated were:</b>"
parts += S?.laws?.print_laws() ? S?.laws?.print_laws() : data[4]
if(!borg_spacer)
borg_spacer = TRUE
else if(data[2] in typesof(/mob/living/silicon/robot/drone))
dronecount++
continue
else if(data[2] in typesof(/mob/living/silicon/robot))
var/mob/living/silicon/robot/robo = silicon_ref?.resolve()
if (!robo.connected_ai)
parts += "[borg_spacer?"<br>":""]<b>[data[1]]</b> (Played by: <b>[M.key]</b>) [(!robo || robo?.is_ooc_dead()) ? "was <span class='redtext'>unable to survive</span> the rigors of being a cyborg." : "<span class='greentext'>survived</span> as borg!"]\
It was [robo?.connected_ai ? "[robo?.connected_ai.name]'s loyal minion" : "AI-less, independent machine"]. Its laws were:"

if (!robo.connected_ai)
parts += "[borg_spacer?"<br>":""]<b>[robo.name]</b> (Played by: <b>[robo.mind.key]</b>) [(!robo.is_ooc_dead())? "<span class='greentext'>survived</span> as an AI-less borg!" : "was <span class='redtext'>unable to survive</span> the rigors of being a cyborg without an AI."] Its laws were:"
if(robo) //How the hell do we lose robo between here and the world messages directly above this?
parts += robo.laws?.print_laws()

if(robo) //How the hell do we lose robo between here and the world messages directly above this?
parts += robo.laws?.print_laws()

if(!borg_spacer)
borg_spacer = TRUE
if(!borg_spacer)
borg_spacer = TRUE

if(dronecount)
parts += "[borg_spacer?"<br>":""]<b>There [dronecount>1 ? "were" : "was"] [dronecount] industrious maintenance [dronecount>1 ? "drones" : "drone"] at the end of this round.</b>"
Expand Down
7 changes: 7 additions & 0 deletions code/game/antagonist/station/traitor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ GLOBAL_DATUM_INIT(traitors, /datum/antagonist/traitor, new)
return 1

/datum/antagonist/traitor/get_special_objective_text(datum/mind/player)
var/detected = FALSE
for(var/datum/objective/objective in player.objectives)
if(istype(objective, /datum/objective/contracts))
detected = TRUE
break
if(!detected)
return
var/contracts_num = player.completed_contracts
if(!contracts_num)
return "<br>The traitor hasn't completed a single contract. <b>[pick("What a shame", "Loser", "Sorry sight", "Lame duck", "Schlimazel", "Pantywaist", "We will talk about it later")].</b>"
Expand Down
2 changes: 2 additions & 0 deletions code/modules/mob/living/silicon/ai/ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ var/list/ai_verbs_default = list(
..()
ai_radio = silicon_radio
ai_radio.myAi = src
GLOB.all_synthetic_mind_to_data[mind] = list(name, type, weakref(src), laws?.print_laws())

/mob/living/silicon/ai/proc/on_mob_init()
to_chat(src, "<B>You are playing the [station_name()]'s AI. The AI cannot move, but can interact with many objects while viewing them (through cameras).</B>")
Expand Down Expand Up @@ -209,6 +210,7 @@ var/list/ai_verbs_default = list(
eyeobj.possess(src)

/mob/living/silicon/ai/Destroy()
GLOB.all_synthetic_mind_to_data[mind] = list(name, type, weakref(null), laws?.print_laws())
for(var/robot in connected_robots)
var/mob/living/silicon/robot/S = robot
S.connected_ai = null
Expand Down
4 changes: 3 additions & 1 deletion code/modules/mob/living/silicon/robot/robot_upgrades.dm
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,10 @@
/obj/item/borg/upgrade/rename/action(mob/living/silicon/robot/R)
if(..()) return 0
spawn(1)
if (held_name == initial(held_name))
while(held_name == initial(held_name))
held_name = sanitizeSafe(input(R, "Enter new robot name", "Robot Reclassification", held_name), MAX_NAME_LEN)
if(!held_name)
held_name = initial(held_name)
R.notify_ai(ROBOT_NOTIFICATION_NEW_NAME, R.name, held_name)
R.SetName(held_name)
R.custom_name = held_name
Expand Down
11 changes: 10 additions & 1 deletion code/modules/mob/living/silicon/silicon.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

GLOBAL_LIST_EMPTY(all_synthetic_mind_to_data) // data: list of name and type of synthetic

/mob/living/silicon
gender = NEUTER
Expand Down Expand Up @@ -63,6 +63,15 @@
AH.unregister_alarm(src)
return ..()

/mob/living/silicon/mind_initialize()
. = ..()
GLOB.all_synthetic_mind_to_data[mind] = list(name, type, weakref(src))

/mob/living/silicon/SetName(new_name)
. = ..()
if(mind)
GLOB.all_synthetic_mind_to_data[mind][1] = name

/mob/living/silicon/fully_replace_character_name(new_name)
..()
if(istype(idcard))
Expand Down

0 comments on commit 6344a7d

Please sign in to comment.