Fix parallax (#2983)

changes:

Parallax now actually moves properly on Move().
Parallax movement can now be toggled as a preference.
Merged all movable/Move() overrides for performance reasons.
This commit is contained in:
Lohikar
2017-07-09 11:35:02 -05:00
committed by skull132
parent 6d69abbd47
commit 2ee49b1b9e
10 changed files with 47 additions and 23 deletions
+1
View File
@@ -67,6 +67,7 @@ Will print: "/mob/living/carbon/human/death" (you can optionally embed it in a s
#define PARALLAX_SPACE 0x1
#define PARALLAX_DUST 0x2
#define PROGRESS_BARS 0x4
#define PARALLAX_IS_STATIC 0x8
#define TOGGLES_DEFAULT (SOUND_ADMINHELP|SOUND_MIDI|SOUND_AMBIENCE|SOUND_LOBBY|CHAT_OOC|CHAT_DEAD|CHAT_GHOSTEARS|CHAT_GHOSTSIGHT|CHAT_PRAYER|CHAT_RADIO|CHAT_ATTACKLOGS|CHAT_LOOC)
+3
View File
@@ -111,6 +111,9 @@
var/client/C = mymob.client
if(!SSparallax.parallax_initialized)
return
if (C.prefs.parallax_togs & PARALLAX_IS_STATIC)
return
//ACTUALLY MOVING THE PARALLAX
var/turf/posobj = C.eye ? C.eye:loc : C.mob:loc
-6
View File
@@ -18,12 +18,6 @@ var/datum/observ/moved/moved_event = new()
* Movement Handling *
********************/
/atom/movable/Move()
var/old_loc = loc
. = ..()
if(.)
moved_event.raise_event(src, old_loc, loc)
/atom/movable/proc/move_to_destination(var/atom/movable/am, var/old_loc, var/new_loc)
var/turf/T = get_turf(new_loc)
if(T && T != loc)
+24
View File
@@ -281,3 +281,27 @@ var/list/accessible_z_levels = list("8" = 5, "9" = 10, "7" = 15, "2" = 60)
. = ..()
if (. && hud_used && client && get_turf(client.eye) == destination)
hud_used.update_parallax_values()
// Movement hooks.
/atom/movable/Move()
var/old_loc = loc
. = ..()
if (.)
// Events.
moved_event.raise_event(src, old_loc, loc)
// Parallax.
update_client_hook()
// Lighting.
var/datum/light_source/L
var/thing
for (thing in light_sources)
L = thing
L.source_atom.update_light()
// Openturf.
if (bound_overlay)
// The overlay will handle cleaning itself up on non-openspace turfs.
bound_overlay.forceMove(get_step(src, UP))
@@ -64,6 +64,7 @@
. += "<b>Space Parallax:</b> <a href='?src=\ref[src];paratoggle=[PARALLAX_SPACE]'><b>[(pref.parallax_togs & PARALLAX_SPACE) ? "Yes" : "No"]</b></a><br>"
. += "<b>Space Dust:</b> <a href='?src=\ref[src];paratoggle=[PARALLAX_DUST]'><b>[(pref.parallax_togs & PARALLAX_DUST) ? "Yes" : "No"]</b></a><br>"
. += "<b>Progress Bars:</b> <a href='?src=\ref[src];paratoggle=[PROGRESS_BARS]'><b>[(pref.parallax_togs & PROGRESS_BARS) ? "Yes" : "No"]</b></a><br>"
. += "<b>Static Space:</b> <a href='?src=\ref[src];paratoggle=[PARALLAX_IS_STATIC]'><b>[(pref.parallax_togs & PARALLAX_IS_STATIC) ? "Yes" : "No"]</b></a><br>"
/datum/category_item/player_setup_item/player_global/settings/OnTopic(var/href,var/list/href_list, var/mob/user)
if(href_list["toggle"])
@@ -201,3 +201,16 @@
src << "You will now see progress bars on delayed actions."
else
src << "You will no longer see progress bars on delayed actions."
/client/verb/toggle_static_spess()
set name = "Toggle Parallax Movement"
set category = "Preferences"
set desc = "Toggles movement of parallax space."
prefs.parallax_togs ^= PARALLAX_IS_STATIC
prefs.save_preferences()
if (prefs.parallax_togs & PARALLAX_IS_STATIC)
src << "Space will no longer move."
else
src << "Space will now move."
-10
View File
@@ -110,16 +110,6 @@
if (old_has_opaque_atom != T.has_opaque_atom)
T.reconsider_lights()
/atom/movable/Move()
. = ..()
var/datum/light_source/L
var/thing
for (thing in light_sources)
L = thing
L.source_atom.update_light()
/atom/movable/forceMove()
. = ..()
-1
View File
@@ -167,7 +167,6 @@
src.m_flag = 1
if ((A != src.loc && A && A.z == src.z))
src.last_move = get_dir(A, src.loc)
return
/client/proc/Move_object(direct)
if(mob && mob.control_object)
-6
View File
@@ -26,12 +26,6 @@
. = ..()
QDEL_NULL(bound_overlay)
/atom/movable/Move()
. = ..()
if (bound_overlay)
// The overlay will handle cleaning itself up on non-openspace turfs.
bound_overlay.forceMove(get_step(src, UP))
/atom/movable/forceMove(atom/dest)
. = ..(dest)
if (bound_overlay)
+5
View File
@@ -0,0 +1,5 @@
author: Lohikar
delete-after: True
changes:
- bugfix: "Parallax now actually moves like it was intended to."
- rscadd: "Parallax can now be made static in your preferences to get an immobile star background effect."