Merge branch 'dev' into ofChemistryAndStuff

Conflicts:
	maps/exodus-1.dmm
This commit is contained in:
Kelenius
2015-03-30 10:35:37 +03:00
11 changed files with 2315 additions and 2294 deletions

View File

@@ -37,6 +37,10 @@ var/const/HOLOPAD_MODE = RANGE_BASED
icon_state = "holopad0"
layer = TURF_LAYER+0.1 //Preventing mice and drones from sneaking under them.
var/power_per_hologram = 500 //per usage per hologram
idle_power_usage = 5
use_power = 1
var/list/mob/living/silicon/ai/masters = new() //List of AIs that use the holopad
var/last_request = 0 //to prevent request spam. ~Carn
@@ -122,7 +126,6 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/
SetLuminosity(2) //pad lighting
icon_state = "holopad1"
A.holo = src
use_power += HOLOGRAM_POWER_USAGE
return 1
/obj/machinery/hologram/holopad/proc/clear_holo(mob/living/silicon/ai/user)
@@ -130,29 +133,31 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/
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()
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 == RANGE_BASED && (get_dist(master.eyeobj, src) <= holo_range)))
return 1
var/active_ai = (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) || !active_ai)
clear_holo(master)
continue
if((HOLOPAD_MODE == RANGE_BASED && (get_dist(master.eyeobj, src) > holo_range)))
clear_holo(master)
continue
if(HOLOPAD_MODE == AREA_BASED)
var/area/holo_area = get_area(src)
var/area/eye_area = get_area(master.eyeobj)
if(!(eye_area in holo_area.master.related))
clear_holo(master)
continue
else if (HOLOPAD_MODE == AREA_BASED)
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(master)//If not, we want to get rid of the hologram.
use_power(power_per_hologram)
return 1
/obj/machinery/hologram/holopad/proc/move_hologram(mob/living/silicon/ai/user)