- major update to all systems

- creating the mask entity
- modifying the code for cult icons
- updating the camera net
- adding visibility network updates to all mobs
- unifying the culting and deculting process
- adding "Make Mask" function to Player Panel
This commit is contained in:
jack-fractal
2013-11-17 16:23:36 -05:00
parent b9f9e8a16f
commit c6ec432904
30 changed files with 1735 additions and 1286 deletions

View File

@@ -155,6 +155,7 @@
#include "code\datums\spells\wizard.dm"
#include "code\datums\visibility_networks\chunk.dm"
#include "code\datums\visibility_networks\dictionary.dm"
#include "code\datums\visibility_networks\update_triggers.dm"
#include "code\datums\visibility_networks\visibility_interface.dm"
#include "code\datums\visibility_networks\visibility_network.dm"
#include "code\defines\obj.dm"
@@ -1026,6 +1027,8 @@
#include "code\modules\mob\spirit\cultnet.dm"
#include "code\modules\mob\spirit\movement.dm"
#include "code\modules\mob\spirit\spirit.dm"
#include "code\modules\mob\spirit\viewpoint.dm"
#include "code\modules\mob\spirit\mask\mask.dm"
#include "code\modules\nano\_JSON.dm"
#include "code\modules\nano\JSON Reader.dm"
#include "code\modules\nano\JSON Writer.dm"

View File

@@ -1,6 +1,9 @@
// BEGIN_INTERNALS
/*
MAP_ICON_TYPE: 0
LAST_COMPILE_VERSION: 501.1217
DIR: code code\datums code\datums\visibility_networks code\defines\obj code\game code\game\gamemodes code\game\gamemodes\cult code\game\gamemodes\malfunction code\game\machinery code\game\machinery\camera code\modules code\modules\admin code\modules\mob code\modules\mob\living code\modules\mob\living\carbon code\modules\mob\living\carbon\human
LAST_COMPILE_TIME: 1384721250
AUTO_FILE_DIR: OFF
*/
// END_INTERNALS

View File

@@ -7,6 +7,7 @@ var/list/directory = list() //list of all ckeys with associated client
var/global/list/player_list = list() //List of all mobs **with clients attached**. Excludes /mob/new_player
var/global/list/mob_list = list() //List of all mobs, including clientless
var/global/list/spirits = list() //List of all the spirits, including Masks
var/global/list/living_mob_list = list() //List of all alive mobs, including clientless. Excludes /mob/new_player
var/global/list/dead_mob_list = list() //List of all dead mobs, including clientless. Excludes /mob/new_player

View File

@@ -28,7 +28,7 @@
return
/client/proc/debug_controller(controller in list("Master","Failsafe","Ticker","Lighting","Air","Jobs","Sun","Radio","Supply Shuttle","Emergency Shuttle","Configuration","pAI", "Cameras"))
/client/proc/debug_controller(controller in list("Master","Failsafe","Ticker","Lighting","Air","Jobs","Sun","Radio","Supply Shuttle","Emergency Shuttle","Configuration","pAI", "Cameras","CultNetwork"))
set category = "Debug"
set name = "Debug Controller"
set desc = "Debug the various periodic loop controllers for the game (be careful!)"
@@ -74,5 +74,8 @@
if("Cameras")
debug_variables(cameraNetwork)
feedback_add_details("admin_verb","DCameras")
if("CultNetwork")
debug_variables(cultNetwork)
feedback_add_details("admin_verb","DCultNetwork")
message_admins("Admin [key_name_admin(usr)] is debugging the [controller] controller.")
return

View File

@@ -263,6 +263,7 @@ client
body += "<option value='?_src_=vars;setmutantrace=\ref[D]'>Set Mutantrace</option>"
body += "<option value='?_src_=vars;setspecies=\ref[D]'>Set Species</option>"
body += "<option value='?_src_=vars;makeai=\ref[D]'>Make AI</option>"
body += "<option value='?_src_=vars;makemask=\ref[D]'>Make Mask of Nar'sie</option>"
body += "<option value='?_src_=vars;makerobot=\ref[D]'>Make cyborg</option>"
body += "<option value='?_src_=vars;makemonkey=\ref[D]'>Make monkey</option>"
body += "<option value='?_src_=vars;makealien=\ref[D]'>Make alien</option>"
@@ -724,7 +725,18 @@ client
usr << "Mob doesn't exist anymore"
return
holder.Topic(href, list("makeai"=href_list["makeai"]))
else if(href_list["makemask"])
if(!check_rights(R_SPAWN)) return
var/mob/currentMob = locate(href_list["makemask"])
if(alert("Confirm mob type change?",,"Transform","Cancel") != "Transform") return
if(!currentMob)
usr << "Mob doesn't exist anymore"
return
holder.Topic(href, list("makemask"=href_list["makemask"]))
else if(href_list["setmutantrace"])
if(!check_rights(R_SPAWN)) return

View File

@@ -589,6 +589,11 @@ datum/mind
log_admin("[key_name_admin(usr)] has de-cult'ed [current].")
if("cultist")
if(!(src in ticker.mode.cult))
ticker.mode.add_cultist(src)
special_role = "Cultist"
current << "<font color=\"purple\"><b><i>You catch a glimpse of the Realm of Nar-Sie, The Geometer of Blood. You now see how flimsy the world is, you see that it should be open to the knowledge of Nar-Sie.</b></i></font>"
current << "<font color=\"purple\"><b><i>Assist your new compatriots in their dark dealings. Their goal is yours, and yours is theirs. You serve the Dark One above all else. Bring It back.</b></i></font>"
/*
ticker.mode.cult += src
ticker.mode.update_cult_icons_added(src)
special_role = "Cultist"
@@ -597,6 +602,9 @@ datum/mind
var/datum/game_mode/cult/cult = ticker.mode
if (istype(cult))
cult.memoize_cult_objectives(src)
var/obj/cult_viewpoint/viewpoint = new(current)
viewpoint.loc = current
*/
log_admin("[key_name_admin(usr)] has cult'ed [current].")
if("tome")
var/mob/living/carbon/human/H = current

View File

@@ -0,0 +1,7 @@
Next Thing To Do
- sprites!
- follow!
- can we hide inside cultists?
- cult names!
- powers

View File

@@ -1,5 +1,7 @@
var/datum/visibility_network/cameras/cameraNetwork = new /datum/visibility_network/cameras()
var/datum/visibility_network/list/visibility_networks = list("ALL_CAMERAS"=cameraNetwork)
var/datum/visibility_network/cameras/cameraNetwork = new()
var/datum/visibility_network/cult/cultNetwork = new()
var/datum/visibility_network/list/visibility_networks = list("ALL_CAMERAS"=cameraNetwork, "CULT" = cultNetwork)
// used by turfs and objects to update all visibility networks
/proc/updateVisibilityNetworks(atom/A, var/opacity_check = 1)

View File

@@ -47,9 +47,48 @@
// DOORS
// Simply updates the visibility of the area when it opens/closes/destroyed.
/obj/machinery/door/update_nearby_tiles(need_rebuild)
. = ..(need_rebuild)
// Glass door glass = 1
// don't check then?
/obj/machinery/door/proc/update_nearby_tiles(need_rebuild)
if(!glass)
updateVisibilityNetworks(src,0)
updateVisibilityNetworks(src,0)
if(!air_master)
return 0
for(var/turf/simulated/turf in locs)
update_heat_protection(turf)
air_master.AddTurfToUpdate(turf)
return 1
#define UPDATE_VISIBILITY_NETWORK_BUFFER 30
/mob
var/datum/visibility_network/list/visibilityNetworks=list()
var/updatingVisibilityNetworks=FALSE
/mob/Move(n,direct)
var/oldLoc = src.loc
. = ..()
if(.)
if(src.visibilityNetworks.len)
if(!src.updatingVisibilityNetworks)
src.updatingVisibilityNetworks = 1
spawn(UPDATE_VISIBILITY_NETWORK_BUFFER)
if(oldLoc != src.loc)
for (var/datum/visibility_network/currentNetwork in src.visibilityNetworks)
currentNetwork.updateMob(src)
src.updatingVisibilityNetworks = 0
return ..(n,direct)
/mob/proc/addToVisibilityNetwork(var/datum/visibility_network/network)
if(network)
src.visibilityNetworks+=network
/mob/proc/removeFromVisibilityNetwork(var/datum/visibility_network/network)
if(network)
src.visibilityNetworks|=network
#undef UPDATE_VISIBILITY_NETWORK_BUFFER

View File

@@ -86,6 +86,14 @@
if(validViewpoint(viewpoint))
majorChunkChange(viewpoint, 0)
/datum/visibility_network/proc/getViewpointFromMob(var/mob/currentMob)
return FALSE
/datum/visibility_network/proc/updateMob(var/mob/currentMob)
var/viewpoint = getViewpointFromMob(currentMob)
if(viewpoint)
updateViewpoint(viewpoint)
/datum/visibility_network/proc/updateViewpoint(var/viewpoint)
if(validViewpoint(viewpoint))

View File

@@ -134,6 +134,10 @@
mob.mutations.Remove(CLUMSY)
var/obj/cult_viewpoint/viewpoint = new(mob)
viewpoint.loc = mob
world << "Spawning viewpoint on [mob]"
var/obj/item/weapon/paper/talisman/supply/T = new(mob)
var/list/slots = list (
"backpack" = slot_in_backpack,
@@ -174,6 +178,8 @@
return 0
if(!(cult_mind in cult) && is_convertable_to_cult(cult_mind))
cult += cult_mind
var/obj/cult_viewpoint/viewpoint = new(cult_mind.current)
viewpoint.loc = cult_mind.current
update_cult_icons_added(cult_mind)
return 1
@@ -189,29 +195,134 @@
cult -= cult_mind
cult_mind.current << "\red <FONT size = 3><B>An unfamiliar white light flashes through your mind, cleansing the taint of the dark-one and the memories of your time as his servant with it.</B></FONT>"
cult_mind.memory = ""
// remove the cult viewpoint object
var/obj/viewpoint = getCultViewpoint(cult_mind.current)
del(viewpoint)
update_cult_icons_removed(cult_mind)
if(show_message)
for(var/mob/M in viewers(cult_mind.current))
M << "<FONT size = 3>[cult_mind.current] looks like they just reverted to their old faith!</FONT>"
/datum/game_mode/proc/update_all_cult_icons()
spawn(0)
// reset the cult
for(var/datum/mind/cultist in cult)
reset_cult_icons_for_cultist(cultist)
// reset the spirits
for(var/mob/spirit/currentSpirit in spirits)
reset_cult_icons_for_spirit(currentSpirit)
/datum/game_mode/proc/reset_cult_icons_for_cultist(var/datum/mind/target)
if(target.current)
if(target.current.client)
remove_all_cult_icons(target)
for(var/datum/mind/cultist in cult)
if(cultist.current)
add_cult_icon(target.current.client,cultist.current)
/datum/game_mode/proc/reset_cult_icons_for_spirit(mob/spirit/target)
if (target.client)
remove_all_cult_icons(target)
for(var/datum/mind/cultist in cult)
if(cultist.current)
if(cultist.current.client)
for(var/image/I in cultist.current.client.images)
if(I.icon_state == "cult")
del(I)
add_cult_icon(target.client,cultist.current)
/datum/game_mode/proc/add_cult_icon(client/target_client,mob/target_mob)
var/I = image('icons/mob/mob.dmi', loc = target_mob, icon_state = "cult")
target_client.images += I
/datum/game_mode/proc/remove_cult_icon(client/target_client,mob/target_mob)
for(var/image/I in target_client.images)
if(I.icon_state == "cult" && I.loc == target_mob)
del(I)
/datum/game_mode/proc/remove_all_cult_icons_from_client(client/target)
for(var/image/I in target.images)
if(I.icon_state == "cult")
del(I)
/datum/game_mode/proc/remove_all_cult_icons(target)
var/datum/mind/cultist = target
if(istype(cultist))
if(cultist.current)
if(cultist.current.client)
remove_all_cult_icons_from_client(cultist.current.client)
return TRUE
var/mob/spirit/currentSpirit = target
if(istype(currentSpirit))
if (currentSpirit.client)
remove_all_cult_icons_from_client(currentSpirit.client)
return TRUE
return FALSE
/datum/game_mode/proc/add_cult_icon_to_spirit(mob/spirit/currentSpirit,datum/mind/cultist)
if(!istype(currentSpirit) || !istype(cultist))
return FALSE
if (currentSpirit.client)
if (cultist.current)
add_cult_icon(currentSpirit.client,cultist.current)
/datum/game_mode/proc/add_cult_icon_to_cultist(datum/mind/first_cultist,datum/mind/second_cultist)
if(first_cultist.current && second_cultist.current)
if(first_cultist.current.client)
add_cult_icon(first_cultist.current.client, second_cultist.current)
/datum/game_mode/proc/remove_cult_icon_from_cultist(datum/mind/first_cultist,datum/mind/second_cultist)
if(first_cultist.current && second_cultist.current)
if(first_cultist.current.client)
remove_cult_icon(first_cultist.current.client,second_cultist.current)
/datum/game_mode/proc/remove_cult_icon_from_spirit(mob/spirit/currentSpirit,datum/mind/cultist)
if(!istype(currentSpirit) || !istype(cultist))
return FALSE
if (currentSpirit.client)
if (cultist.current)
remove_cult_icon(currentSpirit.client,cultist.current)
/datum/game_mode/proc/cult_icon_pair_link(datum/mind/first_cultist,datum/mind/second_cultist)
if (!istype(first_cultist) || !istype(second_cultist))
return 0
add_cult_icon_to_cultist(first_cultist,second_cultist)
add_cult_icon_to_cultist(second_cultist,first_cultist)
/datum/game_mode/proc/cult_icon_pair_unlink(datum/mind/first_cultist,datum/mind/second_cultist)
if (!istype(first_cultist) || !istype(second_cultist))
return 0
remove_cult_icon(first_cultist,second_cultist)
remove_cult_icon(second_cultist,first_cultist)
/datum/game_mode/proc/update_cult_icons_added(datum/mind/cult_mind)
spawn(0)
for(var/datum/mind/cultist in cult)
if(cultist.current)
if(cultist.current.client)
for(var/datum/mind/cultist_1 in cult)
if(cultist_1.current)
var/I = image('icons/mob/mob.dmi', loc = cultist_1.current, icon_state = "cult")
cultist.current.client.images += I
cult_icon_pair_link(cultist,cult_mind)
for(var/mob/spirit/currentSpirit in spirits)
add_cult_icon_to_spirit(currentSpirit,cult_mind)
/datum/game_mode/proc/update_cult_icons_removed(datum/mind/cult_mind)
spawn(0)
for(var/datum/mind/cultist in cult)
cult_icon_pair_unlink(cultist,cult_mind)
for(var/mob/spirit/currentSpirit in spirits)
remove_cult_icon_from_spirit(currentSpirit,cult_mind)
/*
/datum/game_mode/proc/update_cult_icons_added(datum/mind/cult_mind)
spawn(0)
for(var/datum/mind/cultist in cult)
@@ -239,7 +350,7 @@
for(var/image/I in cult_mind.current.client.images)
if(I.icon_state == "cult")
del(I)
*/
/datum/game_mode/cult/proc/get_unconvertables()
var/list/ucs = list()

View File

@@ -25,6 +25,7 @@ var/engwords = list("travel", "blood", "join", "hell", "destroy", "technology",
icon = 'icons/obj/rune.dmi'
icon_state = "1"
var/visibility = 0
var/view_range = 7
unacidable = 1
layer = TURF_LAYER
@@ -67,11 +68,18 @@ var/engwords = list("travel", "blood", "join", "hell", "destroy", "technology",
blood.override = 1
for(var/mob/living/silicon/ai/AI in player_list)
AI.client.images += blood
cultNetwork.viewpoints+=src
cultNetwork.addViewpoint(src)
Del()
..()
cultNetwork.viewpoints-=src
cultNetwork.removeViewpoint(src)
examine()
set src in view(2)
if(!iscultist(usr))
if(!iscultist(usr) && !isSpirit(usr))
usr << "A strange collection of symbols drawn in blood."
return
/* Explosions... really?

File diff suppressed because it is too large Load Diff

View File

@@ -262,6 +262,8 @@
/obj/machinery/door/proc/requiresID()
return 1
/*
/obj/machinery/door/proc/update_nearby_tiles(need_rebuild)
if(!air_master)
return 0
@@ -272,6 +274,8 @@
return 1
*/
/obj/machinery/door/proc/update_heat_protection(var/turf/simulated/source)
if(istype(source))
if(src.density && (src.opacity || src.heat_proof))

View File

@@ -108,6 +108,7 @@ var/global/floorIsLava = 0
body += "<B>Is an AI</B> "
else if(ishuman(M))
body += {"<A href='?src=\ref[src];makeai=\ref[M]'>Make AI</A> |
<A href='?src=\ref[src];makemask=\ref[M]'>Make Mask</A> |
<A href='?src=\ref[src];makerobot=\ref[M]'>Make Robot</A> |
<A href='?src=\ref[src];makealien=\ref[M]'>Make Alien</A> |
<A href='?src=\ref[src];makeslime=\ref[M]'>Make slime</A>

View File

@@ -1174,6 +1174,15 @@
message_admins("\red Admin [key_name_admin(usr)] AIized [key_name_admin(H)]!", 1)
log_admin("[key_name(usr)] AIized [key_name(H)]")
H.AIize()
else if(href_list["makemask"])
if(!check_rights(R_SPAWN)) return
var/mob/currentMob = locate(href_list["makemask"])
message_admins("\red Admin [key_name_admin(usr)] made [key_name_admin(currentMob)] into a Mask of Nar'Sie!", 1)
log_admin("[key_name(usr)] made [key_name(currentMob)] into a Mask of Nar'Sie!")
currentMob.make_into_mask(0,0)
else if(href_list["makealien"])
if(!check_rights(R_SPAWN)) return

View File

@@ -58,9 +58,10 @@
var/datum/organ/external/head = get_organ("head")
var/mob/living/simple_animal/borer/B
for(var/I in head.implants)
if(istype(I,/mob/living/simple_animal/borer))
B = I
if(istype(head))
for(var/I in head.implants)
if(istype(I,/mob/living/simple_animal/borer))
B = I
if(B)
if(!B.ckey && ckey && B.controlling)
B.ckey = ckey

View File

@@ -327,6 +327,7 @@
return
/mob/living/Move(a, b, flag)
if (buckled)
return

View File

@@ -1,168 +1,14 @@
/datum/visibility_network/cameras
ChunkType = /datum/visibility_chunk/camera
/datum/visibility_network/cameras/getViewpointFromMob(var/mob/currentMob)
var/mob/living/silicon/robot/currentRobot=currentMob
if(currentRobot)
return currentRobot.camera
return FALSE
/datum/visibility_network/cameras/validViewpoint(var/viewpoint)
var/obj/machinery/camera/c = viewpoint
if (!c)
return FALSE
return c.can_use()
/*
// CAMERA NET
//
// The datum containing all the chunks.
var/datum/cameranet/cameranet = new()
/datum/cameranet
// The cameras on the map, no matter if they work or not. Updated in obj/machinery/camera.dm by New() and Del().
var/list/cameras = list()
// The chunks of the map, mapping the areas that the cameras can see.
var/list/chunks = list()
var/ready = 0
// Checks if a chunk has been Generated in x, y, z.
/datum/cameranet/proc/chunkGenerated(x, y, z)
x &= ~0xf
y &= ~0xf
var/key = "[x],[y],[z]"
return (chunks[key])
// Returns the chunk in the x, y, z.
// If there is no chunk, it creates a new chunk and returns that.
/datum/cameranet/proc/getCameraChunk(x, y, z)
x &= ~0xf
y &= ~0xf
var/key = "[x],[y],[z]"
if(!chunks[key])
chunks[key] = new /datum/camerachunk(null, x, y, z)
return chunks[key]
// Updates what the aiEye can see. It is recommended you use this when the aiEye moves or it's location is set.
/datum/cameranet/proc/visibility(mob/aiEye/ai)
// 0xf = 15
var/x1 = max(0, ai.x - 16) & ~0xf
var/y1 = max(0, ai.y - 16) & ~0xf
var/x2 = min(world.maxx, ai.x + 16) & ~0xf
var/y2 = min(world.maxy, ai.y + 16) & ~0xf
var/list/visibleChunks = list()
for(var/x = x1; x <= x2; x += 16)
for(var/y = y1; y <= y2; y += 16)
visibleChunks += getCameraChunk(x, y, ai.z)
var/list/remove = ai.visibleCameraChunks - visibleChunks
var/list/add = visibleChunks - ai.visibleCameraChunks
for(var/chunk in remove)
var/datum/camerachunk/c = chunk
c.remove(ai)
for(var/chunk in add)
var/datum/camerachunk/c = chunk
c.add(ai)
// Updates the chunks that the turf is located in. Use this when obstacles are destroyed or when doors open.
/datum/cameranet/proc/updateVisibility(atom/A, var/opacity_check = 1)
if(!ticker || (opacity_check && !A.opacity))
return
majorChunkChange(A, 2)
/datum/cameranet/proc/updateChunk(x, y, z)
// 0xf = 15
if(!chunkGenerated(x, y, z))
return
var/datum/camerachunk/chunk = getCameraChunk(x, y, z)
chunk.hasChanged()
// Removes a camera from a chunk.
/datum/cameranet/proc/removeCamera(obj/machinery/camera/c)
if(c.can_use())
majorChunkChange(c, 0)
// Add a camera to a chunk.
/datum/cameranet/proc/addCamera(obj/machinery/camera/c)
if(c.can_use())
majorChunkChange(c, 1)
// Used for Cyborg cameras. Since portable cameras can be in ANY chunk.
/datum/cameranet/proc/updatePortableCamera(obj/machinery/camera/c)
if(c.can_use())
majorChunkChange(c, 1)
//else
// majorChunkChange(c, 0)
// Never access this proc directly!!!!
// This will update the chunk and all the surrounding chunks.
// It will also add the atom to the cameras list if you set the choice to 1.
// Setting the choice to 0 will remove the camera from the chunks.
// If you want to update the chunks around an object, without adding/removing a camera, use choice 2.
/datum/cameranet/proc/majorChunkChange(atom/c, var/choice)
// 0xf = 15
if(!c)
return
var/turf/T = get_turf(c)
if(T)
var/x1 = max(0, T.x - 8) & ~0xf
var/y1 = max(0, T.y - 8) & ~0xf
var/x2 = min(world.maxx, T.x + 8) & ~0xf
var/y2 = min(world.maxy, T.y + 8) & ~0xf
//world << "X1: [x1] - Y1: [y1] - X2: [x2] - Y2: [y2]"
for(var/x = x1; x <= x2; x += 16)
for(var/y = y1; y <= y2; y += 16)
if(chunkGenerated(x, y, T.z))
var/datum/camerachunk/chunk = getCameraChunk(x, y, T.z)
if(choice == 0)
// Remove the camera.
chunk.cameras -= c
else if(choice == 1)
// You can't have the same camera in the list twice.
chunk.cameras |= c
chunk.hasChanged()
// Will check if a mob is on a viewable turf. Returns 1 if it is, otherwise returns 0.
/datum/cameranet/proc/checkCameraVis(mob/living/target as mob)
// 0xf = 15
var/turf/position = get_turf(target)
var/datum/camerachunk/chunk = getCameraChunk(position.x, position.y, position.z)
if(chunk)
if(chunk.changed)
chunk.hasChanged(1) // Update now, no matter if it's visible or not.
if(chunk.visibleTurfs[position])
return 1
return 0
// Debug verb for VVing the chunk that the turf is in.
/*
/turf/verb/view_chunk()
set src in world
if(cameranet.chunkGenerated(x, y, z))
var/datum/camerachunk/chunk = cameranet.getCameraChunk(x, y, z)
usr.client.debug_variables(chunk)
*/
*/
return c.can_use()

View File

@@ -1,4 +1,3 @@
/datum/visibility_chunk/camera
/datum/visibility_chunk/camera/validViewpoint(var/viewpoint)
@@ -21,176 +20,4 @@
/datum/visibility_chunk/camera/findNearbyViewpoints()
for(var/obj/machinery/camera/c in range(16, locate(x + 8, y + 8, z)))
if(c.can_use())
viewpoints += c
/*
#define UPDATE_BUFFER 25 // 2.5 seconds
// CAMERA CHUNK
//
// A 16x16 grid of the map with a list of turfs that can be seen, are visible and are dimmed.
// Allows the AI Eye to stream these chunks and know what it can and cannot see.
/datum/camerachunk
var/list/obscuredTurfs = list()
var/list/visibleTurfs = list()
var/list/obscured = list()
var/list/cameras = list()
var/list/turfs = list()
var/list/seenby = list()
var/visible = 0
var/changed = 0
var/updating = 0
var/x = 0
var/y = 0
var/z = 0
// Add an AI eye to the chunk, then update if changed.
/datum/camerachunk/proc/add(mob/aiEye/ai)
if(!ai.ai)
return
ai.visibleCameraChunks += src
if(ai.ai.client)
ai.ai.client.images += obscured
visible++
seenby += ai
if(changed && !updating)
update()
// Remove an AI eye from the chunk, then update if changed.
/datum/camerachunk/proc/remove(mob/aiEye/ai)
if(!ai.ai)
return
ai.visibleCameraChunks -= src
if(ai.ai.client)
ai.ai.client.images -= obscured
seenby -= ai
if(visible > 0)
visible--
// Called when a chunk has changed. I.E: A wall was deleted.
/datum/camerachunk/proc/visibilityChanged(turf/loc)
if(!visibleTurfs[loc])
return
hasChanged()
// Updates the chunk, makes sure that it doesn't update too much. If the chunk isn't being watched it will
// instead be flagged to update the next time an AI Eye moves near it.
/datum/camerachunk/proc/hasChanged(var/update_now = 0)
if(visible || update_now)
if(!updating)
updating = 1
spawn(UPDATE_BUFFER) // Batch large changes, such as many doors opening or closing at once
update()
updating = 0
else
changed = 1
// The actual updating. It gathers the visible turfs from cameras and puts them into the appropiate lists.
/datum/camerachunk/proc/update()
set background = 1
var/list/newVisibleTurfs = list()
for(var/camera in cameras)
var/obj/machinery/camera/c = camera
if(!c)
continue
if(!c.can_use())
continue
var/turf/point = locate(src.x + 8, src.y + 8, src.z)
if(get_dist(point, c) > 24)
continue
for(var/turf/t in c.can_see())
newVisibleTurfs[t] = t
// Removes turf that isn't in turfs.
newVisibleTurfs &= turfs
var/list/visAdded = newVisibleTurfs - visibleTurfs
var/list/visRemoved = visibleTurfs - newVisibleTurfs
visibleTurfs = newVisibleTurfs
obscuredTurfs = turfs - newVisibleTurfs
for(var/turf in visAdded)
var/turf/t = turf
if(t.obscured)
obscured -= t.obscured
for(var/eye in seenby)
var/mob/aiEye/m = eye
if(!m || !m.ai)
continue
if(m.ai.client)
m.ai.client.images -= t.obscured
for(var/turf in visRemoved)
var/turf/t = turf
if(obscuredTurfs[t])
if(!t.obscured)
t.obscured = image('icons/effects/cameravis.dmi', t, "black", 15)
obscured += t.obscured
for(var/eye in seenby)
var/mob/aiEye/m = eye
if(!m || !m.ai)
seenby -= m
continue
if(m.ai.client)
m.ai.client.images += t.obscured
// Create a new camera chunk, since the chunks are made as they are needed.
/datum/camerachunk/New(loc, x, y, z)
// 0xf = 15
x &= ~0xf
y &= ~0xf
src.x = x
src.y = y
src.z = z
for(var/obj/machinery/camera/c in range(16, locate(x + 8, y + 8, z)))
if(c.can_use())
cameras += c
for(var/turf/t in range(10, locate(x + 8, y + 8, z)))
if(t.x >= x && t.y >= y && t.x < x + 16 && t.y < y + 16)
turfs[t] = t
for(var/camera in cameras)
var/obj/machinery/camera/c = camera
if(!c)
continue
if(!c.can_use())
continue
for(var/turf/t in c.can_see())
visibleTurfs[t] = t
// Removes turf that isn't in turfs.
visibleTurfs &= turfs
obscuredTurfs = turfs - visibleTurfs
for(var/turf in obscuredTurfs)
var/turf/t = turf
if(!t.obscured)
t.obscured = image('icons/effects/cameravis.dmi', t, "black", 15)
obscured += t.obscured
#undef UPDATE_BUFFER
*/
viewpoints += c

View File

@@ -40,7 +40,6 @@
// It will also stream the chunk that the new loc is in.
/mob/aiEye/proc/setLoc(var/T)
if(ai)
if(!isturf(ai.loc))
return

View File

@@ -1,23 +1,5 @@
#define BORG_CAMERA_BUFFER 30
// ROBOT MOVEMENT
// Update the portable camera everytime the Robot moves.
// This might be laggy, comment it out if there are problems.
/mob/living/silicon/robot/var/updating = 0
/mob/living/silicon/robot/Move()
var/oldLoc = src.loc
. = ..()
if(.)
if(src.camera && src.camera.network.len)
if(!updating)
updating = 1
spawn(BORG_CAMERA_BUFFER)
if(oldLoc != src.loc)
cameraNetwork.updateViewpoint(src.camera)
updating = 0
// CAMERA
// An addition to deactivate which removes/adds the camera from the chunk list based on if it works or not.

View File

@@ -106,6 +106,9 @@
camera.network = list("SS13","Robots")
if(isWireCut(5)) // 5 = BORG CAMERA
camera.status = 0
// hook the robot into the camera network
addToVisibilityNetwork(cameraNetwork)
initialize_components()
//if(!unfinished)
@@ -143,6 +146,8 @@
if(T) mmi.loc = T
if(mind) mind.transfer_to(mmi.brainmob)
mmi = null
// remove blown up robots from the visibility network
removeFromVisibilityNetwork(cameraNetwork)
..()
/mob/living/silicon/robot/proc/pick_module()

View File

@@ -1,4 +1,4 @@
/*
/*
This file contains the code necessary to do the display code for cult spirits.
@@ -6,3 +6,75 @@ It reuses a lot of code from the AIEye cameraNetwork. In order to work properly,
*/
/proc/isCultRune(var/viewpoint)
var/obj/effect/rune/test_rune = viewpoint
if (test_rune)
return TRUE
return FALSE
/proc/isCultViewpoint(var/viewpoint)
var/obj/cult_viewpoint/vp = viewpoint
if (vp)
return TRUE
return FALSE
/datum/visibility_chunk/cult/validViewpoint(var/atom/viewpoint)
var/turf/point = locate(src.x + 8, src.y + 8, src.z)
if(get_dist(point, viewpoint) > 24)
return FALSE
if (isCultRune(viewpoint) || isCultViewpoint(viewpoint))
return viewpoint:can_use()
return FALSE
/datum/visibility_chunk/cult/getVisibleTurfsForViewpoint(var/viewpoint)
var/obj/effect/rune/rune = viewpoint
if (rune)
return rune.can_see()
var/obj/cult_viewpoint/cvp = viewpoint
if (cvp)
return cvp.can_see()
return null
/datum/visibility_chunk/cult/findNearbyViewpoints()
for(var/obj/cult_viewpoint/vp in range(16, locate(x + 8, y + 8, z)))
if(vp.can_use())
viewpoints += vp
for(var/obj/effect/rune/rune in range(16, locate(x + 8, y + 8, z)))
viewpoints += rune
/datum/visibility_network/cult
ChunkType = /datum/visibility_chunk/cult
/datum/visibility_network/cult/validViewpoint(var/viewpoint)
if (isCultRune(viewpoint) || isCultViewpoint(viewpoint))
return viewpoint:can_use()
return FALSE
/datum/visibility_network/cult/getViewpointFromMob(var/mob/currentMob)
for(var/obj/cult_viewpoint/currentView in currentMob)
return currentView
return FALSE
/datum/visibility_interface/cult
chunk_type = /datum/visibility_chunk/cult
/*
RUNE JUNK
*/
/obj/effect/rune/proc/can_use()
return TRUE
/obj/effect/rune/proc/can_see()
return hear(view_range, get_turf(src))

View File

@@ -0,0 +1,171 @@
mob/spirit/mask
mob/spirit/mask/New()
..()
spell_list += new /obj/effect/proc_holder/spell/aoe_turf/conjure/create_talisman(src)
spell_list += new /obj/effect/proc_holder/spell/aoe_turf/blood_speech(src)
mob/spirit/mask/verb/go_to_follower()
set category = "Mask"
set name = "Go to follower"
set desc = "Select who you would like to go too."
var/obj/cult_viewpoint/cultist = pick_cultist()
if (cultist)
follow_cultist(cultist.owner)
src << "You start following [cultist.get_display_name()]."
mob/spirit/mask/verb/set_specific_urge()
set category = "Mask"
set name = "Set urge on cultist"
set desc = "Set urge on target"
var/obj/cult_viewpoint/cultist = pick_cultist()
if (cultist)
var/newUrge = stripped_input(usr, "", "Set Urge", "")
cultist.set_urge(newUrge)
src << "You urge [cultist.owner.name] to [newUrge]."
mob/spirit/mask/verb/set_cult_name()
set category = "Mask"
set name = "Set Cult Name"
set desc = "Grant a cultist a name."
var/obj/cult_viewpoint/cultist = pick_cultist()
if (cultist)
var/newName = stripped_input(usr, "", "Set Cult Name", "")
if (!newName)
return
cultist.set_cult_name(newName)
src << "You grant [cultist.owner.name] the secret name of [newName]."
mob/spirit/mask/verb/set_global_urge()
set category = "Mask"
set name = "Set global urge"
set desc = "Set urge on the entire cult."
var/newUrge = stripped_input(usr, "Please choose an urge.", "Set Urge", "")
for(var/obj/cult_viewpoint/viewpoint in cult_viewpoints)
viewpoint.set_urge(newUrge)
src << "You urge the entire cult to [newUrge]."
mob/spirit/mask/verb/set_favor_for_cultist()
set category = "Mask"
set name = "Show your favor"
set desc = "Set the favor for a cultist"
var/obj/cult_viewpoint/cultist = pick_cultist()
if (cultist)
var/list/favor = list("Pleased", "Displeased", "Indifference")
var/emotion = input("Pick your emotion", "Mask", null, null) in favor
switch(emotion)
if("Pleased")
cultist.set_favor(1)
if("Displeased")
cultist.set_favor(-1)
if("Indifference")
cultist.set_favor(0)
mob/spirit/mask/proc/set_name()
var/newName = stripped_input(usr, "Please pick a name.", "Pick Name for Mask", "")
name = newName ? newName : "Mask of Nar'sie"
mob/spirit/mask/proc/pick_cultist()
var/list/cultists = list()
for(var/obj/cult_viewpoint/viewpoint in cult_viewpoints)
cultists[viewpoint.get_display_name()]=viewpoint
var/input = input("Please, select a cultist!", "Cult", null, null) as null|anything in cultists
var/obj/cult_viewpoint/result = cultists[input]
return result
// SPELLS
/obj/effect/proc_holder/spell/aoe_turf/blood_speech
name = "Speak to your Acolytes"
desc = "This spell allows you to speak to your flock."
school = "unknown evil"
charge_type = "recharge"
charge_max = 300
clothes_req = 0
invocation = "none"
invocation_type = "none"
range = 0
/obj/effect/proc_holder/spell/aoe_turf/blood_speech/cast(list/targets)
var/input = stripped_input(usr, "Please choose a message to tell your acolytes.", "Voice of Blood", "")
if(!input)
revert_cast(usr)
for(var/datum/mind/H in ticker.mode.cult)
if (H.current)
H.current << "<span class='cultspeech'><font size=3><span class='name'>[usr.name]: </span><span class='message'>[input]</span></font></span>"
for(var/mob/spirit/spirit in spirits)
spirit << "<span class='cultspeech'><font size=3><span class='name'>[usr.name]: </span><span class='message'>[input]</span></font></span>"
/obj/effect/proc_holder/spell/aoe_turf/conjure/create_talisman
name = "Create Talisman"
desc = "This spell conjures a talisman"
school = "conjuration"
charge_type = "recharge"
charge_max = 300
clothes_req = 0
invocation = "none"
invocation_type = "none"
range = 0
summon_type = list(/obj/item/weapon/paper/talisman)
var/list/talismans = list( "Armor"="armor",
"Blind"="blind",
"Conceal"="conceal",
"Communicate"="communicate",
"Deafen"="deafen",
"EMP"="emp",
"Teleport"="teleport",
"Tome"="newtome",
"Reveal Runes",
"Stun"="runestun",
"Soul Stone"="soulstone",
"Construct"="construct")
/obj/effect/proc_holder/spell/aoe_turf/conjure/create_talisman/cast(list/targets)
var/talisman = input("Pick a talisman type", "Talisman", null, null) as null|anything in talismans
var/imbue_value = talismans[talisman]
if (!talisman)
usr << "You choose not to create a talisman."
revert_cast(usr)
return
switch(talisman)
if ("Teleport")
var/target_rune = input("Pick a teleport target", "Teleport Rune", null, null) as null|anything in engwords
if (!target_rune)
usr << "You choose not to create a talisman."
revert_cast(usr)
return
summon_type = list(/obj/item/weapon/paper/talisman)
newVars = list("imbue" = "[target_rune]", "info" = "[target_rune]")
if ("Soul Stone")
summon_type = list(/obj/item/device/soulstone)
newVars = list()
if ("Construct")
summon_type = list(/obj/structure/constructshell)
newVars = list()
else
summon_type = list(/obj/item/weapon/paper/talisman)
newVars = list("imbue" = "[imbue_value]")
..()

View File

@@ -27,10 +27,30 @@ mob/spirit/proc/Spirit_Move(direct)
// if we're trying to move, we want to stop following our target
follow_target = null
/mob/spirit/proc/follow_cultist(mob/living/target as mob)
if(!istype(target)) return
var/obj/cult_viewpoint/currentView = getCultViewpoint(target)
var/mob/spirit/U = usr
if (!currentView)
U << "As a spirit, you may only track cultists."
U.follow_target = target
U << "Now following [currentView.get_cult_name()]."
spawn (0)
while (U.follow_target == target)
if (U.follow_target == null)
return
U.setLoc(get_turf(target))
sleep(10)
mob/spirit/proc/setLoc(var/T)
T = get_turf(T)
loc = T
//cultnet.visibility(src)
cultNetwork.visibility(src)
mob/spirit/verb/toggle_acceleration()
set category = "Spirit"

View File

@@ -1,13 +1,5 @@
/*
This mob type is used for entities that exist within the Cult's spirit world. They share the same visibility network and are intangible.
NOTES
- make chunks generic
- subclass them for camerachunks and for cultchunks
- do the same thing with visibility networks
- cultnet and cameraNetwork etc.
*/
mob/spirit
@@ -22,7 +14,9 @@ mob/spirit
canmove = 0
blinded = 0
anchored = 1
mouse_opacity = 0
invisibility = INVISIBILITY_SPIRIT
universal_speak = 1
// pseudo-movement values
var/sprint = 10
@@ -30,13 +24,53 @@ mob/spirit
var/acceleration = 1
var/follow_target = null
mob/spirit/is_active()
if (client && client.inactivity <= 10 * 60 * 10)
return TRUE
return FALSE
mob/spirit/New()
sight |= SEE_TURFS | SEE_MOBS | SEE_OBJS | SEE_SELF
see_invisible = SEE_SPIRITS
see_in_dark = 100
loc = pick(latejoin)
// hook them to the cult visibility network
visibility_interface = new /datum/visibility_interface/cult(src)
// no nameless spirits
if (!name)
name = "Boogyman"
name = "Boogyman"
spirits+=src
..()
mob/spirit/Del()
spirits-=src
..()
mob/spirit/Topic(href, href_list)
world << "Spirit Topic!"
usr << "Topic: usr [usr], src [src]"
src << "Topic: usr [usr], src [src]"
if(usr != src)
return
..()
usr << "Spirit Href = [href]"
for (var/tempref in href_list)
usr << "Spirit href list [tempref] = [href_list[tempref]]"
if (href_list["track"])
usr << "Got to tracking."
var/mob/target = locate(href_list["track"]) in mob_list
var/mob/spirit/A = locate(href_list["track2"]) in spirits
if(A && target)
A.follow_cultist(target)
return

View File

@@ -0,0 +1,195 @@
#define FAVOR_PLEASED 1
#define FAVOR_INDIFFERENT 0
#define FAVOR_DISPLEASED -1
var/obj/cult_viewpoint/list/cult_viewpoints = list()
/obj/cult_viewpoint
var/view_range = 7
var/updating = 0
var/mob/owner = null
var/urge = ""
var/favor = FAVOR_INDIFFERENT
var/cult_name = null
/obj/cult_viewpoint/New(var/mob/target)
owner = target
//src.loc = owner
owner.addToVisibilityNetwork(cultNetwork)
cultNetwork.viewpoints+=src
cultNetwork.addViewpoint(src)
cult_viewpoints+=src
//handle_missing_mask()
..()
/obj/cult_viewpoint/Del()
processing_objects.Remove(src)
cultNetwork.viewpoints-=src
cultNetwork.removeViewpoint(src)
cult_viewpoints-=src
owner.removeFromVisibilityNetwork(cultNetwork)
..()
return
// VERBS
/obj/cult_viewpoint/verb/check_urge()
set category = "Cult"
set desc = "Discover what your god commands of you."
set name = "Check Urge"
set src in usr
if (src.urge)
owner << "\red \b You feel the urge to [src.urge]"
else
owner << "\b You feel no supernatural compulsions."
/obj/cult_viewpoint/verb/reach_out()
set category = "Cult"
set desc = "Reach out for your gods presence."
set name = "Reach Out"
set src in usr
for(var/mob/spirit/mask/currentMask in spirits)
if (currentMask.is_active())
owner << "\red \b You feel the reassuring presence of your god."
currentMask << "<span class='cultspeech'><span class='name'><a href='byond://?src=\ref[currentMask];track2=\ref[currentMask];track=\ref[usr]'>[get_display_name()]</a></span><span class='message'> has reached out to you.</span></span>"
return
owner << "\b You feel a chilling absence."
handle_missing_mask()
/obj/cult_viewpoint/verb/check_favor()
set category = "Cult"
set desc = "Check your favor with your god."
set name = "Check Favor"
set src in usr
switch(favor)
if(FAVOR_PLEASED)
owner << "\red \b You bask in your gods favor."
if(FAVOR_INDIFFERENT)
owner << "\red \b You feel nothing."
if(FAVOR_DISPLEASED)
owner << "\red \b You cringe at your gods displeasure."
/obj/cult_viewpoint/verb/pray_to_mask()
set category = "Cult"
set desc = "Pray to your god"
set name = "Pray to Nar'Sie"
set src in usr
var/input = stripped_input(usr, "Please choose a message to say to your god.", "Pray to Nar'Sie", "")
if(!input)
return
owner << "<span class='cultspeech'><b>You pray to Nar'Sie</b>: [input]</span>"
for(var/mob/spirit/spirit in spirits)
spirit << "<span class='cultspeech'><span class='name'><a href='byond://?src=\ref[spirit];track2=\ref[spirit];track=\ref[usr]'>[get_display_name()]</a> prays : </span><span class='message'>[input]</span></span>"
// PROCS
/obj/cult_viewpoint/proc/set_favor(var/newFavor)
favor = newFavor
check_favor()
/obj/cult_viewpoint/proc/set_urge(var/newUrge)
if (!newUrge)
src.urge = null
src.urge = copytext(newUrge, 1, MAX_MESSAGE_LEN)
check_urge()
/obj/cult_viewpoint/proc/can_use()
if (owner.stat != DEAD)
return TRUE
return FALSE
/obj/cult_viewpoint/proc/can_see()
return hear(view_range, get_turf(owner))
/obj/cult_viewpoint/proc/get_cult_name()
if (cult_name)
return cult_name
return "An Unknown Servent"
/obj/cult_viewpoint/proc/set_cult_name(var/newName)
if (!owner)
return FALSE
if (newName)
cult_name = newName
owner << "\red \b You have been blessed with the secret name of '[newName]'."
else
cult_name = null
owner << "\red \b Your god has taken your secret name."
/obj/cult_viewpoint/proc/get_display_name()
if (!owner)
return
if (cult_name)
return cult_name
return owner.name
/obj/cult_viewpoint/proc/become_mask()
set category = "Cult"
set name = "Become Mask"
set desc = "Sacrifice your life and become a Mask of Nar'sie."
set src in usr
if (!active_mask())
var/transformation_type = alert(owner.client, "You are about to become a Mask. Do you want it to be subtle or violent?", "Mask", "Subtle", "Violent")
if(!active_mask())
if (transformation_type=="Subtle")
owner.make_into_mask(0,0)
else
owner.make_into_mask(1,1)
else
owner << "\b You cannot become a mask of Nar'Sie because a Mask already exists."
mask_has_been_found()
return
/obj/cult_viewpoint/proc/active_mask()
for(var/mob/spirit/mask/currentMask in spirits)
if (currentMask.is_active())
return TRUE
return FALSE
/obj/cult_viewpoint/proc/handle_missing_mask()
if (active_mask())
mask_has_been_found()
else
mask_is_missing()
/obj/cult_viewpoint/proc/mask_has_been_found()
for(var/obj/cult_viewpoint/viewpoint in cult_viewpoints)
if (viewpoint.verbs.Find(/obj/cult_viewpoint/proc/become_mask))
viewpoint.verbs-=/obj/cult_viewpoint/proc/become_mask
/obj/cult_viewpoint/proc/mask_is_missing()
for(var/obj/cult_viewpoint/viewpoint in cult_viewpoints)
if (!viewpoint.verbs.Find(/obj/cult_viewpoint/proc/become_mask))
viewpoint.verbs+=/obj/cult_viewpoint/proc/become_mask
/proc/getCultViewpoint(var/mob/currentMob)
for(var/obj/cult_viewpoint/currentView in currentMob)
return currentView
return FALSE
#undef FAVOR_PLEASED
#undef FAVOR_INDIFFERENT
#undef FAVOR_DISPLEASED

View File

@@ -133,7 +133,71 @@
. = O
del(src)
/mob/living/carbon/human/make_into_mask(var/should_gib = 0)
for(var/t in organs)
del(t)
return ..(should_gib)
/mob/proc/make_into_mask(var/should_gib = 0, var/should_remove_items = 0)
if (should_gib)
var/mob/spirit/mask/new_spirit = new()
if(mind)
new_spirit.mind = mind
new_spirit.mind.assigned_role = "Mask"
new_spirit.mind.original = new_spirit
new_spirit.key = key
new_spirit.loc=loc
spawn(0)
src.gib() // gib the body
new_spirit.set_name()
// let spirits identify cultists
if(ticker.mode)
ticker.mode.reset_cult_icons_for_spirit(new_spirit)
return new_spirit
else
if(should_remove_items)
for(var/obj/item/W in src)
drop_from_inventory(W)
icon = null
invisibility = 101
var/mob/spirit/mask/new_spirit = new()
if(mind)
new_spirit.mind = mind
new_spirit.mind.assigned_role = "Mask"
new_spirit.mind.original = new_spirit
new_spirit.key = key
new_spirit.loc=loc
spawn(0)//To prevent the proc from returning null.
src.visible_message( \
"[src] disappears into the shadows, never to be seen again.", \
"You disappear into the shadows, never to be seen again.", \
"You hear strange noise, you can't quite place it.")
del(src)
new_spirit.set_name()
// let spirits identify cultists
if(ticker.mode)
ticker.mode.reset_cult_icons_for_spirit(new_spirit)
return new_spirit
//human -> robot
/mob/living/carbon/human/proc/Robotize()
if (monkeyizing)

View File

@@ -63,6 +63,7 @@ h1.alert, h2.alert {color: #000000;}
.skrell {color: #00CED1;}
.soghun {color: #228B22;}
.vox {color: #AA00AA;}
.cultspeech {color: #B20000;}
.say_quote {font-family: Georgia, Verdana, sans-serif;}
.interface {color: #330033;}