adds new z-level trait to disable parallax (#66637) (#13353)

* first push woohoo

* more stuff

* Update code/datums/components/z_parallax.dm

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>

* mothblockification

* fuck

* fuck 2

* uh

* uh yeah style stuff ig

* more changes

* last changes

* fuck

* fuck 2

* i hate potatopotato

* i hate potato * 2

* a

* god

* woops

* Update code/modules/mapping/space_management/traits.dm

Co-authored-by: Kylerace <kylerlumpkin1@gmail.com>

* Update code/modules/mapping/space_management/traits.dm

Co-authored-by: Kylerace <kylerlumpkin1@gmail.com>

* Update code/modules/mapping/space_management/traits.dm

Co-authored-by: Kylerace <kylerlumpkin1@gmail.com>

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
Co-authored-by: Kylerace <kylerlumpkin1@gmail.com>

Co-authored-by: magatsuchi <88991542+magatsuchi@users.noreply.github.com>
Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
Co-authored-by: Kylerace <kylerlumpkin1@gmail.com>
Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
This commit is contained in:
SkyratBot
2022-05-07 23:14:14 +02:00
committed by GitHub
parent 64ba3890c8
commit bca6a53e8e
12 changed files with 122 additions and 18 deletions

View File

@@ -22,7 +22,8 @@
"Linkage": null,
"Gravity": true,
"Ice Ruins Underground": true,
"Baseturf": "/turf/open/lava/plasma/ice_moon"
"Baseturf": "/turf/open/lava/plasma/ice_moon",
"No Parallax": true
},
{
"Down": -1,
@@ -31,7 +32,8 @@
"Linkage": null,
"Gravity": true,
"Ice Ruins Underground": true,
"Baseturf": "/turf/open/openspace/icemoon/keep_below"
"Baseturf": "/turf/open/openspace/icemoon/keep_below",
"No Parallax": true
},
{
"Down": -1,
@@ -40,7 +42,8 @@
"Gravity": true,
"Ice Ruins": true,
"Weather_Snowstorm": true,
"Baseturf": "/turf/open/openspace/icemoon/keep_below"
"Baseturf": "/turf/open/openspace/icemoon/keep_below",
"No Parallax": true
}
],
"minetype": "none",

View File

@@ -104,6 +104,9 @@ require only minor tweaks.
// string - type path of the z-level's baseturf (defaults to space)
#define ZTRAIT_BASETURF "Baseturf"
///boolean - does this z disable parallax?
#define ZTRAIT_NOPARALLAX "No Parallax"
// default trait definitions, used by SSmapping
///Z level traits for CentCom
#define ZTRAITS_CENTCOM list(ZTRAIT_CENTCOM = TRUE, ZTRAIT_NOPHASE = TRUE)
@@ -114,6 +117,7 @@ require only minor tweaks.
///Z level traits for Lavaland
#define ZTRAITS_LAVALAND list(\
ZTRAIT_MINING = TRUE, \
ZTRAIT_NOPARALLAX = TRUE, \
ZTRAIT_ASHSTORM = TRUE, \
ZTRAIT_LAVA_RUINS = TRUE, \
ZTRAIT_BOMBCAP_MULTIPLIER = 2, \

View File

@@ -142,6 +142,8 @@ GLOBAL_LIST_INIT(available_erp_ui_styles, list(
owner.overlay_fullscreen("see_through_darkness", /atom/movable/screen/fullscreen/see_through_darkness)
AddComponent(/datum/component/zparallax, owner.client)
/datum/hud/Destroy()
if(mymob.hud_used == src)
mymob.hud_used = null

View File

@@ -47,6 +47,8 @@
/datum/hud/proc/apply_parallax_pref(mob/viewmob)
var/mob/screenmob = viewmob || mymob
if(SSmapping.level_trait(screenmob.z, ZTRAIT_NOPARALLAX))
return FALSE
if (SSlag_switch.measures[DISABLE_PARALLAX] && !HAS_TRAIT(viewmob, TRAIT_BYPASS_MEASURES))
return FALSE

View File

@@ -66,6 +66,7 @@ SUBSYSTEM_DEF(mapping)
config = old_config
initialize_biomes()
loadWorld()
determine_fake_sale()
repopulate_sorted_areas()
process_teleport_locs() //Sets up the wizard teleport locations
preloadTemplates()
@@ -188,6 +189,13 @@ Used by the AI doomsday and the self-destruct nuke.
var/turf/open/floor/circuit/C = N
C.update_appearance()
/datum/controller/subsystem/mapping/proc/determine_fake_sale()
if(length(SSmapping.levels_by_all_traits(list(ZTRAIT_STATION, ZTRAIT_NOPARALLAX))))
GLOB.arcade_prize_pool += /obj/item/stack/tile/fakeice/loaded
else
GLOB.arcade_prize_pool += /obj/item/stack/tile/fakespace/loaded
/datum/controller/subsystem/mapping/Recover()
flags |= SS_NO_INIT
initialized = SSmapping.initialized

View File

@@ -0,0 +1,60 @@
/**
* Component that hooks into the client, listens for COMSIG_MOVABLE_Z_CHANGED, and depending on whether or not the
* Z-level has ZTRAIT_NOPARALLAX enabled, disable or reenable parallax.
*/
/datum/component/zparallax
dupe_mode = COMPONENT_DUPE_UNIQUE
var/client/tracked
var/mob/client_mob
/datum/component/zparallax/Initialize(client/tracked)
. = ..()
if(!istype(tracked))
stack_trace("Component zparallax has been initialized outside of a client. Deleting.")
return COMPONENT_INCOMPATIBLE
src.tracked = tracked
client_mob = tracked.mob
RegisterSignal(client_mob, COMSIG_MOB_LOGOUT, .proc/mob_change)
RegisterSignal(client_mob, COMSIG_MOVABLE_Z_CHANGED, .proc/ztrait_checks)
RegisterSignal(client_mob, COMSIG_MOB_LOGIN, .proc/refresh_client)
/datum/component/zparallax/Destroy()
. = ..()
unregister_signals()
tracked = null
client_mob = null
/datum/component/zparallax/proc/unregister_signals()
if(!client_mob)
return
UnregisterSignal(client_mob, list(COMSIG_MOB_LOGOUT, COMSIG_MOVABLE_Z_CHANGED))
/datum/component/zparallax/proc/refresh_client()
tracked = client_mob.client
/datum/component/zparallax/proc/mob_change()
SIGNAL_HANDLER
if(client_mob.key)
return
unregister_signals()
client_mob = tracked.mob
RegisterSignal(client_mob, COMSIG_MOB_LOGOUT, .proc/mob_change)
RegisterSignal(client_mob, COMSIG_MOVABLE_Z_CHANGED, .proc/ztrait_checks)
RegisterSignal(client_mob, COMSIG_MOB_LOGIN, .proc/refresh_client)
/datum/component/zparallax/proc/ztrait_checks()
SIGNAL_HANDLER
var/datum/hud/hud = client_mob.hud_used
hud.update_parallax_pref(client_mob)

View File

@@ -35,7 +35,6 @@ GLOBAL_LIST_INIT(arcade_prize_pool, list(
/obj/item/toy/talking/owl = 2,
/obj/item/toy/talking/griffin = 2,
/obj/item/coin/antagtoken = 2,
/obj/item/stack/tile/fakespace/loaded = 2,
/obj/item/stack/tile/fakepit/loaded = 2,
/obj/item/stack/tile/eighties/loaded = 2,
/obj/item/toy/toy_xeno = 2,

View File

@@ -970,6 +970,19 @@
/obj/item/stack/tile/fakepit/loaded
amount = 30
/obj/item/stack/tile/fakeice
name = "fake ice"
singular_name = "fake ice tile"
desc = "A piece of tile with a convincing ice pattern."
icon_state = "tile_ice"
inhand_icon_state = "tile-diamond"
turf_type = /turf/open/floor/fakeice
resistance_flags = FLAMMABLE
merge_type = /obj/item/stack/tile/fakeice
/obj/item/stack/tile/fakeice/loaded
amount = 30
//High-traction
/obj/item/stack/tile/noslip
name = "high-traction floor tile"

View File

@@ -772,6 +772,12 @@
underlay_appearance.icon_state = "basalt"
return TRUE
/turf/open/floor/fakeice
desc = "Is it marble, polished to a mirror finish? Or just really, really grippy ice?"
icon = 'icons/turf/floors/ice_turf.dmi'
icon_state = "ice_turf-0"
base_icon_state = "ice_turf-0"
/turf/open/floor/fakespace
icon = 'icons/turf/space.dmi'
icon_state = "0"

View File

@@ -31,23 +31,29 @@
/// Get a list of all z which have the specified trait
/datum/controller/subsystem/mapping/proc/levels_by_trait(trait)
. = list()
var/list/_z_list = z_list
for(var/A in _z_list)
var/datum/space_level/S = A
if (S.traits[trait])
. += S.z_value
var/list/final_return = list()
for(var/datum/space_level/level as anything in z_list)
if (level.traits[trait])
final_return += level.z_value
return final_return
/// Get a list of all z which have any of the specified traits
/datum/controller/subsystem/mapping/proc/levels_by_any_trait(list/traits)
. = list()
var/list/_z_list = z_list
for(var/A in _z_list)
var/datum/space_level/S = A
var/list/final_return = list()
for(var/datum/space_level/level as anything in z_list)
for (var/trait in traits)
if (S.traits[trait])
. += S.z_value
if (level.traits[trait])
final_return += level.z_value
break
return final_return
/// Get a list of all z which have all of the specified traits
/datum/controller/subsystem/mapping/proc/levels_by_all_traits(list/traits)
var/list/final_return = list()
for(var/datum/space_level/level as anything in z_list)
if(level_has_all_traits(level.z_value, traits))
final_return += level.z_value
return final_return
/// Attempt to get the turf below the provided one according to Z traits
/datum/controller/subsystem/mapping/proc/get_turf_below(turf/T)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

@@ -871,6 +871,7 @@
#include "code\datums\components\vacuum.dm"
#include "code\datums\components\wearertargeting.dm"
#include "code\datums\components\wet_floor.dm"
#include "code\datums\components\z_parallax.dm"
#include "code\datums\components\container_item\container_item.dm"
#include "code\datums\components\container_item\tank_holder.dm"
#include "code\datums\components\crafting\crafting.dm"