Skip to content

Commit

Permalink
Simple Parallax Effects
Browse files Browse the repository at this point in the history
  • Loading branch information
Azrun committed Nov 10, 2024
1 parent 5a18a9c commit 34944b5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 28 deletions.
57 changes: 30 additions & 27 deletions code/modules/parallax/parallax_viewer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
E.ui_interact(mob)

/datum/parallax_viewer
var/static/list/canned_parallax_groups = list(
"Snow"= /datum/parallax_render_source_group/planet/snow,
"Sand Storm"= /datum/parallax_render_source_group/planet/desert,
"Fog"= /datum/parallax_render_source_group/planet/forest,
"Light Smoke"= /datum/parallax_render_source_group/planet/lava_moon,
"Ash"= /datum/parallax_render_source_group/area/io_moon,
"Void"= /datum/parallax_render_source_group/area/void,
)

/datum/parallax_viewer/New()
..()
Expand Down Expand Up @@ -69,34 +77,22 @@
)

.["planets"] = list()
for(key in planet_parallax_render_source_groups)
p_group = planet_parallax_render_source_groups[key]
.["areas"][key] = list("sources"=list())
for (p_source in p_group.parallax_render_sources)
.["areas"][key]["sources"]["[p_source.type]"] = list(
"byondRef"="[ref(p_source)]",
"icon"=p_source.parallax_icon,
"icon_state"=p_source.parallax_icon_state,
"value"=p_source.parallax_value,
"scroll_speed"=p_source.scroll_speed,
"scroll_angle"=p_source.scroll_angle,
"x"=p_source.initial_x_coordinate,
"y"=p_source.initial_y_coordinate,
"static_color"=p_source.static_colour,
"color"=p_source.color
)

// .["areas"] = list()
// for(key in area_parallax_render_source_groups)
// p_group = z_level_parallax_render_source_groups[key]
// .["areas"][key] = list("byondRef"="[ref(p_group)]", "sources"=list())
// for (p_source in p_group)

// .["planets"] = list()
// for(key in planet_parallax_render_source_groups)
// p_group = z_level_parallax_render_source_groups[key]
// .["planets"][key] = list("byondRef"="[ref(p_group)]", "sources"=list())
// for (p_source in p_group)
// p_group = planet_parallax_render_source_groups[key]
// .["areas"][key] = list("sources"=list())
// for (p_source in p_group.parallax_render_sources)
// .["areas"][key]["sources"]["[p_source.type]"] = list(
// "byondRef"="[ref(p_source)]",
// "icon"=p_source.parallax_icon,
// "icon_state"=p_source.parallax_icon_state,
// "value"=p_source.parallax_value,
// "scroll_speed"=p_source.scroll_speed,
// "scroll_angle"=p_source.scroll_angle,
// "x"=p_source.initial_x_coordinate,
// "y"=p_source.initial_y_coordinate,
// "static_color"=p_source.static_colour,
// "color"=p_source.color
// )

/datum/parallax_viewer/ui_act(action, list/params, datum/tgui/ui)
. = ..()
Expand Down Expand Up @@ -128,6 +124,13 @@
var/type = tgui_input_list(ui.user, "Add Parallax Type to [params["group"]]", "Add Parallax", concrete_typesof(/atom/movable/screen/parallax_render_source/))
source_group?.add_parallax_render_source(type, 10 SECONDS)

if("canned")
var/group_type = canned_parallax_groups[tgui_input_list(ui.user, "Add Parallax Effect to [params["group"]]", "Add Effect", canned_parallax_groups)]
if(group_type)
var/datum/parallax_render_source_group/new_group = new group_type()
if(istype(new_group))
source_group?.copy_parallax_render_sources_from_group(new_group, 10 SECONDS)

if("delete")
source_group?.remove_parallax_render_source(source_type, 10 SECONDS)

Expand Down
2 changes: 1 addition & 1 deletion strings/admin_changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(t)fri nov 01 24
(u)Azrun
(*)Added Parallax Viewer. Do parallax stuff with it!
(*)Added Parallax Viewer. Do parallax stuff with it! Also the Wand gives some cool options now!
(t)mon oct 07 24
(u)Sovexe
(*)Added a new build mode tool Visual Mirror Setup to aid in the setup of adhoc visual mirror zones for advanced gimmicks. Use with care.
Expand Down

0 comments on commit 34944b5

Please sign in to comment.