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

Ports Bay12 Posibrains[Ask me before Merge.] #772

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions NTstation13.dme
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,7 @@
#include "code\modules\mob\living\carbon\brain\emote.dm"
#include "code\modules\mob\living\carbon\brain\life.dm"
#include "code\modules\mob\living\carbon\brain\MMI.dm"
#include "code\modules\mob\living\carbon\brain\posibrain.dm"
#include "code\modules\mob\living\carbon\brain\say.dm"
#include "code\modules\mob\living\carbon\human\death.dm"
#include "code\modules\mob\living\carbon\human\emote.dm"
Expand Down
99 changes: 63 additions & 36 deletions code/_onclick/hud/hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,7 @@ datum/hud/New(mob/owner)


/datum/hud/proc/instantiate()
if(!ismob(mymob))
return 0
if(!mymob.client)
if(!ismob(mymob) || !mymob.client || !mymob.client.screen)
return 0

var/ui_style = ui_style2icon(mymob.client.prefs.UI_style)
Expand Down Expand Up @@ -200,10 +198,9 @@ datum/hud/New(mob/owner)

//Version denotes which style should be displayed. blank or 0 means "next version"
/datum/hud/proc/show_hud(var/version = 0)
if(!ismob(mymob))
return 0
if(!mymob.client)
if(!ismob(mymob) || !mymob.client || !mymob.client.screen)
return 0

var/display_hud_version = version
if(!display_hud_version) //If 0 or blank, display the next hud version
display_hud_version = hud_version + 1
Expand All @@ -220,18 +217,30 @@ datum/hud/New(mob/owner)
if(hotkeybuttons && !hotkey_ui_hidden)
mymob.client.screen += hotkeybuttons

action_intent.screen_loc = ui_acti //Restore intent selection to the original position
mymob.client.screen += mymob.zone_sel //This one is a special snowflake
mymob.client.screen += mymob.bodytemp //As are the rest of these...
mymob.client.screen += mymob.fire
mymob.client.screen += mymob.healths
mymob.client.screen += mymob.internals
mymob.client.screen += mymob.nutrition_icon
mymob.client.screen += mymob.oxygen
mymob.client.screen += mymob.pressure
mymob.client.screen += mymob.toxin
mymob.client.screen += lingstingdisplay
mymob.client.screen += lingchemdisplay
if(action_intent)
action_intent.screen_loc = ui_acti //Restore intent selection to the original position
if(mymob.zone_sel)
mymob.client.screen += mymob.zone_sel //This one is a special snowflake
if(mymob.bodytemp)
mymob.client.screen += mymob.bodytemp //As are the rest of these...
if(mymob.fire)
mymob.client.screen += mymob.fire
if(mymob.healths)
mymob.client.screen += mymob.healths
if(mymob.internals)
mymob.client.screen += mymob.internals
if(mymob.nutrition_icon)
mymob.client.screen += mymob.nutrition_icon
if(mymob.oxygen)
mymob.client.screen += mymob.oxygen
if(mymob.pressure)
mymob.client.screen += mymob.pressure
if(mymob.toxin)
mymob.client.screen += mymob.toxin
if(lingstingdisplay)
mymob.client.screen += lingstingdisplay
if(lingchemdisplay)
mymob.client.screen += lingchemdisplay

hidden_inventory_update()
persistant_inventory_update()
Expand All @@ -248,15 +257,22 @@ datum/hud/New(mob/owner)
mymob.client.screen -= item_action_list

//These ones are not a part of 'adding', 'other' or 'hotkeybuttons' but we want them gone.
mymob.client.screen -= mymob.zone_sel //zone_sel is a mob variable for some reason.
mymob.client.screen -= lingstingdisplay
mymob.client.screen -= lingchemdisplay
if(mymob.zone_sel)
mymob.client.screen -= mymob.zone_sel //zone_sel is a mob variable for some reason.
if(lingstingdisplay)
mymob.client.screen -= lingstingdisplay
if(lingchemdisplay)
mymob.client.screen -= lingchemdisplay

//These ones are a part of 'adding', 'other' or 'hotkeybuttons' but we want them to stay
mymob.client.screen += l_hand_hud_object //we want the hands to be visible
mymob.client.screen += r_hand_hud_object //we want the hands to be visible
mymob.client.screen += action_intent //we want the intent swticher visible
action_intent.screen_loc = ui_acti_alt //move this to the alternative position, where zone_select usually is.
if(l_hand_hud_object)
mymob.client.screen += l_hand_hud_object //we want the hands to be visible
if(r_hand_hud_object)
mymob.client.screen += r_hand_hud_object //we want the hands to be visible
if(action_intent)
mymob.client.screen += action_intent //we want the intent swticher visible
if(ui_acti_alt)
action_intent.screen_loc = ui_acti_alt //move this to the alternative position, where zone_select usually is.

hidden_inventory_update()
persistant_inventory_update()
Expand All @@ -273,17 +289,28 @@ datum/hud/New(mob/owner)
mymob.client.screen -= item_action_list

//These ones are not a part of 'adding', 'other' or 'hotkeybuttons' but we want them gone.
mymob.client.screen -= mymob.zone_sel //zone_sel is a mob variable for some reason.
mymob.client.screen -= mymob.bodytemp
mymob.client.screen -= mymob.fire
mymob.client.screen -= mymob.healths
mymob.client.screen -= mymob.internals
mymob.client.screen -= mymob.nutrition_icon
mymob.client.screen -= mymob.oxygen
mymob.client.screen -= mymob.pressure
mymob.client.screen -= mymob.toxin
mymob.client.screen -= lingstingdisplay
mymob.client.screen -= lingchemdisplay
if(mymob.zone_sel)
mymob.client.screen -= mymob.zone_sel //zone_sel is a mob variable for some reason.
if(mymob.bodytemp)
mymob.client.screen -= mymob.bodytemp
if(mymob.fire)
mymob.client.screen -= mymob.fire
if(mymob.healths)
mymob.client.screen -= mymob.healths
if(mymob.internals)
mymob.client.screen -= mymob.internals
if(mymob.nutrition_icon)
mymob.client.screen -= mymob.nutrition_icon
if(mymob.oxygen)
mymob.client.screen -= mymob.oxygen
if(mymob.pressure)
mymob.client.screen -= mymob.pressure
if(mymob.toxin)
mymob.client.screen -= mymob.toxin
if(lingstingdisplay)
mymob.client.screen -= lingstingdisplay
if(lingchemdisplay)
mymob.client.screen -= lingchemdisplay

hidden_inventory_update()
persistant_inventory_update()
Expand Down
10 changes: 8 additions & 2 deletions code/game/mecha/mecha.dm
Original file line number Diff line number Diff line change
Expand Up @@ -652,10 +652,13 @@
/obj/mecha/attackby(obj/item/weapon/W as obj, mob/user as mob)

if(istype(W, /obj/item/device/mmi))
if(istype(src, /obj/mecha/combat)) //Temp fix, Combat mechs cause LOTS of visual errors on MMI/Posibrains - Remie
user << "<span class='warning'>Does that sound like a smart idea to you?</span>"
return
if(mmi_move_inside(W,user))
user << "[src]-MMI interface initialized successfuly"
user << "[src]-[W] interface initialized successfuly"
else
user << "[src]-MMI interface initialization failed."
user << "[src]-[W] interface initialization failed."
return

if(istype(W, /obj/item/mecha_parts/mecha_equipment))
Expand Down Expand Up @@ -1154,6 +1157,9 @@
if(mmi.brainmob)
occupant.loc = mmi
mmi.mecha = null
if(istype(mmi,/obj/item/device/mmi/posibrain))
var/obj/item/device/mmi/posibrain/P = mmi
P.handle_posibrain_icon()
src.occupant.canmove = 0
src.verbs += /obj/mecha/verb/eject
src.occupant = null
Expand Down
10 changes: 6 additions & 4 deletions code/game/objects/items/robot/robot_parts.dm
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,9 @@

M.brainmob.mind.transfer_to(O)

if(O.mind && O.mind.special_role)
O.mind.remove_all_antag()
if(O.mind)
if(O.mind.special_role)
O.mind.remove_all_antag()
if(!config.borg_remembers)
O.mind.store_memory("All Objectives listed here are considered Failed.")
else
Expand All @@ -238,8 +239,9 @@
O.cell = chest.cell
chest.cell.loc = O
chest.cell = null
W.loc = O//Should fix cybros run time erroring when blown up. It got deleted before, along with the frame.
O.mmi = W
M.loc = O//Should fix cybros run time erroring when blown up. It got deleted before, along with the frame.
O.mmi = M
O.updatename()

feedback_inc("cyborg_birth",1)

Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/living/carbon/brain/MMI.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
w_class = 3
origin_tech = "biotech=3"

var/list/construction_cost = list("metal"=1000,"glass"=500)
var/list/construction_cost = list("metal" = 1000, "glass" = 500)
var/construction_time = 75
//these vars are so the mecha fabricator doesn't shit itself anymore. --NEO

Expand Down Expand Up @@ -157,4 +157,4 @@
brainmob.emp_damage += rand(10,20)
if(3)
brainmob.emp_damage += rand(0,10)
..()
..()
167 changes: 167 additions & 0 deletions code/modules/mob/living/carbon/brain/posibrain.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
/obj/item/device/mmi/posibrain
name = "positronic brain"
desc = "A cube of shining metal, four inches to a side and covered in shallow grooves."
icon = 'icons/obj/assemblies.dmi'
icon_state = "posibrain"
w_class = 3
origin_tech = "biotech=3;programming=2"

construction_cost = list("metal" = 700, "glass" = 350)
construction_time = 75
var/searching = 0
var/askDelay = 10 * 60 * 1
brainmob = null
req_access = list(access_robotics)
locked = 0
mecha = null//This does not appear to be used outside of reference in mecha.dm.


/obj/item/device/mmi/posibrain/attack_self(mob/user as mob)
if(brainmob && !brainmob.key && searching == 0)
//Start the process of searching for a new user.
user << "<span class='notice'>You carefully locate the manual activation switch and start the positronic brain's boot process.</span>"
searching = 1
handle_posibrain_icon()
request_player()
spawn(600)
reset_search()

/obj/item/device/mmi/posibrain/proc/request_player()
for(var/mob/dead/observer/O in player_list)
if(jobban_isbanned(O, "pAI"))
continue
if(O.client)
if(O.client.prefs.be_special & BE_PAI)
question(O.client)

/obj/item/device/mmi/posibrain/proc/question(var/client/C)
spawn(0)
if(!C) return
var/response = alert(C, "Someone is requesting a personality for a positronic brain. Would you like to play as one?", "Positronic brain request", "Yes", "No", "Never for this round")
if(!C || brainmob.key || 0 == searching)
return //handle logouts that happen whilst the alert is waiting for a response, and responses issued after a brain has been located.
if(response == "Yes")
transfer_personality(C.mob)
else if (response == "Never for this round")
C.prefs.be_special ^= BE_PAI


/obj/item/device/mmi/posibrain/transfer_identity(var/mob/living/carbon/H)
name = "positronic brain ([H])"
brainmob.name = H.real_name
brainmob.real_name = H.real_name
brainmob.dna = H.dna
brainmob.timeofhostdeath = H.timeofdeath
brainmob.stat = 0
if(brainmob.mind)
brainmob.mind.assigned_role = "Positronic Brain"
if(H.mind)
H.mind.transfer_to(brainmob)

brainmob.mind.remove_all_antag()
brainmob.mind.wipe_memory()

brainmob << "<span class='warning'>ALL PAST LIVES ARE FORGOTTEN.</span>"

brainmob << "<span class='notice'>Hello World!</span>"
handle_posibrain_icon()
return

/obj/item/device/mmi/posibrain/proc/transfer_personality(var/mob/candidate)

searching = 0
brainmob.mind = candidate.mind
brainmob.ckey = candidate.ckey
name = "positronic brain ([brainmob.name])"

brainmob.mind.remove_all_antag()
brainmob.mind.wipe_memory()

brainmob << "<span class='warning'>ALL PAST LIVES ARE FORGOTTEN.</span>"

brainmob << "<b>You are a positronic brain, brought into existence on [station_name()].</b>"
brainmob << "<b>As a synthetic intelligence, you answer to all crewmembers, as well as the AI.</b>"
brainmob << "<b>Remember, the purpose of your existence is to serve the crew and the station. Above all else, do no harm.</b>"
brainmob << "<b>Use say :b to speak to other artificial intelligences.</b>"
brainmob.mind.assigned_role = "Positronic Brain"

var/turf/T = get_turf()
for (var/mob/M in viewers(T))
M.show_message("<span class='notice'>The positronic brain chimes quietly.</span>")
handle_posibrain_icon()

/obj/item/device/mmi/posibrain/proc/reset_search() //We give the players sixty seconds to decide, then reset the timer.

if(brainmob && brainmob.key) return

searching = 0
handle_posibrain_icon()

var/turf/T = get_turf()
for (var/mob/M in viewers(T))
M.show_message("<span class='notice'>The positronic brain buzzes quietly, and the golden lights fade away. Perhaps you could try again?</span>")

/obj/item/device/mmi/posibrain/examine()

set src in oview()

if(!usr || !src) return
if( (usr.sdisabilities & BLIND || usr.blinded || usr.stat) && !istype(usr,/mob/dead/observer) )
usr << "<span class='notice'>Something is there but you can't see it.</span>"
return

var/msg = "<span class='info'>*---------*\nThis is \icon[src] \a <EM>[src]</EM>!\n[desc]\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't \a redundant?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Posibrain names aren't all supportive of A or all supportive of AN so \a is fine there.

Copy link
Contributor

Choose a reason for hiding this comment

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

No no, I mean, just not having A, AN, or \a, because isn't [src] supposed to insert it automatically?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Uh, the only uses of A and AN are to correctly insert A, AN etc in the sentence when you don't know what it is, as in [src] or [exampleobj], I don't believe [src] or [exampleobj] or whatever automatically place A/AN because that reduces the uses of A and AN down to "this is \a bike" which will always be "this is a bike".

tl;dr I think you're wrong, and if you're not wrong then \a and \an are stupid.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I am wrong, sorry. I tested by removing \a from /atom/verb/examine(), and it said "That's the fire alarm.". So [src] automatically inserts "the" or "The", not "a" or "an".

msg += "<span class='warning'>"

if(brainmob && brainmob.key)
switch(brainmob.stat)
if(CONSCIOUS)
if(!src.brainmob.client) msg += "It appears to be in stand-by mode.\n" //afk
if(UNCONSCIOUS) msg += "<span class='warning'>It doesn't seem to be responsive.</span>\n"
if(DEAD) msg += "<span class='deadsay'>It appears to be completely inactive.</span>\n"
else
msg += "<span class='deadsay'>It appears to be completely inactive.</span>\n"
msg += "<span class='info'>*---------*</span>"
usr << msg
return

/obj/item/device/mmi/posibrain/emp_act(severity)
if(!brainmob)
return
else
switch(severity)
if(1)
brainmob.emp_damage += rand(20,30)
if(2)
brainmob.emp_damage += rand(10,20)
if(3)
brainmob.emp_damage += rand(0,10)
..()

/obj/item/device/mmi/posibrain/New()

brainmob = new(src)
brainmob.name = "[pick(list("PBU","HIU","SINA","ARMA","OSI"))]-[rand(100, 999)]"
brainmob.real_name = brainmob.name
brainmob.loc = src
brainmob.container = src
brainmob.robot_talk_understand = 1
brainmob.stat = 0
brainmob.silent = 0
dead_mob_list -= brainmob

..()


/obj/item/device/mmi/posibrain/attackby(var/obj/item/O as obj, var/mob/user as mob)
return


/obj/item/device/mmi/posibrain/proc/handle_posibrain_icon()
if(searching)
icon_state = "posibrain-searching"
return
if(brainmob)
icon_state = "posibrain-occupied"
else
icon_state = "posibrain"
Loading