diff --git a/baystation12.dme b/baystation12.dme index 9a80618226..915c098b3e 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -1051,13 +1051,24 @@ #include "code\modules\mob\typing_indicator.dm" #include "code\modules\mob\update_icons.dm" #include "code\modules\mob\dead\death.dm" +#include "code\modules\mob\dead\observer\login.dm" #include "code\modules\mob\dead\observer\logout.dm" #include "code\modules\mob\dead\observer\observer.dm" #include "code\modules\mob\dead\observer\say.dm" #include "code\modules\mob\freelook\chunk.dm" #include "code\modules\mob\freelook\eye.dm" +#include "code\modules\mob\freelook\life.dm" +#include "code\modules\mob\freelook\read_me.dm" #include "code\modules\mob\freelook\update_triggers.dm" #include "code\modules\mob\freelook\visualnet.dm" +#include "code\modules\mob\freelook\ai\cameranet.dm" +#include "code\modules\mob\freelook\ai\chunk.dm" +#include "code\modules\mob\freelook\ai\eye.dm" +#include "code\modules\mob\freelook\ai\update_triggers.dm" +#include "code\modules\mob\freelook\mask\chunk.dm" +#include "code\modules\mob\freelook\mask\cultnet.dm" +#include "code\modules\mob\freelook\mask\eye.dm" +#include "code\modules\mob\freelook\mask\update_triggers.dm" #include "code\modules\mob\language\generic.dm" #include "code\modules\mob\language\language.dm" #include "code\modules\mob\language\monkey.dm" @@ -1174,11 +1185,6 @@ #include "code\modules\mob\living\silicon\ai\logout.dm" #include "code\modules\mob\living\silicon\ai\say.dm" #include "code\modules\mob\living\silicon\ai\subsystems.dm" -#include "code\modules\mob\living\silicon\ai\freelook\cameranet.dm" -#include "code\modules\mob\living\silicon\ai\freelook\chunk.dm" -#include "code\modules\mob\living\silicon\ai\freelook\eye.dm" -#include "code\modules\mob\living\silicon\ai\freelook\read_me.dm" -#include "code\modules\mob\living\silicon\ai\freelook\update_triggers.dm" #include "code\modules\mob\living\silicon\decoy\death.dm" #include "code\modules\mob\living\silicon\decoy\decoy.dm" #include "code\modules\mob\living\silicon\decoy\life.dm" diff --git a/code/__HELPERS/global_lists.dm b/code/__HELPERS/global_lists.dm index 01b9509ae8..50c08172e1 100644 --- a/code/__HELPERS/global_lists.dm +++ b/code/__HELPERS/global_lists.dm @@ -49,6 +49,11 @@ var/global/list/undershirt_t = list("White Tank top" = "u1", "Black Tank top" = //Backpacks var/global/list/backbaglist = list("Nothing", "Backpack", "Satchel", "Satchel Alt") var/global/list/exclude_jobs = list(/datum/job/ai,/datum/job/cyborg) + +// Visual nets +var/list/datum/visualnet/visual_nets = list() +var/datum/visualnet/camera/cameranet = new() +var/datum/visualnet/cult/cultnet = new() ////////////////////////// /////Initial Building///// ////////////////////////// diff --git a/code/_onclick/hud/hud.dm b/code/_onclick/hud/hud.dm index c41f9594b3..01ead8282c 100644 --- a/code/_onclick/hud/hud.dm +++ b/code/_onclick/hud/hud.dm @@ -33,7 +33,7 @@ var/list/global_huds = list( screen.screen_loc = "1,1" screen.icon = 'icons/obj/hud_full.dmi' screen.icon_state = icon_state - screen.layer = 17 + screen.layer = SCREEN_LAYER screen.mouse_opacity = 0 return screen diff --git a/code/game/gamemodes/cult/cult.dm b/code/game/gamemodes/cult/cult.dm index 6a17d03a07..a1c0acf008 100644 --- a/code/game/gamemodes/cult/cult.dm +++ b/code/game/gamemodes/cult/cult.dm @@ -8,4 +8,4 @@ required_enemies = 3 uplink_welcome = "Nar-Sie Uplink Console:" end_on_antag_death = 1 - antag_tag = MODE_CULTIST \ No newline at end of file + antag_tag = MODE_CULTIST diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index f7058921da..2e497d14a5 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -1,7 +1,4 @@ //This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31 -#define DOOR_OPEN_LAYER 2.7 //Under all objects if opened. 2.7 due to tables being at 2.6 -#define DOOR_CLOSED_LAYER 3.1 //Above most items if closed - #define DOOR_REPAIR_AMOUNT 50 //amount of health regained per stack amount used /obj/machinery/door diff --git a/code/modules/mob/living/silicon/ai/freelook/cameranet.dm b/code/modules/mob/freelook/ai/cameranet.dm similarity index 93% rename from code/modules/mob/living/silicon/ai/freelook/cameranet.dm rename to code/modules/mob/freelook/ai/cameranet.dm index d2d042c778..2fb3c4b5ce 100644 --- a/code/modules/mob/living/silicon/ai/freelook/cameranet.dm +++ b/code/modules/mob/freelook/ai/cameranet.dm @@ -2,8 +2,6 @@ // // The datum containing all the chunks. -var/datum/visualnet/camera/cameranet = new() - /datum/visualnet/camera // 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() diff --git a/code/modules/mob/living/silicon/ai/freelook/chunk.dm b/code/modules/mob/freelook/ai/chunk.dm similarity index 100% rename from code/modules/mob/living/silicon/ai/freelook/chunk.dm rename to code/modules/mob/freelook/ai/chunk.dm diff --git a/code/modules/mob/living/silicon/ai/freelook/eye.dm b/code/modules/mob/freelook/ai/eye.dm similarity index 100% rename from code/modules/mob/living/silicon/ai/freelook/eye.dm rename to code/modules/mob/freelook/ai/eye.dm diff --git a/code/modules/mob/living/silicon/ai/freelook/update_triggers.dm b/code/modules/mob/freelook/ai/update_triggers.dm similarity index 100% rename from code/modules/mob/living/silicon/ai/freelook/update_triggers.dm rename to code/modules/mob/freelook/ai/update_triggers.dm diff --git a/code/modules/mob/freelook/chunk.dm b/code/modules/mob/freelook/chunk.dm index 8c6c7d043a..9b6b562df3 100644 --- a/code/modules/mob/freelook/chunk.dm +++ b/code/modules/mob/freelook/chunk.dm @@ -101,7 +101,7 @@ var/turf/t = turf if(obscuredTurfs[t]) if(!t.obfuscations[obfuscation.type]) - t.obfuscations[obfuscation.type] = image(obfuscation.icon, t, obfuscation.icon_state, 15) + t.obfuscations[obfuscation.type] = image(obfuscation.icon, t, obfuscation.icon_state, OBFUSCATION_LAYER) obscured += t.obfuscations[obfuscation.type] for(var/eye in seenby) @@ -140,7 +140,7 @@ for(var/turf in obscuredTurfs) var/turf/t = turf if(!t.obfuscations[obfuscation.type]) - t.obfuscations[obfuscation.type] = image(obfuscation.icon, t, obfuscation.icon_state, 15) + t.obfuscations[obfuscation.type] = image(obfuscation.icon, t, obfuscation.icon_state, OBFUSCATION_LAYER) obscured += t.obfuscations[obfuscation.type] #undef UPDATE_BUFFER diff --git a/code/modules/mob/freelook/eye.dm b/code/modules/mob/freelook/eye.dm index 70ae8cb700..318ed4da6e 100644 --- a/code/modules/mob/freelook/eye.dm +++ b/code/modules/mob/freelook/eye.dm @@ -12,6 +12,7 @@ var/sprint = 10 var/cooldown = 0 var/acceleration = 1 + var/owner_follows_eye = 0 see_in_dark = 7 status_flags = GODMODE @@ -40,7 +41,9 @@ mob/eye/Del() ..() // Movement code. Returns 0 to stop air movement from moving it. -/mob/eye/Move() +/mob/eye/Move(n, direct) + if(owner == src) + EyeMove(n, direct) return 0 /mob/eye/examinate() @@ -60,15 +63,35 @@ mob/eye/Del() /mob/eye/proc/setLoc(var/T) if(owner) T = get_turf(T) - loc = T + if(T != loc) + loc = T - if(owner.client) - owner.client.eye = src + if(owner.client) + owner.client.eye = src - visualnet.visibility(src) - return 1 + if(owner_follows_eye) + visualnet.updateVisibility(owner, 0) + owner.loc = loc + visualnet.updateVisibility(owner, 0) + + visualnet.visibility(src) + return 1 return 0 +/mob/eye/proc/getLoc() + if(owner) + if(!isturf(owner.loc) || !owner.client) + return + return loc +/mob + var/mob/eye/eyeobj + +/mob/proc/EyeMove(n, direct) + if(!eyeobj) + return + + return eyeobj.EyeMove(n, direct) + /mob/eye/EyeMove(n, direct) var/initial = initial(sprint) var/max_sprint = 50 @@ -86,18 +109,3 @@ mob/eye/Del() sprint = min(sprint + 0.5, max_sprint) else sprint = initial - -/mob/eye/proc/getLoc() - if(owner) - if(!isturf(owner.loc) || !owner.client) - return - return loc - -/mob - var/mob/eye/eyeobj - -/mob/proc/EyeMove(n, direct) - if(!eyeobj) - return - - return eyeobj.EyeMove(n, direct) diff --git a/code/modules/mob/freelook/life.dm b/code/modules/mob/freelook/life.dm new file mode 100644 index 0000000000..1d1248e872 --- /dev/null +++ b/code/modules/mob/freelook/life.dm @@ -0,0 +1,7 @@ +/mob/eye/Life() + ..() + // If we lost our client, reset the list of visible chunks so they update properly on return + if(owner == src && !client) + visibleChunks.Cut() + /*else if(owner && !owner.client) + visibleChunks.Cut()*/ diff --git a/code/modules/mob/freelook/mask/chunk.dm b/code/modules/mob/freelook/mask/chunk.dm new file mode 100644 index 0000000000..b0973951cc --- /dev/null +++ b/code/modules/mob/freelook/mask/chunk.dm @@ -0,0 +1,39 @@ +// CULT CHUNK +// +// A 16x16 grid of the map with a list of turfs that can be seen, are visible and are dimmed. +// Allows the Eye to stream these chunks and know what it can and cannot see. + +/datum/obfuscation/cult + icon_state = "white" + +/datum/chunk/cult + obfuscation = new /datum/obfuscation/cult() + +/datum/chunk/cult/acquireVisibleTurfs(var/list/visible) + for(var/mob/living/L in living_mob_list) + for(var/turf/t in L.seen_turfs()) + visible[t] = t + +/mob/living/proc/seen_turfs() + return seen_turfs_in_range(src, 3) + +/mob/living/carbon/human/seen_turfs() + /*if(src.isSynthetic()) + return list()*/ + + if(mind in cult.current_antagonists) + return seen_turfs_in_range(src, client ? client.view : 7) + return ..() + +/mob/living/silicon/seen_turfs() + return list() + +/mob/living/simple_animal/seen_turfs() + return seen_turfs_in_range(src, 1) + +/mob/living/simple_animal/shade/narsie/seen_turfs() + return view(2, src) + +/proc/seen_turfs_in_range(var/source, var/range) + var/turf/pos = get_turf(source) + return hear(range, pos) diff --git a/code/modules/mob/freelook/mask/cultnet.dm b/code/modules/mob/freelook/mask/cultnet.dm new file mode 100644 index 0000000000..4e4e01b847 --- /dev/null +++ b/code/modules/mob/freelook/mask/cultnet.dm @@ -0,0 +1,15 @@ +// CULT NET +// +// The datum containing all the chunks. + +/datum/visualnet/cult + chunk_type = /datum/chunk/cult + +/datum/visualnet/cult/proc/provides_vision(var/mob/living/L) + return L.provides_cult_vision() + +/mob/living/proc/provides_cult_vision() + return 1 + +/mob/living/silicon/provides_cult_vision() + return 0 diff --git a/code/modules/mob/freelook/mask/eye.dm b/code/modules/mob/freelook/mask/eye.dm new file mode 100644 index 0000000000..a0a9960322 --- /dev/null +++ b/code/modules/mob/freelook/mask/eye.dm @@ -0,0 +1,13 @@ +// MASK EYE +// +// A mob that a cultists controls to look around the station with. +// It streams chunks as it moves around, which will show it what the cultist can and cannot see. + +/mob/eye/maskEye + name = "Eye of Nar-Sie" + acceleration = 0 + owner_follows_eye = 1 + +/mob/eye/maskEye/New() + ..() + visualnet = cultnet diff --git a/code/modules/mob/freelook/mask/update_triggers.dm b/code/modules/mob/freelook/mask/update_triggers.dm new file mode 100644 index 0000000000..a02aa864a6 --- /dev/null +++ b/code/modules/mob/freelook/mask/update_triggers.dm @@ -0,0 +1,50 @@ +//UPDATE TRIGGERS, when the chunk (and the surrounding chunks) should update. + +#define CULT_UPDATE_BUFFER 30 + +/mob/living/var/updating_cult_vision = 0 + +/mob/living/Move() + var/oldLoc = src.loc + . = ..() + if(.) + if(cultnet.provides_vision(src)) + if(!updating_cult_vision) + updating_cult_vision = 1 + spawn(CULT_UPDATE_BUFFER) + if(oldLoc != src.loc) + cultnet.updateVisibility(oldLoc, 0) + cultnet.updateVisibility(loc, 0) + updating_cult_vision = 0 + +#undef CULT_UPDATE_BUFFER + +/mob/living/New() + ..() + cultnet.updateVisibility(src, 0) + +/mob/living/Del() + cultnet.updateVisibility(src, 0) + ..() + +/mob/living/rejuvenate() + var/was_dead = stat == DEAD + ..() + if(was_dead && stat != DEAD) + // Arise! + cultnet.updateVisibility(src, 0) + +/mob/living/death() + if(..()) + // If true, the mob went from living to dead (assuming everyone has been overriding as they should...) + cultnet.updateVisibility(src) + +/datum/antagonist/add_antagonist(var/datum/mind/player) + ..() + if(src == cult) + cultnet.updateVisibility(player.current, 0) + +/datum/antagonist/remove_antagonist(var/datum/mind/player, var/show_message, var/implanted) + ..() + if(src == cult) + cultnet.updateVisibility(player.current, 0) diff --git a/code/modules/mob/living/silicon/ai/freelook/read_me.dm b/code/modules/mob/freelook/read_me.dm similarity index 100% rename from code/modules/mob/living/silicon/ai/freelook/read_me.dm rename to code/modules/mob/freelook/read_me.dm diff --git a/code/modules/mob/freelook/visualnet.dm b/code/modules/mob/freelook/visualnet.dm index dedc23ab2d..161aeb92b8 100644 --- a/code/modules/mob/freelook/visualnet.dm +++ b/code/modules/mob/freelook/visualnet.dm @@ -2,8 +2,6 @@ // // The datum containing all the chunks. -var/global/list/visual_nets = new() - /datum/visualnet // The chunks of the map, mapping the areas that an object can see. var/list/chunks = list() diff --git a/code/modules/mob/living/simple_animal/hostile/faithless.dm b/code/modules/mob/living/simple_animal/hostile/faithless.dm index 14b069a6a1..b1cc2067f4 100644 --- a/code/modules/mob/living/simple_animal/hostile/faithless.dm +++ b/code/modules/mob/living/simple_animal/hostile/faithless.dm @@ -46,4 +46,4 @@ if(istype(L)) if(prob(12)) L.Weaken(3) - L.visible_message("\the [src] knocks down \the [L]!") \ No newline at end of file + L.visible_message("\the [src] knocks down \the [L]!") diff --git a/code/modules/mob/living/simple_animal/shade.dm b/code/modules/mob/living/simple_animal/shade.dm index 98db91e7cc..d0d148aa2a 100644 --- a/code/modules/mob/living/simple_animal/shade.dm +++ b/code/modules/mob/living/simple_animal/shade.dm @@ -30,6 +30,14 @@ /mob/living/simple_animal/shade/Life() ..() + OnDeathInLife() + +/mob/living/simple_animal/shade/attackby(var/obj/item/O as obj, var/mob/user as mob) //Marker -Agouri + if(istype(O, /obj/item/device/soulstone)) + O.transfer_soul("SHADE", src, user) + return + +/mob/living/simple_animal/shade/proc/OnDeathInLife() if(stat == 2) new /obj/item/weapon/ectoplasm (src.loc) for(var/mob/M in viewers(src, null)) @@ -38,10 +46,3 @@ ghostize() del src return - - -/mob/living/simple_animal/shade/attackby(var/obj/item/O as obj, var/mob/user as mob) //Marker -Agouri - if(istype(O, /obj/item/device/soulstone)) - O.transfer_soul("SHADE", src, user) - return - return ..() diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 595ad0b672..6e8c1a7257 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -350,7 +350,7 @@ var/obj/machinery/bot/B = target_mob if(B.health > 0) return (0) - return (1) + return 1 //Call when target overlay should be added/removed /mob/living/simple_animal/update_targeted() diff --git a/code/setup.dm b/code/setup.dm index 564b96dc04..127c33f89f 100644 --- a/code/setup.dm +++ b/code/setup.dm @@ -864,3 +864,10 @@ var/list/be_special_flags = list( #define DROPLIMB_EDGE 0 #define DROPLIMB_BLUNT 1 #define DROPLIMB_BURN 2 + +// Custom layer definitions, supplementing the default TURF_LAYER, MOB_LAYER, etc. +#define DOOR_OPEN_LAYER 2.7 //Under all objects if opened. 2.7 due to tables being at 2.6 +#define DOOR_CLOSED_LAYER 3.1 //Above most items if closed +#define OBFUSCATION_LAYER 14 //Where images covering the view for eyes are put +#define SCREEN_LAYER 17 //Mob HUD/effects layer + diff --git a/icons/effects/cameravis.dmi b/icons/effects/cameravis.dmi index 3ecc9eb80a..2b819836fc 100644 Binary files a/icons/effects/cameravis.dmi and b/icons/effects/cameravis.dmi differ