Gives AI a personal atmospherics control subsystem.

Includes further work on NanoUI interactions.
This commit is contained in:
PsiOmega
2015-04-19 00:24:19 +02:00
parent 05d05732f8
commit 27abc7404d
15 changed files with 153 additions and 92 deletions

View File

@@ -17,3 +17,17 @@
else if (restrained() || lying || stat || stunned || weakened)
return STATUS_UPDATE // update only (orange visibility)
return STATUS_INTERACTIVE
/mob/living/silicon/ai/shared_nano_interaction()
if(lacks_power())
return STATUS_CLOSE
if (check_unable(1))
return STATUS_CLOSE
return ..()
/mob/living/silicon/robot/shared_nano_interaction()
if(cell.charge <= 0)
return STATUS_CLOSE
if(lockcharge)
. = STATUS_DISABLED
return min(., ..())

View File

@@ -21,10 +21,10 @@
return ..()
/mob/living/silicon/robot/default_can_use_topic(var/src_object)
if(stat || !client)
return STATUS_CLOSE
if(lockcharge || stunned || weakened)
return STATUS_DISABLED
. = shared_nano_interaction()
if(. <= STATUS_DISABLED)
return
// robots can interact with things they can see within their view range
if((src_object in view(src)) && get_dist(src_object, src) <= src.client.view)
return STATUS_INTERACTIVE // interactive (green visibility)
@@ -46,8 +46,10 @@
return STATUS_UPDATE
/mob/living/silicon/ai/default_can_use_topic(var/src_object)
if(!client || check_unable(1))
return STATUS_CLOSE
. = shared_nano_interaction()
if(. != STATUS_INTERACTIVE)
return
// Prevents the AI from using Topic on admin levels (by for example viewing through the court/thunderdome cameras)
// unless it's on the same level as the object it's interacting with.
var/turf/T = get_turf(src_object)
@@ -61,9 +63,8 @@
// If we're installed in a chassi, rather than transfered to an inteliCard or other container, then check if we have camera view
if(is_in_chassis())
//stop AIs from leaving windows open and using then after they lose vision
//apc_override is needed here because AIs use their own APC when powerless
if(cameranet && !cameranet.checkTurfVis(get_turf(src_object)))
return apc_override ? STATUS_INTERACTIVE : STATUS_CLOSE
return STATUS_CLOSE
return STATUS_INTERACTIVE
else if(get_dist(src_object, src) <= client.view) // View does not return what one would expect while installed in an inteliCard
return STATUS_INTERACTIVE

View File

@@ -0,0 +1,10 @@
/*
This state checks that the src_object is the same the as user
*/
/var/global/datum/topic_state/self_state/self_state = new()
/datum/topic_state/self_state/can_use_topic(var/src_object, var/mob/user)
if(src_object != user)
return STATUS_CLOSE
return user.shared_nano_interaction()