diff --git a/baystation12.dme b/baystation12.dme
index 06ddf79d43..1b909998da 100644
--- a/baystation12.dme
+++ b/baystation12.dme
@@ -382,7 +382,6 @@
#include "code\game\machinery\computer\computer.dm"
#include "code\game\machinery\computer\crew.dm"
#include "code\game\machinery\computer\guestpass.dm"
-#include "code\game\machinery\computer\hologram.dm"
#include "code\game\machinery\computer\law.dm"
#include "code\game\machinery\computer\medical.dm"
#include "code\game\machinery\computer\message.dm"
diff --git a/code/game/machinery/computer/hologram.dm b/code/game/machinery/computer/hologram.dm
deleted file mode 100644
index e0ceb33c17..0000000000
--- a/code/game/machinery/computer/hologram.dm
+++ /dev/null
@@ -1,109 +0,0 @@
-//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31
-
-/obj/machinery/computer/hologram_comp
- name = "hologram computer"
- desc = "Rumoured to control holograms."
- icon = 'icons/obj/stationobjs.dmi'
- icon_state = "holo_console0"
- var/obj/machinery/hologram/projector/projector = null
- var/temp = null
- var/lumens = 0.0
- var/h_r = 245.0
- var/h_g = 245.0
- var/h_b = 245.0
-
-
-/obj/machinery/computer/hologram_comp/New()
- ..()
- spawn( 10 )
- src.projector = locate(/obj/machinery/hologram/projector, get_step(src.loc, NORTH))
- return
- return
-
-/obj/machinery/computer/hologram_comp/DblClick()
- if (!in_range(src, usr))
- return 0
- src.show_console(usr)
- return
-
-/obj/machinery/computer/hologram_comp/proc/render()
- var/icon/I = new /icon('icons/mob/human.dmi', "body_m_s")
-
- if (src.lumens >= 0)
- I.Blend(rgb(src.lumens, src.lumens, src.lumens), ICON_ADD)
- else
- I.Blend(rgb(- src.lumens, -src.lumens, -src.lumens), ICON_SUBTRACT)
-
- I.Blend(new /icon('icons/mob/human.dmi', "mouth_m_s"), ICON_OVERLAY)
- I.Blend(new /icon('icons/mob/human.dmi', "underwear1_m_s"), ICON_OVERLAY)
-
- var/icon/U = new /icon('icons/mob/human_face.dmi', "hair_a_s")
- U.Blend(rgb(src.h_r, src.h_g, src.h_b), ICON_ADD)
-
- I.Blend(U, ICON_OVERLAY)
-
- src.projector.hologram.icon = I
-
-/obj/machinery/computer/hologram_comp/proc/show_console(var/mob/user as mob)
- var/dat
- user.set_machine(src)
- if (src.temp)
- dat = text("[]
Clear", src.temp, src)
- else
- dat = text("Hologram Status:
\nPower: []
\nHologram Control:
\nColor Luminosity: []/220 \[Reset\]
\nLighten: 1 10
\nDarken: 1 10
\n
\nHair Color: ([],[],[]) \[Reset\]
\nRed (0-255): \[0\] -10 -1 [] 1 10 \[255\]
\nGreen (0-255): \[0\] -10 -1 [] 1 10 \[255\]
\nBlue (0-255): \[0\] -10 -1 [] 1 10 \[255\]
", src, (src.projector.hologram ? "On" : "Off"), -src.lumens + 35, src, src, src, src, src, src.h_r, src.h_g, src.h_b, src, src, src, src, src.h_r, src, src, src, src, src, src, src.h_g, src, src, src, src, src, src, src.h_b, src, src, src)
- user << browse(dat, "window=hologram_console")
- onclose(user, "hologram_console")
- return
-
-/obj/machinery/computer/hologram_comp/Topic(href, href_list)
- if(..())
- return
- if (in_range(src, usr))
- flick("holo_console1", src)
- if (href_list["power"])
- if (src.projector.hologram)
- src.projector.icon_state = "hologram0"
- //src.projector.hologram = null
- del(src.projector.hologram)
- else
- src.projector.hologram = new(src.projector.loc)
- src.projector.hologram.icon = 'icons/mob/human.dmi'
- src.projector.hologram.icon_state = "body_m_s"
- src.projector.icon_state = "hologram1"
- src.render()
- else
- if (href_list["h_r"])
- if (src.projector.hologram)
- src.h_r += text2num(href_list["h_r"])
- src.h_r = min(max(src.h_r, 0), 255)
- render()
- else
- if (href_list["h_g"])
- if (src.projector.hologram)
- src.h_g += text2num(href_list["h_g"])
- src.h_g = min(max(src.h_g, 0), 255)
- render()
- else
- if (href_list["h_b"])
- if (src.projector.hologram)
- src.h_b += text2num(href_list["h_b"])
- src.h_b = min(max(src.h_b, 0), 255)
- render()
- else
- if (href_list["light"])
- if (src.projector.hologram)
- src.lumens += text2num(href_list["light"])
- src.lumens = min(max(src.lumens, -185.0), 35)
- render()
- else
- if (href_list["reset"])
- if (src.projector.hologram)
- src.lumens = 0
- render()
- else
- if (href_list["temp"])
- src.temp = null
- for(var/mob/M in viewers(1, src))
- if ((M.client && M.machine == src))
- src.show_console(M)
- return
diff --git a/code/game/machinery/hologram.dm b/code/game/machinery/hologram.dm
index 2d5b9394d0..71894c2983 100644
--- a/code/game/machinery/hologram.dm
+++ b/code/game/machinery/hologram.dm
@@ -24,10 +24,12 @@ Possible to do for anyone motivated enough:
* Holopad
*/
-// HOLOPAD MODE
-// 0 = RANGE BASED
-// 1 = AREA BASED
-var/const/HOLOPAD_MODE = 0
+#define HOLOPAD_PASSIVE_POWER_USAGE 1
+#define HOLOGRAM_POWER_USAGE 2
+#define RANGE_BASED 4
+#define AREA_BASED 6
+
+var/const/HOLOPAD_MODE = RANGE_BASED
/obj/machinery/hologram/holopad
name = "\improper AI holopad"
@@ -36,7 +38,7 @@ var/const/HOLOPAD_MODE = 0
layer = TURF_LAYER+0.1 //Preventing mice and drones from sneaking under them.
- var/mob/living/silicon/ai/master//Which AI, if any, is controlling the object? Only one AI may control a hologram at any time.
+ var/list/mob/living/silicon/ai/masters = new() //List of AIs that use the holopad
var/last_request = 0 //to prevent request spam. ~Carn
var/holo_range = 5 // Change to change how far the AI can move away from the holopad before deactivating.
@@ -62,52 +64,53 @@ var/const/HOLOPAD_MODE = 0
This may change in the future but for now will suffice.*/
if(user.eyeobj.loc != src.loc)//Set client eye on the object if it's not already.
user.eyeobj.setLoc(get_turf(src))
- else if(!hologram)//If there is no hologram, possibly make one.
+ else if(!masters[user])//If there is no hologram, possibly make one.
activate_holo(user)
- else if(master==user)//If there is a hologram, remove it. But only if the user is the master. Otherwise do nothing.
- clear_holo()
+ else//If there is a hologram, remove it.
+ clear_holo(user)
return
/obj/machinery/hologram/holopad/proc/activate_holo(mob/living/silicon/ai/user)
- if(!(stat & NOPOWER) && user.eyeobj.loc == src.loc)//If the projector has power and client eye is on it.
- if(!hologram)//If there is not already a hologram.
- create_holo(user)//Create one.
- src.visible_message("A holographic image of [user] flicks to life right before your eyes!")
- else
- user << "\red ERROR: \black Image feed in progress."
+ if(!(stat & NOPOWER) && user.eyeobj.loc == src.loc)//If the projector has power and client eye is on it
+ if (user.holo)
+ user << "ERROR: Image feed in progress."
+ return
+ create_holo(user)//Create one.
+ src.visible_message("A holographic image of [user] flicks to life right before your eyes!")
else
- user << "\red ERROR: \black Unable to project hologram."
+ user << "ERROR: Unable to project hologram."
return
/*This is the proc for special two-way communication between AI and holopad/people talking near holopad.
For the other part of the code, check silicon say.dm. Particularly robot talk.*/
/obj/machinery/hologram/holopad/hear_talk(mob/living/M, text, verb, datum/language/speaking)
- if(M&&hologram&&master)//Master is mostly a safety in case lag hits or something.
- if(!master.say_understands(M, speaking))//The AI will be able to understand most mobs talking through the holopad.
+ if(M)
+ for(var/mob/living/silicon/ai/master in masters)
+ if(!master.say_understands(M, speaking))//The AI will be able to understand most mobs talking through the holopad.
+ if(speaking)
+ text = speaking.scramble(text)
+ else
+ text = stars(text)
+ var/name_used = M.GetVoice()
+ //This communication is imperfect because the holopad "filters" voices and is only designed to connect to the master only.
+ var/rendered
if(speaking)
- text = speaking.scramble(text)
+ rendered = "Holopad received, [name_used] [speaking.format_message(text, verb)]"
else
- text = stars(text)
- var/name_used = M.GetVoice()
- //This communication is imperfect because the holopad "filters" voices and is only designed to connect to the master only.
- var/rendered
- if(speaking)
- rendered = "Holopad received, [name_used] [speaking.format_message(text, verb)]"
- else
- rendered = "Holopad received, [name_used] [verb], \"[text]\""
- master.show_message(rendered, 2)
- return
+ rendered = "Holopad received, [name_used] [verb], \"[text]\""
+ master.show_message(rendered, 2)
/obj/machinery/hologram/holopad/see_emote(mob/living/M, text)
- if(M && hologram && master)
- //var/name_used = M.GetVoice()
- var/rendered = "Holopad received, [text]"
- //The lack of name_used is needed, because message already contains a name. This is needed for simple mobs to emote properly.
- master.show_message(rendered, 2)
+ if(M)
+ for(var/mob/living/silicon/ai/master in masters)
+ //var/name_used = M.GetVoice()
+ var/rendered = "Holopad received, [text]"
+ //The lack of name_used is needed, because message already contains a name. This is needed for simple mobs to emote properly.
+ master.show_message(rendered, 2)
return
/obj/machinery/hologram/holopad/proc/create_holo(mob/living/silicon/ai/A, turf/T = loc)
- hologram = new(T)//Spawn a blank effect at the location.
+ var/obj/effect/overlay/hologram = new(T)//Spawn a blank effect at the location.
hologram.icon = A.holo_icon
hologram.mouse_opacity = 0//So you can't click on it.
hologram.layer = FLY_LAYER//Above all the other objects/mobs. Or the vast majority of them.
@@ -115,32 +118,33 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/
hologram.name = "[A.name] (Hologram)"//If someone decides to right click.
hologram.SetLuminosity(2) //hologram lighting
hologram.color = color //painted holopad gives coloured holograms
+ masters[A] = hologram
SetLuminosity(2) //pad lighting
icon_state = "holopad1"
A.holo = src
- master = A//AI is the master.
- use_power = 2//Active power usage.
+ use_power += HOLOGRAM_POWER_USAGE
return 1
-/obj/machinery/hologram/holopad/proc/clear_holo()
-// hologram.SetLuminosity(0)//Clear lighting. //handled by the lighting controller when its ower is deleted
- del(hologram)//Get rid of hologram.
- if(master.holo == src)
- master.holo = null
- master = null//Null the master, since no-one is using it now.
- SetLuminosity(0) //pad lighting (hologram lighting will be handled automatically since its owner was deleted)
- icon_state = "holopad0"
- use_power = 1//Passive power usage.
+/obj/machinery/hologram/holopad/proc/clear_holo(mob/living/silicon/ai/user)
+ if(user.holo == src)
+ user.holo = null
+ del(masters[user])//Get rid of user's hologram //qdel
+ masters -= user //Discard AI from the list of those who use holopad
+ use_power = max(HOLOPAD_PASSIVE_POWER_USAGE, use_power - HOLOGRAM_POWER_USAGE)//Reduce power usage
+ if (!masters.len)//If no users left
+ SetLuminosity(0) //pad lighting (hologram lighting will be handled automatically since its owner was deleted)
+ icon_state = "holopad0"
+ use_power = HOLOPAD_PASSIVE_POWER_USAGE
return 1
/obj/machinery/hologram/holopad/process()
- if(hologram)//If there is a hologram.
+ for (var/mob/living/silicon/ai/master in masters)
if(master && !master.stat && master.client && master.eyeobj)//If there is an AI attached, it's not incapacitated, it has a client, and the client eye is centered on the projector.
if(!(stat & NOPOWER))//If the machine has power.
- if((HOLOPAD_MODE == 0 && (get_dist(master.eyeobj, src) <= holo_range)))
+ if((HOLOPAD_MODE == RANGE_BASED && (get_dist(master.eyeobj, src) <= holo_range)))
return 1
- else if (HOLOPAD_MODE == 1)
+ else if (HOLOPAD_MODE == AREA_BASED)
var/area/holo_area = get_area(src)
var/area/eye_area = get_area(master.eyeobj)
@@ -148,14 +152,15 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/
if(eye_area in holo_area.master.related)
return 1
- clear_holo()//If not, we want to get rid of the hologram.
+ clear_holo(master)//If not, we want to get rid of the hologram.
return 1
-/obj/machinery/hologram/holopad/proc/move_hologram()
- if(hologram)
- step_to(hologram, master.eyeobj) // So it turns.
- hologram.loc = get_turf(master.eyeobj)
-
+/obj/machinery/hologram/holopad/proc/move_hologram(mob/living/silicon/ai/user)
+ if(masters[user])
+ step_to(masters[user], user.eyeobj) // So it turns.
+ var/obj/effect/overlay/H = masters[user]
+ H.loc = get_turf(user.eyeobj)
+ masters[user] = H
return 1
/*
@@ -167,7 +172,6 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/
use_power = 1
idle_power_usage = 5
active_power_usage = 100
- var/obj/effect/overlay/hologram//The projection itself. If there is one, the instrument is on, off otherwise.
//Destruction procs.
/obj/machinery/hologram/ex_act(severity)
@@ -190,9 +194,9 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/
del(src)
return
-/obj/machinery/hologram/Del()
- if(hologram)
- src:clear_holo()
+/obj/machinery/hologram/holopad/Del()
+ for (var/mob/living/silicon/ai/master in masters)
+ clear_holo(master)
..()
/*
@@ -224,3 +228,9 @@ Holographic project of everything else.
desc = "It makes a hologram appear...with magnets or something..."
icon = 'icons/obj/stationobjs.dmi'
icon_state = "hologram0"
+
+
+#undef RANGE_BASED
+#undef AREA_BASED
+#undef HOLOPAD_PASSIVE_POWER_USAGE
+#undef HOLOGRAM_POWER_USAGE
diff --git a/code/modules/mob/living/silicon/ai/freelook/eye.dm b/code/modules/mob/living/silicon/ai/freelook/eye.dm
index d86d71607f..c9dbfe39dd 100644
--- a/code/modules/mob/living/silicon/ai/freelook/eye.dm
+++ b/code/modules/mob/living/silicon/ai/freelook/eye.dm
@@ -49,7 +49,7 @@
ai.client.eye = src
//Holopad
if(ai.holo)
- ai.holo.move_hologram()
+ ai.holo.move_hologram(ai)
/mob/aiEye/proc/getLoc()
diff --git a/code/modules/mob/living/silicon/say.dm b/code/modules/mob/living/silicon/say.dm
index ba5b0ad4f8..9fb93e0eff 100644
--- a/code/modules/mob/living/silicon/say.dm
+++ b/code/modules/mob/living/silicon/say.dm
@@ -159,7 +159,7 @@
return
var/obj/machinery/hologram/holopad/T = src.holo
- if(T && T.hologram && T.master == src)//If there is a hologram and its master is the user.
+ if(T && T.masters[src])//If there is a hologram and its master is the user.
//Human-like, sorta, heard by those who understand humans.
var/rendered_a
@@ -198,7 +198,7 @@
return
var/obj/machinery/hologram/holopad/T = src.holo
- if(T && T.hologram && T.master == src)
+ if(T && T.masters[src])
var/rendered = "[name] [message]"
src << "Holopad action relayed, [real_name] [message]"
@@ -211,7 +211,7 @@
/mob/living/silicon/ai/emote(var/act, var/type, var/message)
var/obj/machinery/hologram/holopad/T = src.holo
- if(T && T.hologram && T.master == src) //Is the AI using a holopad?
+ if(T && T.masters[src]) //Is the AI using a holopad?
src.holopad_emote(message)
else //Emote normally, then.
..()