Fixes AIs being able to see cult runes (#22577)

* Remove this shit so fast

* Runes are now stored in a global list

* Readd this shit to properly work

* Refactor rune invisification into a proc

* Fixes #17426

* Use the blood decals

* Less garbage + removal

* COMPILE BEFORE PUSH YOU SPERGLORD

* Refactor into a datum

* Added to crayon runes

* Refactor AI's vision to a slightly lower level

* Actually make the shit invisible to ais

* Nevermind, fixed it

* Fixes it being on the wrong layer
This commit is contained in:
Cyberboss
2017-01-03 14:09:34 -05:00
committed by oranges
parent 36eeb75770
commit ed461afed5
5 changed files with 60 additions and 7 deletions

View File

@@ -5,7 +5,10 @@
#define INVISIBILITY_LIGHTING 20
#define SEE_INVISIBLE_AI 24
#define SEE_INVISIBLE_LIVING 25
#define INVISIBILITY_AI 25
#define SEE_INVISIBLE_LEVEL_ONE 35 //currently unused
#define INVISIBILITY_LEVEL_ONE 35 //currently unused

View File

@@ -1,5 +1,6 @@
/var/list/sacrificed = list() //a mixed list of minds and mobs
var/list/sacrificed = list() //a mixed list of minds and mobs
var/list/non_revealed_runes = (subtypesof(/obj/effect/rune) - /obj/effect/rune/malformed)
var/list/ai_hidden_runes = list()
/*
@@ -13,6 +14,30 @@ To draw a rune, use an arcane tome.
*/
//for hiding from the ai
/datum/ai_fake_rune
var/image/ai_image
/datum/ai_fake_rune/New(_loc)
. = ..()
ai_hidden_runes += src
var/obj/effect/decal/cleanable/blood/splatter/s = new(_loc)
ai_image = image(s.icon, icon_state = s.icon_state, loc = _loc, layer = TURF_LAYER)
qdel(s)
for(var/a in ai_list)
var/mob/living/silicon/ai/AI = a
AI.invisify_rune(src)
/datum/ai_fake_rune/Destroy()
ai_hidden_runes -= src
for(var/a in ai_list)
var/mob/living/silicon/ai/AI = a
AI.uninvisify_rune(src)
qdel(ai_image)
return ..()
/obj/effect/rune
name = "rune"
var/cultist_name = "basic rune"
@@ -25,6 +50,8 @@ To draw a rune, use an arcane tome.
layer = ABOVE_NORMAL_TURF_LAYER
color = "#FF0000"
invisibility = INVISIBILITY_AI
var/invocation = "Aiy ele-mayo!" //This is said by cultists when the rune is invoked.
var/req_cultists = 1 //The amount of cultists required around the rune to invoke it. If only 1, any cultist can invoke it.
var/req_cultists_text //if we have a description override for required cultists to invoke
@@ -38,12 +65,18 @@ To draw a rune, use an arcane tome.
var/req_keyword = 0 //If the rune requires a keyword - go figure amirite
var/keyword //The actual keyword for the rune
var/datum/ai_fake_rune/ai_hidden
/obj/effect/rune/New(loc, set_keyword)
..()
. = ..()
ai_hidden = new(loc)
if(set_keyword)
keyword = set_keyword
/obj/effect/rune/Destroy()
qdel(ai_hidden)
return ..()
/obj/effect/rune/examine(mob/user)
..()
if(iscultist(user) || user.stat == DEAD) //If they're a cultist or a ghost, tell them the effects

View File

@@ -5,8 +5,13 @@
icon_state = "rune1"
gender = NEUTER
var/do_icon_rotate = TRUE
var/datum/ai_fake_rune/ai_hidden = null
/obj/effect/decal/cleanable/crayon/New(location, main = "#FFFFFF", var/type = "rune1", var/e_name = "rune", var/rotation = 0, var/alt_icon = null)
if(name == "rune")
ai_hidden = new(location)
invisibility = INVISIBILITY_AI
..()
loc = location
@@ -26,6 +31,9 @@
add_atom_colour(main, FIXED_COLOUR_PRIORITY)
/obj/effect/decal/cleanable/crayon/Destroy()
qdel(ai_hidden)
return ..()
/obj/effect/decal/cleanable/crayon/gang
layer = HIGH_OBJ_LAYER //Harder to hide

View File

@@ -28,6 +28,9 @@ var/list/ai_list = list()
med_hud = DATA_HUD_MEDICAL_BASIC
sec_hud = DATA_HUD_SECURITY_BASIC
mob_size = MOB_SIZE_LARGE
see_invisible = SEE_INVISIBLE_AI
var/list/network = list("SS13")
var/obj/machinery/camera/current = null
var/list/connected_robots = list()
@@ -869,6 +872,14 @@ var/list/ai_list = list()
exclusive control."
apc.update_icon()
/mob/living/silicon/ai/proc/invisify_rune(datum/ai_fake_rune/rune)
if(client)
client.images += rune.ai_image
/mob/living/silicon/ai/proc/uninvisify_rune(datum/ai_fake_rune/rune)
if(client)
client.images -= rune.ai_image
/mob/living/silicon/ai/spawned/New(loc, datum/ai_laws/L, mob/target_ai)
if(!target_ai)
target_ai = src //cheat! just give... ourselves as the spawned AI, because that's technically correct

View File

@@ -1,9 +1,7 @@
/mob/living/silicon/ai/Login()
..()
for(var/obj/effect/rune/rune in world)
var/image/blood = image(loc = rune)
blood.override = 1
client.images += blood
for(var/r in ai_hidden_runes)
invisify_rune(r)
if(stat != DEAD)
for(var/obj/machinery/ai_status_display/O in machines) //change status