mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-31 12:33:08 +00:00
* Better notifications * Add buttons to del/move tabs in edit mode * Add a <span> to emotes * Fix duplicate IDs in VChat and add more logging * VChat: Redone chat output in Vue.js * Ported tg asset cache * VChat DME Update * Replace \image macro with bicon() * NanoUI Subsystem Fixes Don't do this, the asset subsystem does this for you * Allow narrate/globalnarrate shenanigans Allows HTML if your entire thing is HTML * Disable bicon() icon object cache, and create text tag cache * Ore Scanner is written incorrectly Only revealed by vchat * Fixes 2 VChat bugs * Underline links in VChat * Fix LOOC color * VChat Improvements Hopefully, anyway. - Arbitrary font size setting - Line height setting - Multiple crush settings - Rewrote how tabs work hopefully for performance - Hidden messages are actually put elsewhere - Attempts to correct chat backlog restore on rejoin * Surgery steps to use <span> * Some VChat Tweaks - Chat remains between client reconnects if your client didn't close (so things like using the reconnect button, or autoreconnects at round end when that feels like working) - The client doesn't send pings to the server, the server sends pings to the client. This fixes AFK measurements for AFK kick purposes. - Turn latency indicator into a green/red indicator to show if you're connected, and when clicked will perform a one-time ping (and block doing it again for 10 seconds). It will display '?ms' if it never got a reply, or '999ms' if it did, but it was over 1s. * Include date in filename for VChat log save * Merge pull request #6767 from Cyantime/patch-2 Change chat export naming scheme * Adds VChat tab saving Saves every time you enter/exit edit mode. Persists between rounds, VChat reloads via verb, etc. * Fix chat exporting when someone has used unicode Only affects clients still using 512 * Use CLIENT_FROM_VAR for ease of code reading * Update code/modules/client/asset_cache.dm Co-Authored-By: Novacat <35587478+Novacat@users.noreply.github.com> * Fix runtime when client disconnects before vchat loads * Fix polaris version of command reports * Fix LOOC color in oldchat * Put some styles in various adminpm messages * Round info and advanced who spans * Fix missing tag-end * Maybe fix images for linux and statpanel but also doom everyone Co-authored-by: ShadowLarkens <ShadowLarkens@users.noreply.github.com> Co-authored-by: Novacat <35587478+Novacat@users.noreply.github.com>
101 lines
3.2 KiB
Plaintext
101 lines
3.2 KiB
Plaintext
/obj/item/device/multitool/hacktool
|
|
var/is_hacking = 0
|
|
var/max_known_targets
|
|
|
|
var/in_hack_mode = 0
|
|
var/list/known_targets
|
|
var/list/supported_types
|
|
var/datum/topic_state/default/must_hack/hack_state
|
|
|
|
/obj/item/device/multitool/hacktool/New()
|
|
..()
|
|
known_targets = list()
|
|
max_known_targets = 5 + rand(1,3)
|
|
supported_types = list(/obj/machinery/door/airlock)
|
|
hack_state = new(src)
|
|
|
|
/obj/item/device/multitool/hacktool/Destroy()
|
|
for(var/T in known_targets)
|
|
var/atom/target = T
|
|
target.unregister(OBSERVER_EVENT_DESTROY, src)
|
|
known_targets.Cut()
|
|
qdel(hack_state)
|
|
hack_state = null
|
|
return ..()
|
|
|
|
/obj/item/device/multitool/hacktool/attackby(var/obj/item/W, var/mob/user)
|
|
if(W.is_screwdriver())
|
|
in_hack_mode = !in_hack_mode
|
|
playsound(src.loc, W.usesound, 50, 1)
|
|
else
|
|
..()
|
|
|
|
/obj/item/device/multitool/hacktool/resolve_attackby(atom/A, mob/user)
|
|
sanity_check()
|
|
|
|
if(!in_hack_mode)
|
|
return ..()
|
|
|
|
if(!attempt_hack(user, A))
|
|
return 0
|
|
|
|
A.ui_interact(user, state = hack_state)
|
|
return 1
|
|
|
|
/obj/item/device/multitool/hacktool/proc/attempt_hack(var/mob/user, var/atom/target)
|
|
if(is_hacking)
|
|
to_chat(user, "<span class='warning'>You are already hacking!</span>")
|
|
return 0
|
|
if(!is_type_in_list(target, supported_types))
|
|
to_chat(user, "[bicon(src)] <span class='warning'>Unable to hack this target!</span>")
|
|
return 0
|
|
var/found = known_targets.Find(target)
|
|
if(found)
|
|
known_targets.Swap(1, found) // Move the last hacked item first
|
|
return 1
|
|
|
|
to_chat(user, "<span class='notice'>You begin hacking \the [target]...</span>")
|
|
is_hacking = 1
|
|
// On average hackin takes ~30 seconds. Fairly small random span to avoid people simply aborting and trying again
|
|
var/hack_result = do_after(user, (20 SECONDS + rand(0, 10 SECONDS) + rand(0, 10 SECONDS)))
|
|
is_hacking = 0
|
|
|
|
if(hack_result && in_hack_mode)
|
|
to_chat(user, "<span class='notice'>Your hacking attempt was succesful!</span>")
|
|
user.playsound_local(get_turf(src), 'sound/instruments/piano/An6.ogg', 50)
|
|
else
|
|
to_chat(user, "<span class='warning'>Your hacking attempt failed!</span>")
|
|
return 0
|
|
|
|
known_targets.Insert(1, target) // Insert the newly hacked target first,
|
|
target.register(OBSERVER_EVENT_DESTROY, src, /obj/item/device/multitool/hacktool/proc/on_target_destroy)
|
|
return 1
|
|
|
|
/obj/item/device/multitool/hacktool/proc/sanity_check()
|
|
if(max_known_targets < 1) max_known_targets = 1
|
|
// Cut away the oldest items if the capacity has been reached
|
|
if(known_targets.len > max_known_targets)
|
|
for(var/i = (max_known_targets + 1) to known_targets.len)
|
|
var/atom/A = known_targets[i]
|
|
A.unregister(OBSERVER_EVENT_DESTROY, src)
|
|
known_targets.Cut(max_known_targets + 1)
|
|
|
|
/obj/item/device/multitool/hacktool/proc/on_target_destroy(var/target)
|
|
known_targets -= target
|
|
|
|
/datum/topic_state/default/must_hack
|
|
var/obj/item/device/multitool/hacktool/hacktool
|
|
|
|
/datum/topic_state/default/must_hack/New(var/hacktool)
|
|
src.hacktool = hacktool
|
|
..()
|
|
|
|
/datum/topic_state/default/must_hack/Destroy()
|
|
hacktool = null
|
|
return ..()
|
|
|
|
/datum/topic_state/default/must_hack/can_use_topic(var/src_object, var/mob/user)
|
|
if(!hacktool || !hacktool.in_hack_mode || !(src_object in hacktool.known_targets))
|
|
return STATUS_CLOSE
|
|
return ..()
|