From efcf4b9ebe4b4b56e62914ea757def1fc7c8558c Mon Sep 17 00:00:00 2001 From: Casper3667 Date: Mon, 5 Apr 2021 22:30:18 +0200 Subject: [PATCH] Laser pointer fixes (#11590) * Laser pointer fixes * Adds \the to some laser pointer stuff --- .../objects/items/devices/laserpointer.dm | 26 +++++++----- html/changelogs/LaserPointersAgain.yml | 41 +++++++++++++++++++ 2 files changed, 57 insertions(+), 10 deletions(-) create mode 100644 html/changelogs/LaserPointersAgain.yml diff --git a/code/game/objects/items/devices/laserpointer.dm b/code/game/objects/items/devices/laserpointer.dm index 5d0b8e7db70..8a1dfbe0ab8 100644 --- a/code/game/objects/items/devices/laserpointer.dm +++ b/code/game/objects/items/devices/laserpointer.dm @@ -40,6 +40,7 @@ /obj/item/device/laser_pointer/attack(mob/living/M, mob/user) laser_act(M, user) + user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) /obj/item/device/laser_pointer/attackby(obj/item/W, mob/user) if(istype(W, /obj/item/stock_parts/micro_laser)) @@ -64,12 +65,13 @@ if(flag) //we're placing the object on a table or in backpack return laser_act(target, user) + user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) /obj/item/device/laser_pointer/proc/laser_act(var/atom/target, var/mob/living/user) if( !(user in (viewers(7,target))) ) return if (!diode) - to_chat(user, "You point [src] at [target], but nothing happens!") + to_chat(user, "You point \the [src] at \the [target], but nothing happens!") return if (!user.IsAdvancedToolUser()) to_chat(user, "You don't have the dexterity to do this!") @@ -78,7 +80,8 @@ add_fingerprint(user) - var/outmsg + var/selfmsg + var/othermsg var/turf/targloc = get_turf(target) if(istype(target, /obj/machinery/camera)) @@ -86,21 +89,24 @@ if(prob(25)) C.emp_act(28) - outmsg = "You hit the lens of [C] with [src], temporarily disabling the camera!" + selfmsg = "You hit the lens of \the [C] with \the [src], temporarily disabling the camera!" admin_attack_log(user, src,"hits the camera with a laser pointer", "EMPd a camera with a laser pointer") else - outmsg = "You fail to hit the lens of [C] with [src]." + selfmsg = "You fail to hit the lens of \the [C] with \the [src]." + othermsg = "[user] shines \the [src] at \the [C]." if(iscarbon(target)) if(user.zone_sel.selecting == BP_EYES) var/mob/living/carbon/C = target if(C.eyecheck() <= 0 && prob(30)) - outmsg = "You blind [C] with [src]" + selfmsg = "You blind \the [C] with \the [src]." + othermsg = "[user] shines \the [src] at \the [C]'s eyes'." C.eye_blind = 3 else - outmsg = "You fail to blind [C] with [src]" + selfmsg = "You fail to blind \the [C] with \the [src]." + othermsg = "[user] fails to blind \the [C] with \the [src]." //laser pointer image icon_state = "pointer_[pointer_icon_state]" @@ -112,13 +118,13 @@ I.pixel_x = target.pixel_x + rand(-5,5) I.pixel_y = target.pixel_y + rand(-5,5) - if(outmsg) - to_chat(user, outmsg) + if(selfmsg) + user.visible_message(othermsg, selfmsg) else - to_chat(user, "You point [src] at [target].") + user.visible_message("[user] points \the [src] at \the [target].", "You point \the [src] at \the [target].") - flick_overlay(I, showto, 10) + flick_overlay(I, showto, 15) icon_state = "pointer" /obj/item/device/laser_pointer/Destroy() diff --git a/html/changelogs/LaserPointersAgain.yml b/html/changelogs/LaserPointersAgain.yml new file mode 100644 index 00000000000..9c679202e7b --- /dev/null +++ b/html/changelogs/LaserPointersAgain.yml @@ -0,0 +1,41 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: TheGreyWolf + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - bugfix: "Laser pointers now show chat messages when pointed at things and have a click delay." \ No newline at end of file