Adds atom/movable cloaking framework

This commit is contained in:
Aronai Sieyes
2020-03-23 21:34:32 -04:00
parent afa6aa785e
commit c93c5afefa
11 changed files with 150 additions and 23 deletions
+3
View File
@@ -88,6 +88,9 @@ What is the naming convention for planes or layers?
#define BELOW_MOB_LAYER 3.9 // Should be converted to plane swaps
#define ABOVE_MOB_LAYER 4.1 // Should be converted to plane swaps
// Invisible things plane
#define CLOAKED_PLANE -15
// Top plane (in the sense that it's the highest in 'the world' and not a UI element)
#define ABOVE_PLANE -10
+3 -1
View File
@@ -396,7 +396,9 @@
#define VIS_BUILDMODE 22
#define VIS_COUNT 22 //Must be highest number from above.
#define VIS_CLOAKED 23
#define VIS_COUNT 23 //Must be highest number from above.
//Some mob icon layering defines
#define BODY_LAYER -100
+93
View File
@@ -24,6 +24,9 @@
var/datum/riding/riding_datum //VOREStation Add - Moved from /obj/vehicle
var/does_spin = TRUE // Does the atom spin when thrown (of course it does :P)
var/movement_type = NONE
var/cloaked = FALSE //If we're cloaked or not
var/image/cloaked_selfimage //The image we use for our client to let them see where we are
/atom/movable/Destroy()
. = ..()
@@ -516,3 +519,93 @@
// Called when touching a lava tile.
/atom/movable/proc/lava_act()
fire_act(null, 10000, 1000)
// Procs to cloak/uncloak
/atom/movable/proc/cloak()
if(cloaked)
return FALSE
cloaked = TRUE
. = TRUE // We did work
var/static/animation_time = 1 SECOND
cloaked_selfimage = get_cloaked_selfimage()
//Wheeee
cloak_animation(animation_time)
//Needs to be last so people can actually see the effect before we become invisible
plane = CLOAKED_PLANE
/atom/movable/proc/uncloak()
if(!cloaked)
return FALSE
cloaked = FALSE
. = TRUE // We did work
var/static/animation_time = 1 SECOND
QDEL_NULL(cloaked_selfimage)
//Needs to be first so people can actually see the effect, so become uninvisible first
plane = initial(plane)
//Oooooo
uncloak_animation(animation_time)
// Animations for cloaking/uncloaking
/atom/movable/proc/cloak_animation(var/length = 1 SECOND)
//Save these
var/initial_alpha = alpha
//Animate alpha fade
animate(src, alpha = 0, time = length)
//Animate a cloaking effect
var/our_filter = filters.len+1 //Filters don't appear to have a type that can be stored in a var and accessed. This is how the DM reference does it.
filters += filter(type="wave", x = 0, y = 16, size = 0, offset = 0, flags = WAVE_SIDEWAYS)
animate(filters[our_filter], offset = 1, size = 8, time = length, flags = ANIMATION_PARALLEL)
//Wait for animations to finish
sleep(length+5)
//Remove those
filters -= filters[our_filter]
//Back to original alpha
alpha = initial_alpha
/atom/movable/proc/uncloak_animation(var/length = 1 SECOND)
//Save these
var/initial_alpha = alpha
//Put us back to normal, but no alpha
alpha = 0
//Animate alpha fade up
animate(src, alpha = initial_alpha, time = length)
//Animate a cloaking effect
var/our_filter = filters.len+1 //Filters don't appear to have a type that can be stored in a var and accessed. This is how the DM reference does it.
filters += filter(type="wave", x=0, y = 16, size = 8, offset = 1, flags = WAVE_SIDEWAYS)
animate(filters[our_filter], offset = 0, size = 0, time = length, flags = ANIMATION_PARALLEL)
//Wait for animations to finish
sleep(length+5)
//Remove those
filters -= filters[our_filter]
// So cloaked things can see themselves, if necessary
/atom/movable/proc/get_cloaked_selfimage()
var/icon/selficon = icon(icon, icon_state)
selficon.MapColors(0,0,0, 0,0,0, 0,0,0, 1,1,1) //White
var/image/selfimage = image(selficon)
selfimage.color = "#0000FF"
selfimage.alpha = 100
selfimage.layer = initial(layer)
selfimage.plane = initial(plane)
selfimage.loc = src
return selfimage
+13
View File
@@ -1260,6 +1260,8 @@
src.icon_state = src.reset_icon()
set_dir(dir_in)
playsound(src, 'sound/machines/windowdoor.ogg', 50, 1)
if(occupant.client && cloaked_selfimage)
occupant.client.images += cloaked_selfimage
if(!hasInternalDamage()) //Otherwise it's not nominal!
switch(mech_faction)
if(MECH_FACTION_NT)//The good guys category
@@ -2070,6 +2072,17 @@
/////////////
/obj/mecha/cloak()
. = ..()
if(occupant && occupant.client && cloaked_selfimage)
occupant.client.images += cloaked_selfimage
/obj/mecha/uncloak()
if(occupant && occupant.client && cloaked_selfimage)
occupant.client.images -= cloaked_selfimage
return ..()
//debug
/*
/obj/mecha/verb/test_int_damage()
+2 -2
View File
@@ -67,7 +67,7 @@
if(timer > 0)
timer--
if(timer == 20)
uncloak()
reveal()
if(corpse)
new /obj/effect/effect/smoke/chem(corpse.loc)
qdel(corpse)
@@ -86,7 +86,7 @@
makeacorpse(watchowner)
return
/obj/item/weapon/deadringer/proc/uncloak()
/obj/item/weapon/deadringer/proc/reveal()
if(watchowner)
watchowner.alpha = 255
playsound(get_turf(src), 'sound/effects/uncloak.ogg', 35, 1, -1)
+1 -1
View File
@@ -437,7 +437,7 @@ BLIND // can't see anything
toggleable = 1
action_button_name = "Toggle Goggles"
vision_flags = SEE_MOBS
enables_planes = list(VIS_FULLBRIGHT)
enables_planes = list(VIS_FULLBRIGHT, VIS_CLOAKED)
flash_protection = FLASH_PROTECTION_REDUCED
emp_act(severity)
+1
View File
@@ -3,6 +3,7 @@
..() //Creates the plane_holder lazily
plane_holder.set_vis(VIS_GHOSTS, ghostvision)
plane_holder.set_vis(VIS_FULLBRIGHT, !seedarkness)
plane_holder.set_vis(VIS_CLOAKED, TRUE)
plane_holder.set_vis(VIS_AI_EYE, TRUE)
plane_holder.set_vis(VIS_AUGMENTED, TRUE) //VOREStation Add - GHOST VISION IS AUGMENTED
plane = PLANE_GHOSTS
@@ -47,29 +47,12 @@
ai_holder_type = /datum/ai_holder/simple_mob/melee/hit_and_run
var/cloaked = FALSE
var/cloaked_alpha = 45 // Lower = Harder to see.
var/cloaked_bonus_damage = 30 // This is added on top of the normal melee damage.
var/cloaked_weaken_amount = 3 // How long to stun for.
var/cloak_cooldown = 10 SECONDS // Amount of time needed to re-cloak after losing it.
var/last_uncloak = 0 // world.time
/mob/living/simple_mob/animal/giant_spider/lurker/proc/cloak()
if(cloaked)
return
animate(src, alpha = cloaked_alpha, time = 1 SECOND)
cloaked = TRUE
/mob/living/simple_mob/animal/giant_spider/lurker/proc/uncloak()
last_uncloak = world.time // This is assigned even if it isn't cloaked already, to 'reset' the timer if the spider is continously getting attacked.
if(!cloaked)
return
animate(src, alpha = initial(alpha), time = 1 SECOND)
cloaked = FALSE
// Check if cloaking if possible.
/mob/living/simple_mob/animal/giant_spider/lurker/proc/can_cloak()
if(stat)
@@ -79,7 +62,6 @@
return TRUE
// Called by things that break cloaks, like Technomancer wards.
/mob/living/simple_mob/animal/giant_spider/lurker/break_cloak()
uncloak()
+4 -1
View File
@@ -74,4 +74,7 @@
var/turf/T = get_turf(src)
if(isturf(T))
update_client_z(T.z)
update_client_z(T.z)
if(cloaked && cloaked_selfimage)
client.images += cloaked_selfimage
+22
View File
@@ -1197,3 +1197,25 @@ mob/proc/yank_out_object()
/mob/onTransitZ(old_z, new_z)
..()
update_client_z(new_z)
/mob/cloak()
. = ..()
if(client && cloaked_selfimage)
client.images += cloaked_selfimage
/mob/uncloak()
if(client && cloaked_selfimage)
client.images -= cloaked_selfimage
return ..()
/mob/get_cloaked_selfimage()
var/icon/selficon = getCompoundIcon(src)
selficon.MapColors(0,0,0, 0,0,0, 0,0,0, 1,1,1) //White
var/image/selfimage = image(selficon)
selfimage.color = "#0000FF"
selfimage.alpha = 100
selfimage.layer = initial(layer)
selfimage.plane = initial(plane)
selfimage.loc = src
return selfimage
+8
View File
@@ -41,6 +41,7 @@
plane_masters[VIS_TURFS] = new /obj/screen/plane_master/main{plane = TURF_PLANE}
plane_masters[VIS_OBJS] = new /obj/screen/plane_master/main{plane = OBJ_PLANE}
plane_masters[VIS_MOBS] = new /obj/screen/plane_master/main{plane = MOB_PLANE}
plane_masters[VIS_CLOAKED] = new /obj/screen/plane_master/cloaked //Cloaked atoms!
..()
@@ -178,6 +179,13 @@
plane = PLANE_GHOSTS
desired_alpha = 127 //When enabled, they're like half-transparent
/////////////////
//Cloaked atoms are visible to ghosts (or for other reasons?)
/obj/screen/plane_master/cloaked
plane = CLOAKED_PLANE
desired_alpha = 80
color = "#0000FF"
/////////////////
//The main game planes start normal and visible
/obj/screen/plane_master/main