Laser pointer fixes (#11590)

* Laser pointer fixes

* Adds \the to some laser pointer stuff
This commit is contained in:
Casper3667
2021-04-05 22:30:18 +02:00
committed by GitHub
parent df0816aa58
commit efcf4b9ebe
2 changed files with 57 additions and 10 deletions

View File

@@ -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, "<span class='notice'>You point [src] at [target], but nothing happens!</span>")
to_chat(user, "<span class='notice'>You point \the [src] at \the [target], but nothing happens!</span>")
return
if (!user.IsAdvancedToolUser())
to_chat(user, "<span class='warning'>You don't have the dexterity to do this!</span>")
@@ -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 = "<span class='notice'>You hit the lens of [C] with [src], temporarily disabling the camera!</span>"
selfmsg = "<span class='notice'>You hit the lens of \the [C] with \the [src], temporarily disabling the camera!</span>"
admin_attack_log(user, src,"hits the camera with a laser pointer", "EMPd a camera with a laser pointer")
else
outmsg = "<span class='notice'>You fail to hit the lens of [C] with [src].</span>"
selfmsg = "<span class='notice'>You fail to hit the lens of \the [C] with \the [src].</span>"
othermsg = "<b>[user]</b> 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 = "<span class='notice'>You blind [C] with [src]</span>"
selfmsg = "<span class='notice'>You blind \the [C] with \the [src].</span>"
othermsg = "<b>[user]</b> shines \the [src] at \the [C]'s eyes'."
C.eye_blind = 3
else
outmsg = "<span class='notice'>You fail to blind [C] with [src]</span>"
selfmsg = "<span class='notice'>You fail to blind \the [C] with \the [src].</span>"
othermsg = "<b>[user]</b> 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, "<span class='notice'>You point [src] at [target].</span>")
user.visible_message("<b>[user]</b> points \the [src] at \the [target].", "<span class='notice'>You point \the [src] at \the [target].</span>")
flick_overlay(I, showto, 10)
flick_overlay(I, showto, 15)
icon_state = "pointer"
/obj/item/device/laser_pointer/Destroy()

View File

@@ -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."