mirror of
https://github.com/CHOMPstation/CHOMPstation.git
synced 2026-08-21 19:16:22 +01:00
Ports 'fake' SSAO from /tg/ as a preference
Allows players to pick whether they want this visual feature or not. Basically adds drop-shadows to objects and stuff. It's off by default.
This commit is contained in:
@@ -169,6 +169,20 @@ var/list/_client_preferences_by_type
|
||||
enabled_description = "Fancy"
|
||||
disabled_description = "Plain"
|
||||
|
||||
/datum/client_preference/ambient_occlusion
|
||||
description = "Fake Ambient Occlusion"
|
||||
key = "AMBIENT_OCCLUSION_PREF"
|
||||
enabled_by_default = FALSE
|
||||
enabled_description = "On"
|
||||
disabled_description = "Off"
|
||||
|
||||
/datum/client_preference/ambient_occlusion/toggled(var/mob/preference_mob, var/enabled)
|
||||
. = ..()
|
||||
if(preference_mob && preference_mob.plane_holder)
|
||||
var/datum/plane_holder/PH = preference_mob.plane_holder
|
||||
PH.set_ao(VIS_OBJS, enabled)
|
||||
PH.set_ao(VIS_MOBS, enabled)
|
||||
|
||||
/********************
|
||||
* Staff Preferences *
|
||||
********************/
|
||||
|
||||
@@ -55,6 +55,11 @@
|
||||
client.screen += plane_holder.plane_masters
|
||||
recalculate_vis()
|
||||
|
||||
// AO support
|
||||
var/ao_enabled = client.is_preference_enabled(/datum/client_preference/ambient_occlusion)
|
||||
plane_holder.set_ao(VIS_OBJS, ao_enabled)
|
||||
plane_holder.set_ao(VIS_MOBS, ao_enabled)
|
||||
|
||||
//set macro to normal incase it was overriden (like cyborg currently does)
|
||||
client.set_hotkeys_macro("macro", "hotkeymode")
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
my_mob = this_guy
|
||||
|
||||
//It'd be nice to lazy init these but some of them are important to just EXIST. Like without ghost planemaster, you can see ghosts. Go figure.
|
||||
|
||||
// 'Utility' planes
|
||||
plane_masters[VIS_FULLBRIGHT] = new /obj/screen/plane_master/fullbright //Lighting system (lighting_overlay objects)
|
||||
plane_masters[VIS_LIGHTING] = new /obj/screen/plane_master/lighting //Lighting system (but different!)
|
||||
plane_masters[VIS_GHOSTS] = new /obj/screen/plane_master/ghosts //Ghosts!
|
||||
@@ -33,6 +35,11 @@
|
||||
|
||||
plane_masters[VIS_MESONS] = new /obj/screen/plane_master{plane = PLANE_MESONS} //Meson-specific things like open ceilings.
|
||||
|
||||
// Real tangible stuff planes
|
||||
plane_masters[VIS_TURFS] = new /obj/screen/plane_master{plane = TURF_PLANE; alpha = 255}
|
||||
plane_masters[VIS_OBJS] = new /obj/screen/plane_master{plane = OBJ_PLANE; alpha = 255}
|
||||
plane_masters[VIS_MOBS] = new /obj/screen/plane_master{plane = MOB_PLANE; alpha = 255}
|
||||
|
||||
..()
|
||||
|
||||
/datum/plane_holder/Destroy()
|
||||
@@ -67,6 +74,17 @@
|
||||
for(var/SP in subplanes)
|
||||
set_vis(which = SP, new_alpha = new_alpha)
|
||||
|
||||
/datum/plane_holder/proc/set_ao(var/which = null, var/enabled = FALSE)
|
||||
ASSERT(which)
|
||||
var/obj/screen/plane_master/PM = plane_masters[which]
|
||||
if(!PM)
|
||||
crash_with("Tried to set_ao [which] in plane_holder on [my_mob]!")
|
||||
PM.set_ambient_occlusion(enabled)
|
||||
if(PM.sub_planes)
|
||||
var/list/subplanes = PM.sub_planes
|
||||
for(var/SP in subplanes)
|
||||
set_ao(SP, enabled)
|
||||
|
||||
/datum/plane_holder/proc/alter_values(var/which = null, var/list/values = null)
|
||||
ASSERT(which)
|
||||
var/obj/screen/plane_master/PM = plane_masters[which]
|
||||
@@ -121,6 +139,11 @@
|
||||
new_alpha = sanitize_integer(new_alpha, 0, 255, 255)
|
||||
alpha = new_alpha
|
||||
|
||||
/obj/screen/plane_master/proc/set_ambient_occlusion(var/enabled = FALSE)
|
||||
filters -= AMBIENT_OCCLUSION
|
||||
if(enabled)
|
||||
filters += AMBIENT_OCCLUSION
|
||||
|
||||
/obj/screen/plane_master/proc/alter_plane_values()
|
||||
return //Stub
|
||||
|
||||
|
||||
Reference in New Issue
Block a user