diff --git a/code/defines/obj/machinery.dm b/code/defines/obj/machinery.dm index 03059344c10..e431debaf82 100644 --- a/code/defines/obj/machinery.dm +++ b/code/defines/obj/machinery.dm @@ -330,6 +330,7 @@ icon_state = "holopad0" 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/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. /obj/machinery/hologram/projector name = "hologram projector" diff --git a/code/game/machinery/hologram.dm b/code/game/machinery/hologram.dm index 671f9a2feed..8104b8e85c3 100644 --- a/code/game/machinery/hologram.dm +++ b/code/game/machinery/hologram.dm @@ -12,6 +12,12 @@ Possible to do for anyone motivated enough: Itegrate EMP effect to disable the unit. */ +// HOLOPAD MODE +// 0 = RANGE BASED +// 1 = AREA BASED +var/const/HOLOPAD_MODE = 1 + + /obj/machinery/hologram/holopad/attack_hand(var/mob/living/carbon/human/user) //Carn: Hologram requests. if(!istype(user)) return @@ -72,7 +78,7 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/ 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. hologram.anchored = 1//So space wind cannot drag it. - hologram.name = "AI hologram"//If someone decides to right click. + hologram.name = "[A.name] (Hologram)"//If someone decides to right click. hologram.SetLuminosity(2) //hologram lighting SetLuminosity(2) //pad lighting icon_state = "holopad1" @@ -94,12 +100,28 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/ /obj/machinery/hologram/holopad/process() if(hologram)//If there is a hologram. - if(master && !master.stat && master.client && master.eyeobj.loc == src.loc)//If there is an AI attached, it's not incapacitated, it has a client, and the client eye is centered on the projector. + 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. - return 1 + if((HOLOPAD_MODE == 0 && (get_dist(master.eyeobj, src) <= holo_range))) + return 1 + + else if (HOLOPAD_MODE == 1) + + var/area/holo_area = get_area(src) + var/area/eye_area = get_area(master.eyeobj) + + if(eye_area in holo_area.master.related) + return 1 + clear_holo()//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) + return 1 + /obj/machinery/hologram/power_change() if (powered()) stat &= ~NOPOWER diff --git a/code/modules/mob/living/silicon/ai/freelook/eye.dm b/code/modules/mob/living/silicon/ai/freelook/eye.dm index 218148ab429..ef10f4a4eaf 100644 --- a/code/modules/mob/living/silicon/ai/freelook/eye.dm +++ b/code/modules/mob/living/silicon/ai/freelook/eye.dm @@ -10,6 +10,7 @@ var/mob/living/silicon/ai/ai = null density = 0 nodamage = 1 // You can't damage it. + mouse_opacity = 0 // Movement code. Returns 0 to stop air movement from moving it. /mob/aiEye/Move() @@ -41,6 +42,11 @@ if(ai) if(ai.client) ai.client.eye = src + //Holopad + if(istype(ai.current, /obj/machinery/hologram/holopad)) + var/obj/machinery/hologram/holopad/H = ai.current + H.move_hologram() + // AI MOVEMENT diff --git a/html/changelog.html b/html/changelog.html index fc00a8992b6..36cfa4cc839 100644 --- a/html/changelog.html +++ b/html/changelog.html @@ -49,6 +49,15 @@ should be listed in the changelog upon commit tho. Thanks. --> +