mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-29 18:40:42 +00:00
## About The Pull Request "If GAGS is such a good system, why isn't there GAGS 2?" - Sun Tzu GAGS is very neat but it has one glaring issue: it needs sprites to be greyscaled in advance to be used. On the other hand we have color matrices, but they're hard to use and even harder to get good results from. The logical solution grew out of a discord argument about colors this morning after @LemonInTheDark decided to toy around with HSL matrices using filters on live servers. This PR implements Color Transition Filters as an additional option for atom colors - passing a transition filter matrix into ``add_atom_colour`` will "recolor" the atom into the passed color by using an HSL filter (since color only supports RGB values and matrices). Normal color matrices are now also supported in atom colors, in case anyone needs to use them there. ``color_transition_filter`` has 2 modes: ``SATURATION_MULTIPLY`` which only changes the hue and shifts saturation of the original icon, and ``SATURATION_OVERRIDE`` which changes saturation and light values to more correctly fit the passed color. Multiply mode does a far better job at recoloring clothing or objects with obvious highlights, but fails to color pale or white objects, while Override mode is closer to what we have right now (just doesn't produce rancid blobs of color nearly as much) Here are some examples of colored clothes, mechs, items and tiles using the new system. Green RD? Sure.  Atmos MODsuit colored with a speed potion  Why override mode exists in the first place  Aftermath of a colorful reagent grenade.  As you can see, the colors are far brighter and significantly less acidic, since they're no longer just used as multipliers for existing colors but instead shift the palette of the sprite towards themselves. In order to bypass the main downside of "default" Multiply mode, spraycans have received a new right click function "coat with paint", which will color the item using the Override mode. Left Click mode lost its coloring restrictions (RMB still has them), and color sampling/prosthetic recoloring has been moved to Ctrl Click instead. Here's the full list of all systems/items that now use color transition filters: * Drying items * Deep frying items * Slime blueprints/potions/coloring crossbreeds * Colorful reagent * Spraycans * Paint buckets ## Why It's Good For The Game Our coloring system is ***really*** bad, to the point where we're preventing players from using any dark colors because item icons become unintelligible when colored into them. ## Changelog 🆑 SmArtKar, LemonInTheDark add: Changed how spraycans color items - "old" mode is still availible via right click. refactor: Refactored how some items and effects color things so that they look prettier. /🆑
257 lines
8.8 KiB
Plaintext
257 lines
8.8 KiB
Plaintext
///The area is a "Station" area, showing no special text.
|
|
#define AREA_STATION 1
|
|
///The area is in outdoors (lavaland/icemoon/jungle/space), therefore unclaimed territories.
|
|
#define AREA_OUTDOORS 2
|
|
///The area is special (shuttles/centcom), therefore can't be claimed.
|
|
#define AREA_SPECIAL 3
|
|
|
|
///The blueprints are currently reading the list of all wire datums.
|
|
#define LEGEND_VIEWING_LIST "watching_list"
|
|
///The blueprints are on the main page.
|
|
#define LEGEND_OFF "off"
|
|
|
|
/**
|
|
* Blueprints
|
|
* Used to see the wires of machines on the station, the roundstart layout of pipes/cables/tubes,
|
|
* as well as allowing you to rename existing areas and create new ones.
|
|
* Used by the station, cyborgs, and golems.
|
|
*/
|
|
/obj/item/blueprints
|
|
name = "station blueprints"
|
|
desc = "Blueprints of the station. There is a \"Classified\" stamp and several coffee stains on it."
|
|
icon = 'icons/obj/scrolls.dmi'
|
|
icon_state = "blueprints"
|
|
inhand_icon_state = "blueprints"
|
|
attack_verb_continuous = list("attacks", "baps", "hits")
|
|
attack_verb_simple = list("attack", "bap", "hit")
|
|
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | ACID_PROOF
|
|
interaction_flags_atom = parent_type::interaction_flags_atom | INTERACT_ATOM_ALLOW_USER_LOCATION | INTERACT_ATOM_IGNORE_MOBILITY
|
|
|
|
///A string of flavortext to be displayed at the top of the UI, related to the type of blueprints we are.
|
|
var/fluffnotice = "Property of Nanotrasen. For heads of staff only. Store in high-secure storage."
|
|
///Boolean on whether the blueprints are currently being used, which prevents double-using them to rename/create areas.
|
|
var/in_use = FALSE
|
|
///The type of area we'll create when we make a new area. This is a typepath.
|
|
var/area/new_area_type = /area
|
|
///The legend type the blueprints are currently looking at, which is either modularly
|
|
///set by wires datums, the main page, or an overview of them all.
|
|
var/legend_viewing = LEGEND_OFF
|
|
|
|
///List of images that we're showing to a client, used for showing blueprint data.
|
|
var/list/image/showing = list()
|
|
///The client that is being shown the list of 'showing' images of blueprint data.
|
|
var/client/viewing
|
|
|
|
/obj/item/blueprints/Destroy()
|
|
clear_viewer()
|
|
return ..()
|
|
|
|
/obj/item/blueprints/dropped(mob/user)
|
|
. = ..()
|
|
clear_viewer()
|
|
legend_viewing = LEGEND_OFF
|
|
|
|
/obj/item/blueprints/ui_interact(mob/user, datum/tgui/ui)
|
|
ui = SStgui.try_update_ui(user, src, ui)
|
|
if(!ui)
|
|
ui = new(user, src, "Blueprints", name)
|
|
ui.open()
|
|
|
|
/obj/item/blueprints/ui_state(mob/user)
|
|
return GLOB.inventory_state
|
|
|
|
/obj/item/blueprints/ui_data(mob/user)
|
|
var/list/data = list()
|
|
switch(get_area_type(user))
|
|
if(AREA_OUTDOORS)
|
|
data["area_notice"] = "You are in unclaimed territory."
|
|
if(AREA_SPECIAL)
|
|
data["area_notice"] = "This area has no notes."
|
|
else
|
|
var/area/current_area = get_area(user)
|
|
data["area_notice"] = "You are now in \the [current_area.name]"
|
|
var/area/area_inside_of = get_area(user)
|
|
data["area_name"] = html_encode(area_inside_of.name)
|
|
data["legend"] = legend_viewing
|
|
data["viewing"] = !!viewing
|
|
data["wire_data"] = list()
|
|
if(legend_viewing != LEGEND_VIEWING_LIST && legend_viewing != LEGEND_OFF)
|
|
for(var/device in GLOB.wire_color_directory)
|
|
if("[device]" != legend_viewing)
|
|
continue
|
|
data["wires_name"] = GLOB.wire_name_directory[device]
|
|
for(var/individual_color in GLOB.wire_color_directory[device])
|
|
var/wire_name = GLOB.wire_color_directory[device][individual_color]
|
|
if(findtext(wire_name, WIRE_DUD_PREFIX)) //don't show duds
|
|
continue
|
|
data["wire_data"] += list(list(
|
|
"color" = individual_color,
|
|
"message" = wire_name,
|
|
))
|
|
return data
|
|
|
|
/obj/item/blueprints/ui_static_data(mob/user)
|
|
var/list/data = list()
|
|
data["legend_viewing_list"] = LEGEND_VIEWING_LIST
|
|
data["legend_off"] = LEGEND_OFF
|
|
data["fluff_notice"] = fluffnotice
|
|
data["station_name"] = station_name()
|
|
data["wire_devices"] = list()
|
|
for(var/wireset in GLOB.wire_color_directory)
|
|
data["wire_devices"] += list(list(
|
|
"name" = GLOB.wire_name_directory[wireset],
|
|
"ref" = wireset,
|
|
))
|
|
return data
|
|
|
|
/obj/item/blueprints/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
|
|
var/mob/user = ui.user
|
|
if(!user.can_perform_action(src, NEED_LITERACY|NEED_DEXTERITY|NEED_HANDS|ALLOW_RESTING))
|
|
return TRUE
|
|
|
|
switch(action)
|
|
if("create_area")
|
|
if(in_use)
|
|
return
|
|
in_use = TRUE
|
|
create_area(user, new_area_type)
|
|
in_use = FALSE
|
|
if("edit_area")
|
|
if(get_area_type(user) != AREA_STATION)
|
|
return
|
|
if(in_use)
|
|
return
|
|
in_use = TRUE
|
|
edit_area(user)
|
|
in_use = FALSE
|
|
if("exit_legend")
|
|
legend_viewing = LEGEND_OFF
|
|
if("view_legend")
|
|
legend_viewing = LEGEND_VIEWING_LIST
|
|
if("view_wireset")
|
|
var/setting_wireset = params["view_wireset"]
|
|
for(var/device in GLOB.wire_color_directory)
|
|
if("[device]" == setting_wireset) //I know... don't change it...
|
|
legend_viewing = setting_wireset
|
|
return TRUE
|
|
if("view_blueprints")
|
|
playsound(src, 'sound/items/paper_flip.ogg', 40, TRUE)
|
|
user.balloon_alert_to_viewers("flips blueprints over")
|
|
set_viewer(user)
|
|
if("hide_blueprints")
|
|
playsound(src, 'sound/items/paper_flip.ogg', 40, TRUE)
|
|
user.balloon_alert_to_viewers("flips blueprints over")
|
|
clear_viewer()
|
|
if("refresh")
|
|
playsound(src, 'sound/items/paper_flip.ogg', 40, TRUE)
|
|
clear_viewer()
|
|
set_viewer(user)
|
|
return TRUE
|
|
|
|
/**
|
|
* Sets the user's client as the person viewing blueprint data, and builds blueprint data
|
|
* around the user.
|
|
* Args:
|
|
* - user: The person who's client we're giving images to.
|
|
*/
|
|
/obj/item/blueprints/proc/set_viewer(mob/user)
|
|
if(!user || !user.client)
|
|
return
|
|
if(viewing)
|
|
clear_viewer()
|
|
viewing = user.client
|
|
showing = get_blueprint_data(get_turf(viewing.eye || user), viewing.view)
|
|
viewing.images |= showing
|
|
|
|
/**
|
|
* Clears the client we're showig images to and deletes the images of blueprint data
|
|
* we made to show them.
|
|
*/
|
|
/obj/item/blueprints/proc/clear_viewer()
|
|
if(viewing)
|
|
viewing.images -= showing
|
|
viewing = null
|
|
showing.Cut()
|
|
|
|
/**
|
|
* Gets the area type the user is currently standing in.
|
|
* Returns: AREA_STATION, AREA_OUTDOORS, or AREA_SPECIAL
|
|
* Args:
|
|
* - user: The person we're getting the area of to check if it's a special area.
|
|
*/
|
|
/obj/item/blueprints/proc/get_area_type(mob/user)
|
|
var/area/area_checking = get_area(user)
|
|
if(area_checking.outdoors)
|
|
return AREA_OUTDOORS
|
|
var/static/list/special_areas = typecacheof(list(
|
|
/area/shuttle,
|
|
/area/centcom,
|
|
/area/centcom/asteroid,
|
|
/area/centcom/tdome,
|
|
/area/centcom/wizard_station,
|
|
/area/misc/hilbertshotel,
|
|
/area/misc/hilbertshotelstorage,
|
|
))
|
|
if(area_checking.type in special_areas)
|
|
return AREA_SPECIAL
|
|
return AREA_STATION
|
|
|
|
/**
|
|
* edit_area
|
|
* Takes input from the player and renames the area the blueprints are currently in.
|
|
*/
|
|
/obj/item/blueprints/proc/edit_area(mob/user)
|
|
var/area/area_editing = get_area(src)
|
|
var/prevname = "[area_editing.name]"
|
|
var/new_name = tgui_input_text(user, "New area name", "Area Creation", max_length = MAX_NAME_LEN)
|
|
if(isnull(new_name) || !length(new_name) || new_name == prevname)
|
|
return
|
|
|
|
rename_area(area_editing, new_name)
|
|
user.balloon_alert(user, "area renamed to [new_name]")
|
|
user.log_message("has renamed [prevname] to [new_name]", LOG_GAME)
|
|
return TRUE
|
|
|
|
///Cyborg blueprints - The same as regular but with a different fluff text.
|
|
/obj/item/blueprints/cyborg
|
|
name = "station schematics"
|
|
desc = "A digital copy of the station blueprints stored in your memory."
|
|
fluffnotice = "Intellectual Property of Nanotrasen. For use in engineering cyborgs only. Wipe from memory upon departure from the station."
|
|
|
|
///Golem blueprints - Used to make golem areas that won't give the hazardous area debuffs.
|
|
/obj/item/blueprints/golem
|
|
name = "land claim"
|
|
desc = "Use it to build new structures in the wastes."
|
|
fluffnotice = "In memory of the Liberator's brother, Delaminator, and his Scarlet Macaw-iathan, from which this artifact was stolen."
|
|
new_area_type = /area/golem
|
|
|
|
///Slime blueprints - Makes areas colored and compatible with xenobiology camera consoles, one time use.
|
|
/obj/item/blueprints/slime
|
|
name = "cerulean prints"
|
|
desc = "A one use yet of blueprints made of jelly like organic material. Extends the reach of the management console."
|
|
fluffnotice = "Copyright by Science Inc. Renaming areas will allow for management consoles to traverse them."
|
|
color = "#2956B2"
|
|
|
|
/obj/item/blueprints/slime/edit_area(mob/user)
|
|
. = ..()
|
|
var/area/area = get_area(src)
|
|
var/list/turf_matrix = color_transition_filter("#2956B2")
|
|
for(var/list/zlevel_turfs as anything in area.get_zlevel_turf_lists())
|
|
for(var/turf/area_turf as anything in zlevel_turfs)
|
|
area_turf.remove_atom_colour(WASHABLE_COLOUR_PRIORITY)
|
|
area_turf.add_atom_colour(turf_matrix, FIXED_COLOUR_PRIORITY)
|
|
area.area_flags |= XENOBIOLOGY_COMPATIBLE
|
|
qdel(src)
|
|
|
|
#undef LEGEND_VIEWING_LIST
|
|
#undef LEGEND_OFF
|
|
|
|
#undef AREA_STATION
|
|
#undef AREA_OUTDOORS
|
|
#undef AREA_SPECIAL
|
|
|