Files
Aurora.3/code/modules/projectiles/targeting/targeting_overlay.dm
Matt Atlas 659752e2ea Removes goonchat, adds TGChat and TG Stat Panels (#16514)
* tgui the beginning

* binaries and the like

* Bring in the last of it

* Example radio UI

* delete example

* NTOS Main Menu, start on manifest, tgui states

* tasks.json

* gunnery ui pt 1

* okay

* fix everything

* scss update

* oops

* manifest gigablast

* downloader part 1

* download prt 2

* NTOSDownloader final

* mfw committing to_worlds

* gunnery console pt2

* i cooked

* targeting (finished)

* one vueui down

* voting ui almost done

* MY MIND FEELS LIKE AN ARCH ENEMYYYY

* voting ui down

* photocopier

* ntos config + download fixes

* photocopier 2

* refactor define

* NTOS client manager + fixes

* fax machine final (it also uses toner now)

* marching forwards... left behind...

* ntnrc part 1

* canister

* add quotes

* portable pumps pt1 + more backgrounds

* oops

* finish the portable pump

* freezers

so I'll keep on pushing forward... you haven't seen the last of me... oooooooh...

* doors ui pt1

* finish doors UI (forgive me wildkins it's a bit of shitcode)

* vitals monitor, make things use labeled lists, new backgrounds

* mais j'envoyé aucun mayday...

* maglock pt1

* pour ça je me suis perdu...

* infrared

* fix that

* prox sensor pt1

* prox sensor

* signaler (this was actually pretty hard)

* atmos control pt1

* atmos control pt1.1

* atmos pt 2

* fuel injector

* multitool UI

* jammer

* list viewer

* APC

* portgen

* targeting console updates + SMES ui

* new themes, shield generator

* supermatter

* Add ore detector and (shitty) NTNet Relay

* orderterminal pt1

* orderterminal pt2

* smartfridge

* Add (air-)tank GUI update ore detector size

* Adds Transfer Valves

* Add AtmoScrubber

* analyzer pt1

* weapons analyzer pt2

* bodyscanner pt1

* bodyscanner pt2

* fix this shitcode

* seed storage

* appearance changer

* appearance changer final

* sleeper pt1

* sleeper

* gps

* vehicles

* chem dispenser

* lily request

* holopad

* tgui modules pt1

* ppanel

* damage menu

* fixes

* im here too now

* follow menu, search bars

* quikpay

* quikpay fixes

* circuit printer

* ppanel

* ppanel updates

* pai

* turret controls (i want to kill myself)

* tweak

* remove the boardgame

* guntracker

* implant tracker

* penal mechs

come close to me, come close to me

* chem codex

* pai radio

* doorjack

* pai directives

* signaler removal, sensors

* ghost spawner

* spawnpoint

* fixes

* teleporter

* one more to the chopping block

* account database

* remove divider

* scanner, atmos

* latejoin ui pt1

* latejoin

* records pt1

* RECORDS UI DONE

* delete interpreter & records

* CHAT FUCKING CLIENT

* data updates

* fix some things

* final UI, log

* basic nanoui fix

* antag panel

* remove vueui

* atm update

* vending update

* warrants, cameras

* ntmonitor

* time comes for all

* preserve this legacy

* bring that back (oops)

* rcon, ui auto update for computer UIs, remove rcon computers

* alarm monitoring (a bit broke and also todo: add custom alarm monitoring programs to a few consoles)

* A LIKE SUPREME

* a

* power monitor

* lights on

* fuck this code, fuck nanoui modules, and fuck nanoui

* LEAVE IT OH SO FAR BEHIND

* fix alarm monitoring for synths

* I SAW IN YOU WHAT LIFE WAS MISSING

* comms console

* idcard and record updates

* turn the light on

* arcade

* pt2

* news browser

* static

* crusher

* f

* COULD I JUST SLEIGH THE GOLD FROM THE BALLS? I'M SO FRUSTRATED OH COULD YOU TELL? IF I HEAR ONE MORE VUEUI OR ONE NANOUI I'M GONNA LOSE IT SO LET ME GOOOOOOOOOOOOOOOOO

* codeowners & suit sensors

* html ui style removal

* make lint happy

* tgchat

* tgpanels pt1

* THE SOUL LONGS FOR OBLIVION!!!!!!!!!!!!!!!!!

* figure out why stat isnt working

* goodbye ping

* shhh

* stat updates

* An oath sworn in scors! Omni vortex lies!

* final almost edits

* fix that

* last skin adjustments

* resist and disorder

* i slowly get up and turn off the noise, already fed up...

* pleaseeeeeeeeeeeeeee

* THE CREDIT LARP IS NECESSARY

* i hold the keys

* RISE UP

* fix that?

* harry's suggestions xoxo

* runtime fix pt2

* You are the only thing that I still care about

* fix runtimes and cl

* whoops

* misc fixes

* fix that too

* adds build workflow

* f

* Update update_tgui.yml

* adds some needed steps

* ATM

* misc fixes and tweaks

* fixes 2

* make newscasters usable and fix use power on freezers

* turret control is clearer

* remove duplicate

* makes some verb tabs work properly

* makes verbs work properly for real

* sans moi

* fixes pt2

* fix the chat unnecessarily reloading

* fixes

* epic

* fixes

* fix missing consoles

---------

Co-authored-by: John Wildkins <john.wildkins@gmail.com>
Co-authored-by: Matt Atlas <liermattia@gmail.com>
Co-authored-by: harryob <55142896+harryob@users.noreply.github.com>
Co-authored-by: Werner <Arrow768@users.noreply.github.com>
Co-authored-by: Geeves <ggrobler447@gmail.com>
Co-authored-by: harryob <me@harryob.live>
2023-06-26 02:00:14 +02:00

236 lines
7.1 KiB
Plaintext

/obj/aiming_overlay
name = ""
desc = "Stick 'em up!"
icon = 'icons/effects/Targeted.dmi'
icon_state = "locking"
anchored = 1
density = 0
opacity = 0
layer = FLY_LAYER
appearance_flags = NO_CLIENT_COLOR
simulated = 0
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
var/mob/living/aiming_at // Who are we currently targeting, if anyone?
var/obj/item/aiming_with // What are we targeting with?
var/mob/living/owner // Who do we belong to?
var/locked = 0 // Have we locked on?
var/lock_time = 0 // When -will- we lock on?
var/active = 0 // Is our owner intending to take hostages?
var/target_permissions = TARGET_CAN_MOVE | TARGET_CAN_CLICK | TARGET_CAN_RADIO // Permission bitflags.
var/aimcooldown // How long untill we can re-aim?
/obj/aiming_overlay/New(var/newowner)
..()
owner = newowner
loc = null
verbs.Cut()
/obj/aiming_overlay/proc/toggle_permission(var/perm)
if(target_permissions & perm)
target_permissions &= ~perm
else
target_permissions |= perm
// Update HUD icons.
if(owner.gun_move_icon)
if(!(target_permissions & TARGET_CAN_MOVE))
owner.gun_move_icon.icon_state = "no_walk0"
owner.gun_move_icon.name = "Allow Movement"
else
owner.gun_move_icon.icon_state = "no_walk1"
owner.gun_move_icon.name = "Disallow Movement"
if(owner.item_use_icon)
if(!(target_permissions & TARGET_CAN_CLICK))
owner.item_use_icon.icon_state = "no_item0"
owner.item_use_icon.name = "Allow Item Use"
else
owner.item_use_icon.icon_state = "no_item1"
owner.item_use_icon.name = "Disallow Item Use"
if(owner.radio_use_icon)
if(!(target_permissions & TARGET_CAN_RADIO))
owner.radio_use_icon.icon_state = "no_radio0"
owner.radio_use_icon.name = "Allow Radio Use"
else
owner.radio_use_icon.icon_state = "no_radio1"
owner.radio_use_icon.name = "Disallow Radio Use"
var/message = "no longer permitted to "
var/use_span = "warning"
if(target_permissions & perm)
message = "now permitted to "
use_span = "notice"
switch(perm)
if(TARGET_CAN_MOVE)
message += "move"
if(TARGET_CAN_CLICK)
message += "use items"
if(TARGET_CAN_RADIO)
message += "use a radio"
else
return
var/a_certain_scientific_railgun = (aiming_at ? "\The [aiming_at] is" : "Your targets are")
to_chat(owner, "<span class='[use_span]'> [a_certain_scientific_railgun] [message].</span>")
if(aiming_at)
to_chat(aiming_at, "<span class='[use_span]'>You are [message].</span>")
/obj/aiming_overlay/process()
if(!owner)
qdel(src)
return
..()
update_aiming()
/obj/aiming_overlay/Destroy()
cancel_aiming(1)
owner = null
return ..()
/obj/aiming_overlay/proc/update_aiming_deferred()
set waitfor = 0
sleep(0)
update_aiming()
/obj/aiming_overlay/proc/update_aiming()
if(!owner)
qdel(src)
return
if(!aiming_at)
cancel_aiming()
return
if(!locked && lock_time >= world.time)
locked = 1
update_icon()
var/cancel_aim = 1
if(!(aiming_with in owner) || (istype(owner, /mob/living/carbon/human) && (owner.l_hand != aiming_with && owner.r_hand != aiming_with)))
to_chat(owner, "<span class='warning'>You must keep hold of your weapon!</span>")
else if(!aiming_at || !istype(aiming_at.loc, /turf))
to_chat(owner, "<span class='warning'>You have lost sight of your target!</span>")
else if(owner.incapacitated() || owner.lying || owner.restrained())
to_chat(owner, "<span class='warning'>You must be conscious and standing to keep track of your target!</span>")
else if(aiming_at.is_invisible_to(owner))
to_chat(owner, "<span class='warning'>Your target has become invisible!</span>")
else if(!(aiming_at in view(owner)))
to_chat(owner, "<span class='warning'>Your target is too far away to track!</span>")
else
cancel_aim = 0
forceMove(get_turf(aiming_at))
if(cancel_aim)
cancel_aiming()
return
if(!owner.incapacitated() && owner.client)
spawn(0)
owner.set_dir(get_dir(get_turf(owner), get_turf(src)))
/obj/aiming_overlay/proc/aim_at(var/mob/target, var/obj/thing)
if (aimcooldown > world.time)
return
if(!owner)
return
if(owner.incapacitated())
to_chat(owner, "<span class='warning'>You cannot aim a gun in your current state.</span>")
return
if(owner.lying)
to_chat(owner, "<span class='warning'>You cannot aim a gun while prone.</span>")
return
if(owner.restrained())
to_chat(owner, "<span class='warning'>You cannot aim a gun while handcuffed.</span>")
return
if(aiming_at)
if(aiming_at == target)
return
cancel_aiming(1)
owner.visible_message("<span class='danger'>\The [owner] turns \the [thing] on \the [target]!</span>")
else
owner.visible_message("<span class='danger'>\The [owner] aims \the [thing] at \the [target]!</span>")
if(owner.client)
owner.client.add_gun_icons()
to_chat(target, "<span class='danger'>You now have a gun pointed at you. No sudden moves!</span>")
aiming_with = thing
aiming_at = target
if(istype(aiming_with, /obj/item/gun))
playsound(get_turf(owner), 'sound/weapons/TargetOn.ogg', 50,1)
admin_attack_log(owner, aiming_at, "\The [owner] is aiming at \the [aiming_at] with \the [aiming_with].", "\The [owner] is aiming at \the [aiming_at] with \the [aiming_with].", "\The [owner] is aiming at \the [aiming_at] with \the [aiming_with].")
forceMove(get_turf(target))
START_PROCESSING(SSprocessing, src)
aiming_at.aimed |= src
toggle_active(1)
locked = 0
update_icon()
lock_time = world.time + 35
moved_event.register(owner, src, PROC_REF(update_aiming))
moved_event.register(aiming_at, src, PROC_REF(target_moved))
destroyed_event.register(aiming_at, src, PROC_REF(cancel_aiming))
/obj/aiming_overlay/proc/aim_cooldown(var/seconds)
aimcooldown = world.time + seconds SECONDS
/obj/aiming_overlay/update_icon()
if(locked)
icon_state = "locked"
else
icon_state = "locking"
/obj/aiming_overlay/proc/toggle_active(var/force_state = null)
if(!isnull(force_state))
if(active == force_state)
return
active = force_state
else
active = !active
if(!active)
cancel_aiming()
if(owner.client)
if(active)
to_chat(owner, "<span class='notice'>You will now aim rather than fire.</span>")
owner.client.add_gun_icons()
else
to_chat(owner, "<span class='notice'>You will no longer aim rather than fire.</span>")
owner.client.remove_gun_icons()
/obj/aiming_overlay/proc/cancel_aiming(var/no_message = 0)
if(!aiming_with || !aiming_at)
return
admin_attack_log(owner, aiming_at, "\The [owner] is no longer aiming at \the [aiming_at] with \the [aiming_with].", "\The [owner] is no longer aiming at \the [aiming_at] with \the [aiming_with].", "\The [owner] is no longer aiming at \the [aiming_at] with \the [aiming_with].")
if(istype(aiming_with, /obj/item/gun))
playsound(get_turf(owner), 'sound/weapons/TargetOff.ogg', 50,1)
if(!no_message)
owner.visible_message("<span class='notice'>\The [owner] lowers \the [aiming_with].</span>")
moved_event.unregister(owner, src)
if(aiming_at)
moved_event.unregister(aiming_at, src)
destroyed_event.unregister(aiming_at, src)
aiming_at.aimed -= src
aiming_at = null
aiming_with = null
loc = null
STOP_PROCESSING(SSprocessing, src)
/obj/aiming_overlay/proc/target_moved()
update_aiming()
trigger(TARGET_CAN_MOVE)