Files
nevimer 00ccf0c6b5 Merge remote-tracking branch 'tgstation/master' into upstream-feb12-2026
# Conflicts:
#	.github/CODEOWNERS
#	.github/workflows/compile_changelogs.yml
#	.github/workflows/stale.yml
#	SQL/database_changelog.md
#	_maps/map_files/CatwalkStation/CatwalkStation_2023.dmm
#	code/__DEFINES/atom_hud.dm
#	code/__DEFINES/inventory.dm
#	code/__DEFINES/mobs.dm
#	code/__DEFINES/species_clothing_paths.dm
#	code/__DEFINES/subsystems.dm
#	code/__DEFINES/surgery.dm
#	code/__HELPERS/global_lists.dm
#	code/_globalvars/lists/maintenance_loot.dm
#	code/_globalvars/traits/_traits.dm
#	code/controllers/subsystem/minor_mapping.dm
#	code/controllers/subsystem/processing/quirks.dm
#	code/controllers/subsystem/shuttle.dm
#	code/datums/components/palette.dm
#	code/datums/components/surgery_initiator.dm
#	code/datums/diseases/advance/advance.dm
#	code/datums/hud.dm
#	code/datums/mood.dm
#	code/datums/mutations/chameleon.dm
#	code/datums/quirks/negative_quirks/nyctophobia.dm
#	code/datums/status_effects/debuffs/debuffs.dm
#	code/datums/status_effects/debuffs/drunk.dm
#	code/datums/status_effects/debuffs/slime/slime_leech.dm
#	code/datums/weather/weather.dm
#	code/game/data_huds.dm
#	code/game/objects/items.dm
#	code/game/objects/items/devices/scanners/health_analyzer.dm
#	code/game/objects/items/frog_statue.dm
#	code/game/objects/items/rcd/RLD.dm
#	code/game/objects/items/robot/items/hypo.dm
#	code/game/objects/items/stacks/medical.dm
#	code/game/objects/items/stacks/wrap.dm
#	code/game/objects/items/storage/garment.dm
#	code/game/objects/items/tools/medical/defib.dm
#	code/game/objects/items/weaponry.dm
#	code/game/objects/items/weaponry/melee/misc.dm
#	code/game/objects/structures/crates_lockers/closets/secure/security.dm
#	code/game/objects/structures/curtains.dm
#	code/game/objects/structures/dresser.dm
#	code/game/objects/structures/girders.dm
#	code/game/objects/structures/maintenance.dm
#	code/game/objects/structures/mirror.dm
#	code/modules/admin/greyscale_modify_menu.dm
#	code/modules/admin/verbs/light_debug.dm
#	code/modules/antagonists/ashwalker/ashwalker.dm
#	code/modules/antagonists/heretic/knowledge/starting_lore.dm
#	code/modules/antagonists/ninja/ninjaDrainAct.dm
#	code/modules/art/paintings.dm
#	code/modules/client/preferences.dm
#	code/modules/client/verbs/ooc.dm
#	code/modules/clothing/head/wig.dm
#	code/modules/events/disease_outbreak.dm
#	code/modules/holodeck/holo_effect.dm
#	code/modules/jobs/job_types/head_of_security.dm
#	code/modules/jobs/job_types/security_officer.dm
#	code/modules/library/skill_learning/generic_skillchips/point.dm
#	code/modules/mining/lavaland/ash_flora.dm
#	code/modules/mining/lavaland/mining_loot/megafauna/ash_drake.dm
#	code/modules/mob/dead/new_player/new_player.dm
#	code/modules/mob/living/basic/guardian/guardian.dm
#	code/modules/mob/living/basic/space_fauna/space_dragon/space_dragon.dm
#	code/modules/mob/living/carbon/carbon.dm
#	code/modules/mob/living/carbon/human/human.dm
#	code/modules/mob/living/carbon/human/human_defines.dm
#	code/modules/mob/living/carbon/life.dm
#	code/modules/mob/living/living.dm
#	code/modules/mob/living/living_defines.dm
#	code/modules/mob/mob.dm
#	code/modules/mob_spawn/ghost_roles/mining_roles.dm
#	code/modules/mod/mod_control.dm
#	code/modules/mod/modules/modules_general.dm
#	code/modules/modular_computers/computers/item/computer_ui.dm
#	code/modules/paperwork/paper.dm
#	code/modules/paperwork/paperbin.dm
#	code/modules/power/lighting/light.dm
#	code/modules/projectiles/guns/energy/kinetic_accelerator.dm
#	code/modules/projectiles/projectile.dm
#	code/modules/reagents/chemistry/reagents/drinks/alcohol_reagents.dm
#	code/modules/reagents/chemistry/reagents/food_reagents.dm
#	code/modules/reagents/chemistry/reagents/other_reagents.dm
#	code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm
#	code/modules/research/xenobiology/crossbreeding/_clothing.dm
#	code/modules/research/xenobiology/crossbreeding/prismatic.dm
#	code/modules/surgery/advanced/brainwashing.dm
#	code/modules/surgery/advanced/lobotomy.dm
#	code/modules/surgery/amputation.dm
#	code/modules/surgery/blood_filter.dm
#	code/modules/surgery/bodyparts/_bodyparts.dm
#	code/modules/surgery/brain_surgery.dm
#	code/modules/surgery/cavity_implant.dm
#	code/modules/surgery/coronary_bypass.dm
#	code/modules/surgery/gastrectomy.dm
#	code/modules/surgery/healing.dm
#	code/modules/surgery/limb_augmentation.dm
#	code/modules/surgery/organ_manipulation.dm
#	code/modules/surgery/revival.dm
#	code/modules/surgery/sleeper_protocol.dm
#	code/modules/surgery/surgery_helpers.dm
#	code/modules/surgery/surgery_step.dm
#	code/modules/unit_tests/_unit_tests.dm
#	code/modules/unit_tests/designs.dm
#	code/modules/unit_tests/icon_state_worn.dm
#	code/modules/unit_tests/screenshots/screenshot_antag_icons_cultist.png
#	code/modules/unit_tests/screenshots/screenshot_antag_icons_headrevolutionary.png
#	code/modules/unit_tests/screenshots/screenshot_antag_icons_provocateur.png
#	code/modules/unit_tests/screenshots/screenshot_husk_body.png
#	code/modules/unit_tests/screenshots/screenshot_husk_body_missing_limbs.png
#	icons/map_icons/clothing/head/_head.dmi
#	icons/map_icons/clothing/shoes.dmi
#	icons/map_icons/items/_item.dmi
#	icons/mob/huds/hud.dmi
#	icons/mob/inhands/64x64_lefthand.dmi
#	icons/mob/inhands/64x64_righthand.dmi
#	icons/obj/machines/computer.dmi
#	tgui/packages/tgui/interfaces/OperatingComputer.jsx
#	tgui/packages/tgui/interfaces/PreferencesMenu/CharacterPreferences/MainPage.tsx
#	tgui/packages/tgui/interfaces/PreferencesMenu/types.ts
#	tgui/packages/tgui/interfaces/SurgeryInitiator.tsx
#	tools/icon_cutter/check.py
2026-02-12 23:50:09 -05:00

269 lines
9.0 KiB
Plaintext

// RAPID LIGHTING DEVICE
//modes of operation
#define GLOW_MODE 1
#define LIGHT_MODE 2
#define REMOVE_MODE 3
//operation costs
#define LIGHT_TUBE_COST 10
#define FLOOR_LIGHT_COST 15
#define GLOW_STICK_COST 5
#define DECONSTRUCT_COST 10
//operation delays
#define BUILD_DELAY 10
#define REMOVE_DELAY 15
/obj/item/construction/rld
name = "Rapid Lighting Device"
desc = "A device used to rapidly provide lighting sources to an area. Reload with iron, plasteel, glass or compressed matter cartridges."
icon = 'icons/obj/tools.dmi'
icon_state = "rld"
worn_icon_state = "RPD"
lefthand_file = 'icons/mob/inhands/equipment/tools_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/tools_righthand.dmi'
matter = 200
max_matter = 200
slot_flags = ITEM_SLOT_BELT
has_ammobar = TRUE
ammo_sections = 6
banned_upgrades = RCD_ALL_UPGRADES & ~RCD_UPGRADE_SILO_LINK
/// mode of operation see above defines
var/mode = LIGHT_MODE
///reference to thr original icons
var/static/list/original_options = list(
"Color Pick" = icon(icon = 'icons/hud/radial.dmi', icon_state = "omni"),
"Glow Stick" = icon(icon = 'icons/obj/lighting.dmi', icon_state = "glowstick"),
"Deconstruct" = icon(icon = 'icons/obj/tools.dmi', icon_state = "wrench"),
"Light Fixture" = icon(icon = 'icons/obj/lighting.dmi', icon_state = "ltube"),
)
///will contain the original icons modified with the color choice
var/list/display_options = list()
///Current color choice
var/color_choice = "#ffffff"
/obj/item/construction/rld/Initialize(mapload)
. = ..()
for(var/option in original_options)
display_options[option] = icon(original_options[option])
/obj/item/construction/rld/attack_self(mob/user)
. = ..()
if((construction_upgrades & RCD_UPGRADE_SILO_LINK) && display_options["Silo Link"] == null) //silo upgrade instaled but option was not updated then update it just one
display_options["Silo Link"] = icon(icon = 'icons/obj/machines/ore_silo.dmi', icon_state = "silo")
var/choice = show_radial_menu(user, src, display_options, custom_check = CALLBACK(src, PROC_REF(check_menu), user), require_near = TRUE, tooltips = TRUE)
if(!check_menu(user))
return
if(!choice)
return
switch(choice)
if("Light Fixture")
mode = LIGHT_MODE
to_chat(user, span_notice("You change RLD's mode to 'Permanent Light Construction'."))
if("Glow Stick")
mode = GLOW_MODE
to_chat(user, span_notice("You change RLD's mode to 'Light Launcher'."))
if("Color Pick")
var/new_choice = tgui_color_picker(user, "", "Choose Color", color_choice)
if(new_choice == null)
return
var/list/new_rgb = rgb2num(new_choice)
for(var/option in original_options)
if(option == "Color Pick" || option == "Deconstruct" || option == "Silo Link")
continue
var/icon/icon = icon(original_options[option])
icon.SetIntensity(new_rgb[1] / 255, new_rgb[2] / 255, new_rgb[3] / 255) //apply new scale
display_options[option] = icon
color_choice = new_choice
if("Deconstruct")
mode = REMOVE_MODE
to_chat(user, span_notice("You change RLD's mode to 'Deconstruct'."))
else
toggle_silo(user)
/obj/item/construction/rld/ranged_interact_with_atom(atom/interacting_with, mob/living/user, list/modifiers)
if(!range_check(interacting_with, user))
return NONE
return try_lighting(interacting_with, user)
/obj/item/construction/rld/interact_with_atom(atom/interacting_with, mob/living/user, list/modifiers)
. = ..()
if(. & ITEM_INTERACT_ANY_BLOCKER)
return .
return try_lighting(interacting_with, user)
/**
* Try to place/remove a light or throw a glowstick
*
* Arguments
* * atom/interacting_with - the target atom to light or throw glowsticks at
* * mob/user - the player doing this action
*/
/obj/item/construction/rld/proc/try_lighting(atom/interacting_with, mob/user)
PRIVATE_PROC(TRUE)
if(HAS_TRAIT(interacting_with, TRAIT_COMBAT_MODE_SKIP_INTERACTION))
return NONE
var/turf/start = get_turf(src)
switch(mode)
if(REMOVE_MODE)
if(!istype(interacting_with, /obj/machinery/light))
return NONE
//resource sanity checks before & after delay
if(!useResource(DECONSTRUCT_COST, user, TRUE))
return ITEM_INTERACT_BLOCKING
var/beam = user.Beam(interacting_with, icon_state="light_beam", time = 15)
playsound(src, 'sound/machines/click.ogg', 50, TRUE)
if(!do_after(user, REMOVE_DELAY, target = interacting_with))
qdel(beam)
return ITEM_INTERACT_BLOCKING
if(!useResource(DECONSTRUCT_COST, user, TRUE))
return ITEM_INTERACT_BLOCKING
qdel(interacting_with)
useResource(DECONSTRUCT_COST, user)
return ITEM_INTERACT_SUCCESS
if(LIGHT_MODE)
//resource sanity checks before & after delay
var/cost = iswallturf(interacting_with) ? LIGHT_TUBE_COST : FLOOR_LIGHT_COST
if(!useResource(cost, user, TRUE))
return ITEM_INTERACT_BLOCKING
var/beam = user.Beam(interacting_with, icon_state="light_beam", time = BUILD_DELAY)
playsound(loc, 'sound/machines/click.ogg', 50, TRUE)
playsound(loc, 'sound/effects/light_flicker.ogg', 50, FALSE)
if(!do_after(user, BUILD_DELAY, target = interacting_with))
qdel(beam)
return ITEM_INTERACT_BLOCKING
if(!useResource(cost, user, TRUE))
return ITEM_INTERACT_BLOCKING
if(iswallturf(interacting_with))
var/turf/open/winner = null
var/winning_dist = null
for(var/direction in GLOB.cardinals)
var/turf/C = get_step(interacting_with, direction)
//turf already has a light
if(locate(/obj/machinery/light) in C)
continue
//can't put a light here
if(!(isspaceturf(C) || TURF_SHARES(C)))
continue
//find turf closest to our player
var/x0 = C.x
var/y0 = C.y
var/contender = CHEAP_HYPOTENUSE(start.x, start.y, x0, y0)
if(!winner)
winner = C
winning_dist = contender
else if(contender < winning_dist) // lower is better
winner = C
winning_dist = contender
if(!winner)
balloon_alert(user, "no valid target!")
return ITEM_INTERACT_BLOCKING
var/obj/machinery/light/L = new /obj/machinery/light(get_turf(winner))
L.setDir(get_dir(winner, interacting_with))
L.color = color_choice
L.set_light_color(color_choice)
L.find_and_mount_on_atom()
useResource(cost, user)
return ITEM_INTERACT_SUCCESS
if(isfloorturf(interacting_with))
var/turf/target = get_turf(interacting_with)
if(locate(/obj/machinery/light/floor) in target)
return ITEM_INTERACT_BLOCKING
var/obj/machinery/light/floor/FL = new /obj/machinery/light/floor(target)
FL.color = color_choice
FL.set_light_color(color_choice)
FL.find_and_mount_on_atom()
useResource(cost, user)
return ITEM_INTERACT_SUCCESS
if(GLOW_MODE)
if(!useResource(GLOW_STICK_COST, user))
return ITEM_INTERACT_BLOCKING
// Picks the closest fitting color for the fluid by hue
var/closest_diff = null
var/closest_fluid = null
var/list/unwrapped_color = rgb2num(color_choice, COLORSPACE_HSV)
var/chosen_hue = unwrapped_color[1]
for (var/datum/reagent/luminescent_fluid/glowstick_fluid as anything in typesof(/datum/reagent/luminescent_fluid))
unwrapped_color = rgb2num(glowstick_fluid::color, COLORSPACE_HSV)
var/hue_diff = abs(chosen_hue - unwrapped_color[1])
if (hue_diff > 180)
hue_diff = 360 - hue_diff
if (isnull(closest_diff) || hue_diff < closest_diff)
closest_diff = hue_diff
closest_fluid = glowstick_fluid
var/obj/item/flashlight/glowstick/new_stick = new /obj/item/flashlight/glowstick(start, null, closest_fluid)
new_stick.color = color_choice
new_stick.set_light_color(new_stick.color)
new_stick.throw_at(interacting_with, 9, 3, user)
new_stick.turn_on()
new_stick.update_brightness()
return ITEM_INTERACT_SUCCESS
return NONE
/obj/item/construction/rld/mini
name = "mini-rapid-light-device"
desc = "A device used to rapidly provide lighting sources to an area. Reload with iron, plasteel, glass or compressed matter cartridges."
icon = 'icons/obj/tools.dmi'
icon_state = "rld"
lefthand_file = 'icons/mob/inhands/equipment/tools_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/tools_righthand.dmi'
matter = 100
max_matter = 100
/obj/item/construction/rld/cyborg
name = "Cyborg rapid-light-device"
desc = "A device used to rapidly provide lighting sources to an area. Runs off a cyborg's internal power supply"
// Energy Use
var/energyfactor = 0.050 * STANDARD_CELL_CHARGE
/obj/item/construction/rld/cyborg/get_matter(mob/user)
if(!iscyborg(user))
return 0
var/mob/living/silicon/robot/borgy = user
if(!borgy.cell)
return 0
max_matter = borgy.cell.maxcharge
return borgy.cell.charge
/obj/item/construction/rld/cyborg/useResource(amount, mob/user)
if(!iscyborg(user))
return 0
var/mob/living/silicon/robot/borgy = user
if(!borgy.cell)
if(user)
balloon_alert(user, "no cell found!")
return 0
. = borgy.cell.use(amount * energyfactor)
if(!. && user)
balloon_alert(user, "insufficient charge!")
return .
#undef LIGHT_TUBE_COST
#undef FLOOR_LIGHT_COST
#undef GLOW_STICK_COST
#undef DECONSTRUCT_COST
#undef BUILD_DELAY
#undef REMOVE_DELAY
#undef GLOW_MODE
#undef LIGHT_MODE
#undef REMOVE_MODE