mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-23 13:05:44 +01:00
Made several improvements to flashlights (#16050)
* Made several improvements to flashlights, and added a sprite for device cells * CL * Added lathe recipes, and made eCigs use device power cells * Add another entry to CL * Fix nested cell * Added `desc_info` to all flashlights, to teach the player about removing the cells and turning them on. * Update code/game/objects/items/devices/lighting/lamp.dm * More cleanup * Allow Flashlights to use rechargers * Apply suggestions from code review Co-authored-by: Fluffy <65877598+FluffyGhoster@users.noreply.github.com> * Update flare.dm * Update flashlight.dm Fix broken code review suggestion * Update flare.dm Ditto --------- Co-authored-by: Fluffy <65877598+FluffyGhoster@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
/obj/item/device/flashlight/flare
|
||||
name = "flare"
|
||||
desc = "A red standard-issue flare. There are instructions on the side reading 'pull cap, make light'."
|
||||
desc = "A red standard-issue flare. There are instructions on the side reading 'twist cap off, make light'."
|
||||
desc_info = "Use this item in your hand, to turn on the light."
|
||||
w_class = ITEMSIZE_SMALL
|
||||
brightness_on = 3 // Pretty bright.
|
||||
light_power = 4
|
||||
@@ -13,32 +14,28 @@
|
||||
var/on_damage = 7
|
||||
var/produce_heat = 1500
|
||||
light_wedge = LIGHT_OMNI
|
||||
power_use = FALSE
|
||||
activation_sound = 'sound/items/flare.ogg'
|
||||
toggle_sound = null
|
||||
drop_sound = 'sound/items/drop/gloves.ogg'
|
||||
pickup_sound = 'sound/items/pickup/gloves.ogg'
|
||||
|
||||
var/overrides_activation_message = FALSE
|
||||
|
||||
/obj/item/device/flashlight/flare/Initialize()
|
||||
. = ..()
|
||||
fuel = rand(400, 600)
|
||||
fuel = rand(4 MINUTES, 6 MINUTES)
|
||||
|
||||
/obj/item/device/flashlight/flare/process()
|
||||
var/turf/pos = get_turf(src)
|
||||
if(pos)
|
||||
pos.hotspot_expose(produce_heat, 5)
|
||||
if(produce_heat)
|
||||
var/turf/pos = get_turf(src)
|
||||
if(pos)
|
||||
pos.hotspot_expose(produce_heat, 5)
|
||||
fuel = max(fuel - 1, 0)
|
||||
if(!fuel || !on)
|
||||
STOP_PROCESSING(SSprocessing, src)
|
||||
turn_off()
|
||||
update_damage()
|
||||
if(!fuel)
|
||||
src.icon_state = "[initial(icon_state)]-empty"
|
||||
STOP_PROCESSING(SSprocessing, src)
|
||||
|
||||
/obj/item/device/flashlight/flare/proc/turn_off()
|
||||
on = 0
|
||||
src.force = initial(src.force)
|
||||
src.damtype = initial(src.damtype)
|
||||
update_icon()
|
||||
|
||||
/obj/item/device/flashlight/flare/update_icon()
|
||||
..()
|
||||
@@ -51,24 +48,45 @@
|
||||
/obj/item/device/flashlight/flare/attack_self(mob/user)
|
||||
// Usual checks
|
||||
if(!fuel)
|
||||
to_chat(user, SPAN_WARNING("It's out of fuel."))
|
||||
to_chat(user, SPAN_WARNING("\The [src] is spent."))
|
||||
return
|
||||
if(on)
|
||||
return
|
||||
|
||||
. = ..()
|
||||
// All good, turn it on.
|
||||
if(.)
|
||||
if(!overrides_activation_message)
|
||||
user.visible_message(SPAN_NOTICE("\The [user] activates the flare."), SPAN_NOTICE("You pull the cap off the flare, activating it!"))
|
||||
src.force = on_damage
|
||||
src.damtype = "fire"
|
||||
activate(user)
|
||||
update_damage()
|
||||
START_PROCESSING(SSprocessing, src)
|
||||
update_icon()
|
||||
|
||||
/obj/item/device/flashlight/flare/proc/activate(mob/user)
|
||||
if(istype(user))
|
||||
user.visible_message(
|
||||
SPAN_NOTICE("\The [user] activates the flare."),
|
||||
SPAN_NOTICE("You twist the cap off the flare, activating it!"),
|
||||
SPAN_NOTICE("You hear a flare sparking to life.")
|
||||
)
|
||||
|
||||
/obj/item/device/flashlight/flare/proc/turn_off()
|
||||
on = FALSE
|
||||
visible_message(
|
||||
SPAN_NOTICE("\The [src] sputters out.")
|
||||
)
|
||||
update_icon()
|
||||
|
||||
/obj/item/device/flashlight/flare/proc/update_damage()
|
||||
if(on)
|
||||
force = on_damage
|
||||
damtype = "fire"
|
||||
else
|
||||
force = initial(force)
|
||||
damtype = initial(damtype)
|
||||
|
||||
/obj/item/device/flashlight/flare/torch
|
||||
name = "torch"
|
||||
desc = "A rustic source of light."
|
||||
desc_info = "Click on a source of flame, to light the torch."
|
||||
w_class = ITEMSIZE_LARGE
|
||||
brightness_on = 2
|
||||
light_power = 3
|
||||
@@ -85,6 +103,7 @@
|
||||
/obj/item/device/flashlight/flare/torch/attack_self(mob/user)
|
||||
if (on)
|
||||
turn_off()
|
||||
update_damage()
|
||||
user.visible_message("<b>[user]</b> extinguishes \the [src].", SPAN_NOTICE("You extinguish \the [src]."))
|
||||
return
|
||||
|
||||
@@ -120,8 +139,9 @@
|
||||
pos.hotspot_expose(produce_heat, 5)
|
||||
fuel = max(fuel - 1, 0)
|
||||
if(!fuel || !on)
|
||||
turn_off()
|
||||
STOP_PROCESSING(SSprocessing, src)
|
||||
turn_off()
|
||||
update_damage()
|
||||
if(!fuel)
|
||||
var/obj/item/torch/T = new(pos)
|
||||
if(ismob(src.loc))
|
||||
@@ -169,4 +189,4 @@
|
||||
/obj/item/device/flashlight/flare/torch/stick/turn_off()
|
||||
visible_message("\The [src] burns out.")
|
||||
new /obj/effect/decal/cleanable/ash(get_turf(src))
|
||||
qdel(src)
|
||||
qdel(src)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/obj/item/device/flashlight
|
||||
name = "flashlight"
|
||||
desc = "A hand-held emergency light."
|
||||
desc_info = "Use this item in your hand, to turn on the light. Click this light with the opposite hand, to remove the cell contained inside."
|
||||
icon = 'icons/obj/lighting.dmi'
|
||||
item_icons = list(
|
||||
slot_l_hand_str = 'icons/mob/items/lefthand_lighting.dmi',
|
||||
@@ -15,29 +16,105 @@
|
||||
uv_intensity = 50
|
||||
light_wedge = LIGHT_WIDE
|
||||
|
||||
matter = list(DEFAULT_WALL_MATERIAL = 50, MATERIAL_GLASS = 20)
|
||||
matter = list(MATERIAL_PLASTIC = 50, MATERIAL_GLASS = 20)
|
||||
|
||||
action_button_name = "Toggle Flashlight"
|
||||
var/on = 0
|
||||
var/brightness_on = 3 //luminosity when on
|
||||
/// Is the light currently on or off?
|
||||
var/on = FALSE
|
||||
/// Luminosity when on
|
||||
var/brightness_on = 4
|
||||
// Lighting power when on
|
||||
var/flashlight_power = 0.8
|
||||
/// Sound the light makes when it's switched
|
||||
var/toggle_sound = 'sound/machines/switch_flashlight.ogg'
|
||||
/// Sound the light makes when it's turned on
|
||||
var/activation_sound = 'sound/items/flashlight.ogg'
|
||||
var/spawn_dir // a way for mappers to force which way a flashlight faces upon spawning
|
||||
var/obj/item/cell/cell
|
||||
var/cell_type = /obj/item/cell/device
|
||||
var/list/brightness_levels
|
||||
var/brightness_level = "medium"
|
||||
var/power_usage
|
||||
/// Does the light use power?
|
||||
var/power_use = TRUE
|
||||
/// Should the item start with a cell?
|
||||
var/starts_with_cell = TRUE
|
||||
/// Does the item accept large cells?
|
||||
var/accepts_large_cells = FALSE
|
||||
/// Is the light always on?
|
||||
var/always_on = FALSE
|
||||
/// How efficient the flashlight is at producing light compared to baseline
|
||||
var/efficiency_modifier = 1.0
|
||||
/// A way for mappers to force which way a flashlight faces upon spawning
|
||||
var/spawn_dir
|
||||
|
||||
/obj/item/device/flashlight/Initialize()
|
||||
|
||||
if(power_use && cell_type)
|
||||
if(starts_with_cell)
|
||||
cell = new cell_type(src)
|
||||
brightness_levels = list("low" = 0.25, "medium" = 0.5, "high" = 1)
|
||||
power_usage = (brightness_levels[brightness_level] / efficiency_modifier)
|
||||
else
|
||||
verbs -= /obj/item/device/flashlight/verb/toggle_brightness
|
||||
|
||||
if (on)
|
||||
light_range = brightness_on
|
||||
if(brightness_level == "low")
|
||||
light_range = brightness_on * 0.5
|
||||
else if(brightness_level == "high")
|
||||
light_range = brightness_on * 1.5
|
||||
else
|
||||
light_range = brightness_on
|
||||
update_icon()
|
||||
|
||||
. = ..()
|
||||
|
||||
if(light_wedge)
|
||||
set_dir(pick(NORTH, SOUTH, EAST, WEST))
|
||||
if(spawn_dir)
|
||||
set_dir(spawn_dir)
|
||||
update_light()
|
||||
|
||||
/obj/item/device/flashlight/Destroy()
|
||||
STOP_PROCESSING(SSprocessing, src)
|
||||
QDEL_NULL(cell)
|
||||
return ..()
|
||||
|
||||
/obj/item/device/flashlight/get_cell()
|
||||
return cell
|
||||
|
||||
/obj/item/device/flashlight/proc/set_brightness(mob/user)
|
||||
var/choice = input("Choose a brightness level.") as null|anything in brightness_levels
|
||||
if(choice)
|
||||
brightness_level = choice
|
||||
power_usage = brightness_levels[choice]
|
||||
to_chat(user, SPAN_NOTICE("You set the brightness level on \the [src] to [brightness_level]."))
|
||||
update_icon()
|
||||
|
||||
/obj/item/device/flashlight/process()
|
||||
if(!on || !cell)
|
||||
return PROCESS_KILL
|
||||
|
||||
if(brightness_level && power_usage)
|
||||
if(cell.use(power_usage) != power_usage)
|
||||
visible_message(
|
||||
SPAN_WARNING("\The [src] flickers before shutting out!")
|
||||
)
|
||||
playsound(src.loc, 'sound/effects/sparks3.ogg', 10, 1, -3)
|
||||
toggle()
|
||||
return PROCESS_KILL
|
||||
|
||||
/obj/item/device/flashlight/update_icon()
|
||||
if(always_on)
|
||||
return
|
||||
|
||||
if(on)
|
||||
icon_state = "[initial(icon_state)]-on"
|
||||
set_light(brightness_on)
|
||||
if(brightness_level == "low")
|
||||
set_light(brightness_on * 0.5, flashlight_power * 0.75, light_color)
|
||||
else if(brightness_level == "high")
|
||||
set_light(brightness_on * 1.5, flashlight_power * 1.1, light_color)
|
||||
else
|
||||
set_light(brightness_on, flashlight_power, light_color)
|
||||
else
|
||||
icon_state = "[initial(icon_state)]"
|
||||
set_light(0)
|
||||
@@ -47,18 +124,76 @@
|
||||
M.update_inv_r_ear()
|
||||
M.update_inv_head()
|
||||
|
||||
/obj/item/device/flashlight/examine(mob/user)
|
||||
. = ..()
|
||||
if(power_use && brightness_level)
|
||||
to_chat(user, SPAN_NOTICE("\The [src] is set to [brightness_level]."))
|
||||
if(cell)
|
||||
to_chat(user, SPAN_NOTICE("\The [src] has a \the [cell] attached."))
|
||||
|
||||
/obj/item/device/flashlight/attack_self(mob/user)
|
||||
if(!isturf(user.loc))
|
||||
to_chat(user, "You cannot turn the light on while in this [user.loc].") //To prevent some lighting anomalities.)
|
||||
if(always_on)
|
||||
to_chat(user, SPAN_NOTICE("You cannot toggle \the [name]."))
|
||||
return 0
|
||||
|
||||
if(power_use)
|
||||
if(!cell || !cell.check_charge(1))
|
||||
playsound(src.loc, toggle_sound, 60, 1)
|
||||
to_chat(user, SPAN_WARNING("You flip the switch on \the [name], but nothing happens!"))
|
||||
return 0
|
||||
|
||||
if(!isturf(user.loc))
|
||||
to_chat(user, SPAN_NOTICE("You cannot turn the light on while in this [user.loc].")) //To prevent some lighting anomalities.
|
||||
return 0
|
||||
|
||||
playsound(src.loc, toggle_sound, 60, 1)
|
||||
toggle()
|
||||
user.update_action_buttons()
|
||||
return 1
|
||||
|
||||
/obj/item/device/flashlight/attack_hand(mob/user)
|
||||
if(user.get_inactive_hand() == src)
|
||||
if(cell)
|
||||
STOP_PROCESSING(SSprocessing, src)
|
||||
cell.update_icon()
|
||||
user.put_in_hands(cell)
|
||||
cell = null
|
||||
to_chat(user, SPAN_NOTICE("You remove the cell from \the [src]."))
|
||||
playsound(src, 'sound/machines/click.ogg', 30, 1, 0)
|
||||
on = FALSE
|
||||
update_icon()
|
||||
return
|
||||
..()
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/item/device/flashlight/attackby(obj/item/W, mob/user)
|
||||
if(power_use)
|
||||
if(istype(W, /obj/item/cell))
|
||||
if(istype(W, /obj/item/cell/device) || accepts_large_cells)
|
||||
if(!cell)
|
||||
user.drop_item()
|
||||
W.loc = src
|
||||
cell = W
|
||||
to_chat(user, SPAN_NOTICE("You install a cell in \the [src]."))
|
||||
playsound(src, 'sound/machines/click.ogg', 30, 1, 0)
|
||||
update_icon()
|
||||
else
|
||||
to_chat(user, SPAN_WARNING("\The [src] already has a cell!"))
|
||||
else
|
||||
to_chat(user, SPAN_WARNING("\The [src] cannot accept that type of cell."))
|
||||
|
||||
else
|
||||
..()
|
||||
|
||||
/obj/item/device/flashlight/proc/toggle()
|
||||
on = !on
|
||||
if(on && activation_sound)
|
||||
playsound(src.loc, activation_sound, 75, 1)
|
||||
if(on && power_use)
|
||||
START_PROCESSING(SSprocessing, src)
|
||||
else if (power_use)
|
||||
STOP_PROCESSING(SSprocessing, src)
|
||||
update_icon()
|
||||
|
||||
/obj/item/device/flashlight/vendor_action(var/obj/machinery/vending/V)
|
||||
@@ -82,6 +217,11 @@
|
||||
set_dir(new_dir)
|
||||
update_light()
|
||||
|
||||
/obj/item/device/flashlight/emp_act(severity)
|
||||
for(var/obj/O in contents)
|
||||
O.emp_act(severity)
|
||||
..()
|
||||
|
||||
/obj/item/device/flashlight/attack(mob/living/M as mob, mob/living/user as mob)
|
||||
add_fingerprint(user)
|
||||
if(on && user.zone_sel.selecting == BP_EYES)
|
||||
@@ -89,6 +229,10 @@
|
||||
if(((user.is_clumsy()) || HAS_FLAG(user.mutations, DUMB)) && prob(50)) //too dumb to use flashlight properly
|
||||
return ..() //just hit them in the head
|
||||
|
||||
if(brightness_on < 2)
|
||||
to_chat(user, SPAN_WARNING("This light is too dim to see anything with!"))
|
||||
return
|
||||
|
||||
var/mob/living/carbon/human/H = M //mob has protective eyewear
|
||||
if(istype(H))
|
||||
if(H.get_flash_protection())
|
||||
@@ -101,36 +245,58 @@
|
||||
if(!vision)
|
||||
to_chat(user, SPAN_WARNING("You can't find any [H.species.vision_organ ? H.species.vision_organ : "eyes"] on [H]!"))
|
||||
|
||||
user.visible_message(SPAN_NOTICE("\The [user] directs [src] to [M]'s eyes."), SPAN_NOTICE("You direct [src] to [M]'s eyes."))
|
||||
user.visible_message(
|
||||
SPAN_NOTICE("\The [user] directs [src] to [M]'s eyes."),
|
||||
SPAN_NOTICE("You direct [src] to [M]'s eyes.")
|
||||
)
|
||||
|
||||
if (H != user) //can't look into your own eyes buster
|
||||
if(M.stat == DEAD || M.blinded || M.status_flags & FAKEDEATH) //mob is dead or fully blind
|
||||
to_chat(user, SPAN_WARNING("\The [M]'s pupils do not react to the light!"))
|
||||
return
|
||||
if(HAS_FLAG(M.mutations, XRAY))
|
||||
to_chat(user, SPAN_NOTICE("\The [M]'s pupils give an eerie glow!"))
|
||||
if(vision.damage)
|
||||
to_chat(user, SPAN_WARNING("There's visible damage to [M]'s [vision.name]!"))
|
||||
else if(M.eye_blurry)
|
||||
to_chat(user, SPAN_NOTICE("\The [M]'s pupils react slower than normally."))
|
||||
if(M.getBrainLoss() > 15)
|
||||
to_chat(user, SPAN_NOTICE("There's visible lag between left and right pupils' reactions."))
|
||||
|
||||
var/list/pinpoint = list(/singleton/reagent/oxycomorphine=1,/singleton/reagent/mortaphenyl=5)
|
||||
var/list/dilating = list(/singleton/reagent/space_drugs=5,/singleton/reagent/mindbreaker=1)
|
||||
var/datum/reagents/ingested = H.get_ingested_reagents()
|
||||
if(H.reagents.has_any_reagent(pinpoint) || ingested.has_any_reagent(pinpoint))
|
||||
to_chat(user, SPAN_NOTICE("\The [M]'s pupils are already pinpoint and cannot narrow any more."))
|
||||
else if(H.shock_stage >= 30 || H.reagents.has_any_reagent(dilating) || ingested.has_any_reagent(dilating) || H.breathing.has_any_reagent(dilating))
|
||||
to_chat(user, SPAN_NOTICE("\The [M]'s pupils narrow slightly, but are still very dilated."))
|
||||
else
|
||||
to_chat(user, SPAN_NOTICE("\The [M]'s pupils narrow."))
|
||||
inspect_vision(vision, user)
|
||||
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) //can be used offensively
|
||||
H.flash_act(length = 1 SECOND)
|
||||
if (!(brightness_on < 2))
|
||||
H.flash_act(length = 1 SECOND)
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/item/device/flashlight/proc/inspect_vision(obj/item/organ/vision, mob/living/user)
|
||||
var/mob/living/carbon/human/H = vision.owner
|
||||
|
||||
if (H == user) //can't look into your own eyes buster
|
||||
return
|
||||
|
||||
if (!BP_IS_ROBOTIC(vision))
|
||||
|
||||
if(H.stat == DEAD || H.blinded || H.status_flags & FAKEDEATH) //mob is dead or fully blind
|
||||
to_chat(user, SPAN_WARNING("\The [H]'s pupils do not react to the light!"))
|
||||
return
|
||||
if(HAS_FLAG(H.mutations, XRAY))
|
||||
to_chat(user, SPAN_NOTICE("\The [H]'s pupils give an eerie glow!"))
|
||||
if(vision.damage)
|
||||
to_chat(user, SPAN_WARNING("There's visible damage to [H]'s [vision.name]!"))
|
||||
else if(H.eye_blurry)
|
||||
to_chat(user, SPAN_NOTICE("\The [H]'s pupils react slower than normally."))
|
||||
if(H.getBrainLoss() > 15)
|
||||
to_chat(user, SPAN_NOTICE("There's visible lag between the left and right pupils' reactions."))
|
||||
|
||||
var/list/pinpoint = list(/singleton/reagent/oxycomorphine=1,/singleton/reagent/mortaphenyl=5)
|
||||
var/list/dilating = list(/singleton/reagent/space_drugs=5,/singleton/reagent/mindbreaker=1)
|
||||
var/datum/reagents/ingested = H.get_ingested_reagents()
|
||||
if(H.reagents.has_any_reagent(pinpoint) || ingested.has_any_reagent(pinpoint))
|
||||
to_chat(user, SPAN_NOTICE("\The [H]'s pupils are already pinpoint and cannot narrow any more."))
|
||||
else if(H.shock_stage >= 30 || H.reagents.has_any_reagent(dilating) || ingested.has_any_reagent(dilating) || H.breathing.has_any_reagent(dilating))
|
||||
to_chat(user, SPAN_NOTICE("\The [H]'s pupils narrow slightly, but are still very dilated."))
|
||||
else
|
||||
to_chat(user, SPAN_NOTICE("\The [H]'s pupils narrow."))
|
||||
|
||||
/obj/item/device/flashlight/verb/toggle_brightness()
|
||||
set name = "Toggle Flashlight Brightness"
|
||||
set category = "Object"
|
||||
set src in usr
|
||||
set_brightness(usr)
|
||||
|
||||
/obj/item/device/flashlight/empty
|
||||
starts_with_cell = FALSE
|
||||
|
||||
/obj/item/device/flashlight/pen
|
||||
name = "penlight"
|
||||
desc = "A pen-sized light, used by medical staff."
|
||||
@@ -155,18 +321,18 @@
|
||||
|
||||
/obj/item/device/flashlight/heavy
|
||||
name = "heavy duty flashlight"
|
||||
desc = "A high-luminosity flashlight for specialist duties."
|
||||
desc = "A high-luminosity flashlight, for specialist duties."
|
||||
icon_state = "heavyflashlight"
|
||||
item_state = "heavyflashlight"
|
||||
brightness_on = 4
|
||||
w_class = ITEMSIZE_NORMAL
|
||||
uv_intensity = 60
|
||||
matter = list(DEFAULT_WALL_MATERIAL = 100, MATERIAL_GLASS = 70)
|
||||
matter = list(MATERIAL_PLASTIC = 100, MATERIAL_GLASS = 70)
|
||||
light_wedge = LIGHT_SEMI
|
||||
|
||||
/obj/item/device/flashlight/maglight
|
||||
name = "maglight"
|
||||
desc = "A heavy flashlight designed for security personnel."
|
||||
desc = "A heavy flashlight, designed for security personnel."
|
||||
icon_state = "maglight"
|
||||
item_state = "maglight"
|
||||
force = 10
|
||||
@@ -178,26 +344,30 @@
|
||||
hitsound = 'sound/weapons/smash.ogg'
|
||||
light_wedge = LIGHT_NARROW
|
||||
|
||||
/obj/item/device/flashlight/maglight/update_icon()
|
||||
..()
|
||||
if(on)
|
||||
item_state = "maglight-on"
|
||||
else
|
||||
item_state = "maglight"
|
||||
|
||||
/obj/item/device/flashlight/slime
|
||||
gender = PLURAL
|
||||
name = "glowing slime extract"
|
||||
desc = "A glowing ball of what appears to be amber."
|
||||
desc_info = null
|
||||
icon = 'icons/obj/lighting.dmi'
|
||||
icon_state = "floor1" //not a slime extract sprite but... something close enough!
|
||||
item_state = "slime"
|
||||
w_class = ITEMSIZE_TINY
|
||||
brightness_on = 6
|
||||
uv_intensity = 200
|
||||
on = 1 //Bio-luminesence has one setting, on.
|
||||
on = TRUE //Bio-luminesence has one setting, on.
|
||||
always_on = TRUE
|
||||
power_usage = FALSE
|
||||
light_color = LIGHT_COLOR_SLIME_LAMP
|
||||
light_wedge = LIGHT_OMNI
|
||||
|
||||
/obj/item/device/flashlight/slime/update_icon()
|
||||
return
|
||||
|
||||
/obj/item/device/flashlight/slime/attack_self(mob/user)
|
||||
return //Bio-luminescence does not toggle.
|
||||
|
||||
/obj/item/device/flashlight/headlights
|
||||
name = "headlights"
|
||||
desc = "Some nifty lamps drawing from internal battery sources to produce a light, though a dim one."
|
||||
@@ -209,3 +379,32 @@
|
||||
w_class = ITEMSIZE_TINY
|
||||
light_wedge = LIGHT_WIDE
|
||||
body_parts_covered = 0
|
||||
|
||||
/******************************Lantern*******************************/
|
||||
|
||||
/obj/item/device/flashlight/lantern
|
||||
name = "lantern"
|
||||
desc = "A mining lantern. Accepts larger cells than normal flashlights."
|
||||
icon_state = "lantern"
|
||||
item_state = "lantern"
|
||||
item_icons = list(
|
||||
slot_l_hand_str = 'icons/mob/items/lefthand_mining.dmi',
|
||||
slot_r_hand_str = 'icons/mob/items/righthand_mining.dmi',
|
||||
)
|
||||
force = 10
|
||||
attack_verb = list("bludgeoned, bashed, whacked")
|
||||
w_class = ITEMSIZE_NORMAL
|
||||
matter = list(MATERIAL_STEEL = 200,MATERIAL_GLASS = 100)
|
||||
flashlight_power = 1
|
||||
brightness_on = 4
|
||||
cell_type = /obj/item/cell
|
||||
accepts_large_cells = TRUE
|
||||
light_wedge = LIGHT_OMNI
|
||||
light_color = LIGHT_COLOR_FIRE
|
||||
|
||||
/obj/item/device/flashlight/lantern/update_icon()
|
||||
..()
|
||||
if(on)
|
||||
item_state = "lantern-on"
|
||||
else
|
||||
item_state = "lantern"
|
||||
|
||||
@@ -3,18 +3,19 @@
|
||||
desc = "A green military-grade glowstick."
|
||||
w_class = ITEMSIZE_SMALL
|
||||
brightness_on = 1.2
|
||||
light_power = 2
|
||||
color = "#49F37C"
|
||||
flashlight_power = 2
|
||||
light_color = "#49F37C"
|
||||
icon_state = "glowstick"
|
||||
item_state = "glowstick"
|
||||
produce_heat = 0
|
||||
uv_intensity = 255
|
||||
light_wedge = LIGHT_OMNI
|
||||
activation_sound = 'sound/items/glowstick.ogg'
|
||||
overrides_activation_message = TRUE
|
||||
toggle_sound = null
|
||||
|
||||
/obj/item/device/flashlight/flare/glowstick/Initialize()
|
||||
. = ..()
|
||||
fuel = rand(900, 1200)
|
||||
fuel = rand(9 MINUTES, 12 MINUTES)
|
||||
light_color = color
|
||||
|
||||
/obj/item/device/flashlight/flare/glowstick/process()
|
||||
@@ -31,33 +32,23 @@
|
||||
icon_state = "[initial(icon_state)]-empty"
|
||||
set_light(0)
|
||||
else if(on)
|
||||
var/image/I = overlay_image(icon, "glowstick-overlay", color)
|
||||
I.blend_mode = BLEND_ADD
|
||||
add_overlay(I)
|
||||
icon_state = "[initial(icon_state)]-on"
|
||||
item_state = "[initial(icon_state)]-on"
|
||||
set_light(brightness_on)
|
||||
set_light(brightness_on, flashlight_power, light_color)
|
||||
else
|
||||
icon_state = initial(icon_state)
|
||||
update_held_icon()
|
||||
|
||||
/obj/item/device/flashlight/flare/glowstick/attack_self(var/mob/living/user)
|
||||
if(((user.is_clumsy())) && prob(50))
|
||||
to_chat(user, SPAN_WARNING("You break \the [src] apart, spilling its contents everywhere!"))
|
||||
fuel = 0
|
||||
new /obj/effect/decal/cleanable/greenglow(get_turf(user))
|
||||
user.apply_damage(rand(15,30), DAMAGE_RADIATION, damage_flags = DAMAGE_FLAG_DISPERSED)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
if(!fuel)
|
||||
to_chat(user, SPAN_WARNING("\The [src] has already been used."))
|
||||
return
|
||||
if(on)
|
||||
to_chat(user, SPAN_WARNING("\The [src] has already been turned on."))
|
||||
return
|
||||
|
||||
. = ..()
|
||||
|
||||
if(.)
|
||||
user.visible_message(SPAN_NOTICE("\The [user] cracks and shakes \the [src]."), SPAN_NOTICE("You crack and shake \the [src], turning it on!"))
|
||||
/obj/item/device/flashlight/flare/glowstick/activate(mob/user)
|
||||
if(istype(user))
|
||||
user.visible_message(
|
||||
SPAN_NOTICE("\The [user] cracks and shakes \the [src]."),
|
||||
SPAN_NOTICE("You crack and shake \the [src], turning it on!"),
|
||||
SPAN_NOTICE("You hear someone crack and shake a glowstick.")
|
||||
)
|
||||
|
||||
/obj/item/device/flashlight/flare/glowstick/red
|
||||
name = "red glowstick"
|
||||
@@ -86,4 +77,4 @@
|
||||
|
||||
/obj/item/device/flashlight/flare/glowstick/random/Initialize()
|
||||
color = rgb(rand(50, 255), rand(50, 255), rand(50, 255))
|
||||
. = ..()
|
||||
. = ..()
|
||||
|
||||
@@ -1,26 +1,40 @@
|
||||
/obj/item/device/flashlight/lamp
|
||||
name = "desk lamp"
|
||||
desc = "A desk lamp with an adjustable mount."
|
||||
desc_info = "Use this item in your hand to toggle the light, or right click this object and use the 'Toggle Light' verb."
|
||||
desc_antag = "As a Cultist, this item can be reforged to become a pylon."
|
||||
icon_state = "lamp"
|
||||
item_state = "lamp"
|
||||
center_of_mass = list("x" = 13,"y" = 11)
|
||||
brightness_on = 4
|
||||
flashlight_power = 1.0
|
||||
w_class = ITEMSIZE_HUGE
|
||||
flags = CONDUCT
|
||||
uv_intensity = 100
|
||||
power_use = FALSE
|
||||
on = TRUE
|
||||
slot_flags = 0 //No wearing desklamps
|
||||
light_wedge = LIGHT_OMNI
|
||||
toggle_sound = /singleton/sound_category/switch_sound
|
||||
activation_sound = 'sound/effects/lighton.ogg'
|
||||
|
||||
|
||||
// green-shaded desk lamp
|
||||
/obj/item/device/flashlight/lamp/green
|
||||
desc = "A classic green-shaded desk lamp."
|
||||
icon_state = "lampgreen"
|
||||
item_state = "lampgreen"
|
||||
center_of_mass = list("x" = 15,"y" = 11)
|
||||
brightness_on = 5
|
||||
light_color = "#FFC58F"
|
||||
toggle_sound = 'sound/machines/switch_chain.ogg'
|
||||
|
||||
/obj/item/device/flashlight/lamp/verb/toggle_light()
|
||||
set name = "Toggle Light"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if(!usr.stat)
|
||||
attack_self(usr)
|
||||
|
||||
//Lava Lamps: Because we're already stuck in the 70ies with those fax machines.
|
||||
/obj/item/device/flashlight/lamp/lava
|
||||
@@ -28,11 +42,12 @@
|
||||
desc = "Random oil globules within were parsed in photos for your protection. Enjoy this kitschy memorabilia by sticking it on your desk."
|
||||
icon_state = "lavalamp"
|
||||
brightness_on = 3
|
||||
flashlight_power = 0.5
|
||||
matter = list(DEFAULT_WALL_MATERIAL = 250, MATERIAL_GLASS = 200)
|
||||
|
||||
/obj/item/device/flashlight/lamp/lava/update_icon()
|
||||
if(on)
|
||||
set_light(brightness_on)
|
||||
set_light(brightness_on, flashlight_power, light_color)
|
||||
else
|
||||
set_light(0)
|
||||
cut_overlays()
|
||||
@@ -69,4 +84,4 @@
|
||||
desc = "A portable, beautiful and flashy stage light!"
|
||||
light_color = COLOR_ORANGE
|
||||
icon_state = "stage"
|
||||
item_state = "stage"
|
||||
item_state = "stage"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/obj/item/device/flashlight/survival
|
||||
name = "survival flashlight"
|
||||
desc = "A hand-held emergency light. This one has been modified with a larger bulb pointing inwards."
|
||||
desc = "A hand-held emergency light. This one has been modified with a larger, more efficient bulb pointing inwards."
|
||||
icon_state = "survival_flashlight"
|
||||
item_state = "survival_flashlight"
|
||||
light_wedge = null
|
||||
@@ -9,44 +9,4 @@
|
||||
light_power = 2
|
||||
brightness_on = 2
|
||||
light_color = LIGHT_COLOR_GREEN
|
||||
|
||||
var/obj/item/cell/cell
|
||||
var/last_drain = 0
|
||||
var/drain_per_second = 4 // should last about four minutes
|
||||
|
||||
/obj/item/device/flashlight/survival/Initialize()
|
||||
. = ..()
|
||||
cell = new /obj/item/cell/device(src)
|
||||
|
||||
/obj/item/device/flashlight/survival/Destroy()
|
||||
QDEL_NULL(cell)
|
||||
return ..()
|
||||
|
||||
/obj/item/device/flashlight/survival/examine(mob/user, distance)
|
||||
. = ..()
|
||||
to_chat(user, SPAN_NOTICE("\The [src]'s power cell is at [round(cell.percent())]%."))
|
||||
|
||||
/obj/item/device/flashlight/survival/attack_self(mob/user)
|
||||
if(!on && !cell.check_charge(1))
|
||||
to_chat(user, SPAN_WARNING("\The [src] doesn't have any charge!"))
|
||||
return
|
||||
return ..()
|
||||
|
||||
/obj/item/device/flashlight/survival/toggle()
|
||||
if(!on && !cell.check_charge(1))
|
||||
return
|
||||
..()
|
||||
if(on)
|
||||
last_drain = world.time
|
||||
START_PROCESSING(SSprocessing, src)
|
||||
else
|
||||
STOP_PROCESSING(SSprocessing, src)
|
||||
|
||||
/obj/item/device/flashlight/survival/process()
|
||||
var/cell_drain = ((world.time - last_drain) / 10) * drain_per_second
|
||||
if(!cell.use(cell_drain) && on)
|
||||
toggle()
|
||||
last_drain = world.time
|
||||
|
||||
/obj/item/device/flashlight/survival/get_cell()
|
||||
return cell
|
||||
efficiency_modifier = 1.2 // 120% more efficient compared to other flashlights
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
icon_supported_species_tags = list("una", "taj")
|
||||
var/active = FALSE
|
||||
var/obj/item/cell/cig_cell
|
||||
var/cell_type = /obj/item/cell/crap/cig
|
||||
var/cell_type = /obj/item/cell/device
|
||||
var/obj/item/reagent_containers/ecig_cartridge/ec_cartridge
|
||||
var/cartridge_type = /obj/item/reagent_containers/ecig_cartridge/med_nicotine
|
||||
w_class = ITEMSIZE_TINY
|
||||
@@ -20,7 +20,7 @@
|
||||
chem_volume = 0 //ecig has no storage on its own but has reagent container created by parent obj
|
||||
item_state = "ecigoff"
|
||||
var/icon_empty
|
||||
var/power_usage = 500 //value for simple ecig, divide by 5 to get the charge needed for 1 cartridge
|
||||
var/power_usage = 250 //value for simple ecig, divide by 5 to get the charge needed for 1 cartridge
|
||||
var/ecig_colors = list(null, COLOR_DARK_GRAY, COLOR_RED_GRAY, COLOR_BLUE_GRAY, COLOR_GREEN_GRAY, COLOR_PURPLE_GRAY)
|
||||
var/idle = 0
|
||||
var/idle_treshold = 30
|
||||
@@ -56,7 +56,6 @@
|
||||
icon_off = "ecigoff1"
|
||||
icon_empty = "ecigoff1"
|
||||
icon_on = "ecigon"
|
||||
cell_type = /obj/item/cell/crap/cig //enough for two cartridges
|
||||
|
||||
/obj/item/clothing/mask/smokable/ecig/util/Initialize()
|
||||
. = ..()
|
||||
@@ -71,7 +70,7 @@ obj/item/clothing/mask/smokable/ecig/util/examine(mob/user)
|
||||
if(cig_cell)
|
||||
to_chat(user, SPAN_NOTICE("The power meter shows that there's about [round(cig_cell.percent(), 5)]% power remaining."))
|
||||
else
|
||||
to_chat(user, SPAN_NOTICE("There's no cartridge connected."))
|
||||
to_chat(user, SPAN_NOTICE("There's no power cell connected."))
|
||||
if(active)
|
||||
to_chat(user, SPAN_NOTICE("It is currently turned on."))
|
||||
else
|
||||
@@ -84,7 +83,7 @@ obj/item/clothing/mask/smokable/ecig/util/examine(mob/user)
|
||||
icon_off = "pcigoff1"
|
||||
icon_empty = "pcigoff2"
|
||||
icon_on = "pcigon"
|
||||
cell_type = /obj/item/cell/crap //enough for five catridges
|
||||
cell_type = /obj/item/cell/device/high
|
||||
|
||||
/obj/item/clothing/mask/smokable/ecig/deluxe/examine(mob/user)
|
||||
. = ..()
|
||||
@@ -95,7 +94,7 @@ obj/item/clothing/mask/smokable/ecig/util/examine(mob/user)
|
||||
if(cig_cell)
|
||||
to_chat(user, SPAN_NOTICE("The power meter shows that there's about [round(cig_cell.percent(), 1)]% power remaining."))
|
||||
else
|
||||
to_chat(user, SPAN_NOTICE("There's no cartridge connected."))
|
||||
to_chat(user, SPAN_NOTICE("There's no power cell connected."))
|
||||
|
||||
/obj/item/clothing/mask/smokable/ecig/proc/deactivate()
|
||||
active = FALSE
|
||||
@@ -169,8 +168,8 @@ obj/item/clothing/mask/smokable/ecig/util/examine(mob/user)
|
||||
if(cig_cell) //if contains powercell
|
||||
cig_cell.update_icon()
|
||||
user.put_in_hands(cig_cell)
|
||||
cig_cell = null
|
||||
to_chat(user, SPAN_NOTICE("You remove \the [cig_cell] from \the [src]."))
|
||||
cig_cell = null
|
||||
else //does not contains cell
|
||||
to_chat(user, SPAN_WARNING("There's no battery in \the [src]."))
|
||||
|
||||
@@ -178,10 +177,8 @@ obj/item/clothing/mask/smokable/ecig/util/examine(mob/user)
|
||||
if(cig_cell)
|
||||
to_chat(user, SPAN_WARNING("\The [src] already has a battery installed."))
|
||||
return
|
||||
var/obj/item/cell/C = I
|
||||
var/obj/item/cell/max_cap = cell_type
|
||||
if (C.maxcharge > initial(max_cap.maxcharge)) // using initial means you don't have to instantiate the object
|
||||
to_chat(user, SPAN_WARNING("\The [cig_cell] is too powerful to be inserted into \the [src]."))
|
||||
if (!istype(I, /obj/item/cell/device))
|
||||
to_chat(user, SPAN_WARNING("\The [I] is too large to be inserted into \the [src]."))
|
||||
return
|
||||
if(user.unEquip(I))
|
||||
I.forceMove(src)
|
||||
|
||||
@@ -17,17 +17,24 @@
|
||||
matter = list(DEFAULT_WALL_MATERIAL = 700, MATERIAL_GLASS = 50)
|
||||
recyclable = TRUE
|
||||
|
||||
//currently only used by energy-type guns, that may change in the future.
|
||||
/// Smaller variant, used by energy guns and similar small devices
|
||||
/obj/item/cell/device
|
||||
name = "device power cell"
|
||||
desc = "A small power cell designed to power handheld devices."
|
||||
icon_state = "cell" //placeholder
|
||||
icon_state = "device"
|
||||
w_class = ITEMSIZE_SMALL
|
||||
force = 0
|
||||
throw_speed = 5
|
||||
throw_range = 7
|
||||
maxcharge = 1000
|
||||
matter = list(MATERIAL_STEEL = 350, MATERIAL_GLASS = 50)
|
||||
maxcharge = 100
|
||||
matter = list(MATERIAL_STEEL = 70, MATERIAL_GLASS = 5)
|
||||
|
||||
/obj/item/cell/device/high
|
||||
name = "advanced power cell"
|
||||
desc = "A small, advanced power cell designed to power more energy demanding handheld devices."
|
||||
icon_state = "hdevice"
|
||||
maxcharge = 250
|
||||
matter = list(MATERIAL_STEEL = 150, MATERIAL_GLASS = 10)
|
||||
|
||||
/obj/item/cell/device/variable/New(newloc, charge_amount)
|
||||
..(newloc)
|
||||
@@ -35,8 +42,8 @@
|
||||
charge = maxcharge
|
||||
|
||||
/obj/item/cell/crap
|
||||
name = "\improper rechargable AA battery"
|
||||
desc = "You can't top the plasma top." //TOTALLY TRADEMARK INFRINGEMENT
|
||||
name = "old power cell"
|
||||
desc = "A cheap, old power cell. It's probably been in use for quite some time now."
|
||||
origin_tech = list(TECH_POWER = 0)
|
||||
maxcharge = 500
|
||||
matter = list(DEFAULT_WALL_MATERIAL = 700, MATERIAL_GLASS = 40)
|
||||
|
||||
Reference in New Issue
Block a user