mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-20 03:25:49 +01:00
Refactors Mousepointers + Code improvements (#29960)
* blah * tweaks * refactor * awesome * put everything in mouse_icons folder * make spells work * update twin * tweak * woop woop * remove dynamic mousepointers * bam
This commit is contained in:
@@ -233,6 +233,8 @@
|
||||
return
|
||||
hand = !hand
|
||||
update_hands_hud()
|
||||
r_hand?.on_hands_swap(src, hand == HAND_BOOL_RIGHT)
|
||||
l_hand?.on_hands_swap(src, hand == HAND_BOOL_LEFT)
|
||||
SEND_SIGNAL(src, COMSIG_CARBON_SWAP_HANDS)
|
||||
|
||||
|
||||
@@ -706,24 +708,18 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, list(/obj/machinery/atmospherics/unary/ven
|
||||
if(I)
|
||||
SEND_SIGNAL(I, COMSIG_CARBON_TOGGLE_THROW, in_throw_mode)
|
||||
|
||||
#define THROW_MODE_ICON 'icons/effects/cult_target.dmi'
|
||||
|
||||
/mob/living/carbon/proc/throw_mode_off()
|
||||
in_throw_mode = FALSE
|
||||
if(throw_icon) //in case we don't have the HUD and we use the hotkey
|
||||
throw_icon.icon_state = "act_throw_off"
|
||||
if(client?.mouse_pointer_icon == THROW_MODE_ICON)
|
||||
client.mouse_pointer_icon = initial(client.mouse_pointer_icon)
|
||||
remove_mousepointer(MP_THROW_MODE_PRIORITY)
|
||||
|
||||
/mob/living/carbon/proc/throw_mode_on()
|
||||
SIGNAL_HANDLER //This signal is here so we can turn throw mode back on via carp when an object is caught
|
||||
in_throw_mode = TRUE
|
||||
if(throw_icon)
|
||||
throw_icon.icon_state = "act_throw_on"
|
||||
if(client?.mouse_pointer_icon == initial(client.mouse_pointer_icon))
|
||||
client.mouse_pointer_icon = THROW_MODE_ICON
|
||||
|
||||
#undef THROW_MODE_ICON
|
||||
add_mousepointer(MP_THROW_MODE_PRIORITY, 'icons/mouse_icons/cult_target.dmi')
|
||||
|
||||
/mob/proc/throw_item(atom/target)
|
||||
return
|
||||
|
||||
@@ -70,14 +70,14 @@
|
||||
|
||||
/datum/click_intercept/give/New(client/C)
|
||||
..()
|
||||
holder.mouse_pointer_icon = 'icons/mouse_icons/give_item.dmi'
|
||||
holder.mob.add_mousepointer(MP_GIVE_MODE_PRIORITY, 'icons/mouse_icons/give_item.dmi')
|
||||
to_chat(holder, "<span class='notice'>You can now left click on someone to give them your held item.</span>")
|
||||
RegisterSignal(holder.mob.get_active_hand(), list(COMSIG_PARENT_QDELETING, COMSIG_ITEM_EQUIPPED, COMSIG_ITEM_DROPPED), PROC_REF(signal_qdel))
|
||||
RegisterSignal(holder.mob, list(SIGNAL_ADDTRAIT(TRAIT_HANDS_BLOCKED), COMSIG_CARBON_SWAP_HANDS), PROC_REF(signal_qdel))
|
||||
|
||||
|
||||
/datum/click_intercept/give/Destroy(force = FALSE, ...)
|
||||
holder.mouse_pointer_icon = initial(holder.mouse_pointer_icon)
|
||||
holder.mob.remove_mousepointer(MP_GIVE_MODE_PRIORITY)
|
||||
if(!item_offered)
|
||||
to_chat(holder.mob, "<span class='notice'>You're no longer trying to give someone your held item.</span>")
|
||||
return ..()
|
||||
|
||||
@@ -62,11 +62,7 @@
|
||||
return ..()
|
||||
|
||||
/mob/living/ghostize(can_reenter_corpse = 1)
|
||||
var/prev_client = client
|
||||
. = ..()
|
||||
if(.)
|
||||
if(ranged_ability && prev_client)
|
||||
ranged_ability.remove_mousepointer(prev_client)
|
||||
SEND_SIGNAL(src, COMSIG_LIVING_GHOSTIZED)
|
||||
|
||||
/// Legacy method for simplemobs to handle turning off their AI.
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/mob/living/Logout()
|
||||
update_z(null)
|
||||
if(ranged_ability && client)
|
||||
ranged_ability.remove_mousepointer(client)
|
||||
if(isobj(loc))
|
||||
var/obj/our_location = loc
|
||||
if(length(our_location.client_mobs_in_contents))
|
||||
|
||||
@@ -295,7 +295,7 @@
|
||||
desc = "Changes the color of a selected light."
|
||||
action_icon = 'icons/effects/random_spawners.dmi'
|
||||
action_icon_state = "glowstick"
|
||||
ranged_mousepointer = 'icons/mecha/mecha_mouse.dmi'
|
||||
ranged_mousepointer = 'icons/mouse_icons/mecha_mouse.dmi'
|
||||
base_cooldown = 30 SECONDS
|
||||
cooldown_min = 5 SECONDS
|
||||
level_max = 5
|
||||
@@ -367,7 +367,7 @@
|
||||
desc = "Recharge an APC, Borg, or Mech with power directly from your SMES."
|
||||
action_icon = 'icons/obj/power.dmi'
|
||||
action_icon_state = "smes-o"
|
||||
ranged_mousepointer = 'icons/mecha/mecha_mouse.dmi'
|
||||
ranged_mousepointer = 'icons/mouse_icons/mecha_mouse.dmi'
|
||||
base_cooldown = 120 SECONDS
|
||||
cooldown_min = 30 SECONDS
|
||||
level_max = 7
|
||||
@@ -448,7 +448,7 @@
|
||||
desc = "Repair an APC, Borg, or Mech with large numbers of robotic nanomachines!"
|
||||
action_icon = 'icons/obj/surgery.dmi'
|
||||
action_icon_state = "tube"
|
||||
ranged_mousepointer = 'icons/mecha/mecha_mouse.dmi'
|
||||
ranged_mousepointer = 'icons/mouse_icons/mecha_mouse.dmi'
|
||||
base_cooldown = 150 SECONDS
|
||||
cooldown_min = 30 SECONDS
|
||||
level_max = 7
|
||||
@@ -550,7 +550,7 @@
|
||||
desc = "Repair the wires in an airlock that still has an intact AI control wire."
|
||||
action_icon = 'icons/obj/doors/doorint.dmi'
|
||||
action_icon_state = "door_closed"
|
||||
ranged_mousepointer = 'icons/mecha/mecha_mouse.dmi'
|
||||
ranged_mousepointer = 'icons/mouse_icons/mecha_mouse.dmi'
|
||||
base_cooldown = 60 SECONDS
|
||||
cooldown_min = 60 SECONDS
|
||||
level_max = 5
|
||||
@@ -615,7 +615,7 @@
|
||||
desc = "Deploy a nanofrost globule to a target to rapidly extinguish plasmafires."
|
||||
action_icon = 'icons/effects/effects.dmi'
|
||||
action_icon_state = "frozen_smoke_capsule"
|
||||
ranged_mousepointer = 'icons/mecha/mecha_mouse.dmi'
|
||||
ranged_mousepointer = 'icons/mouse_icons/mecha_mouse.dmi'
|
||||
base_cooldown = 60 SECONDS
|
||||
cooldown_min = 30 SECONDS
|
||||
level_max = 3
|
||||
@@ -731,7 +731,7 @@
|
||||
desc = "Replace damaged or missing lightbulbs."
|
||||
action_icon = 'icons/obj/janitor.dmi'
|
||||
action_icon_state = "lightreplacer0"
|
||||
ranged_mousepointer = 'icons/mecha/mecha_mouse.dmi'
|
||||
ranged_mousepointer = 'icons/mouse_icons/mecha_mouse.dmi'
|
||||
base_cooldown = 30 SECONDS
|
||||
cooldown_min = 5 SECONDS
|
||||
level_max = 5
|
||||
@@ -788,7 +788,7 @@
|
||||
desc = "Heal a crew member with large numbers of robotic nanomachines!"
|
||||
action_icon = 'icons/obj/surgery.dmi'
|
||||
action_icon_state = "scalpel_laser1_on"
|
||||
ranged_mousepointer = 'icons/mecha/mecha_mouse.dmi'
|
||||
ranged_mousepointer = 'icons/mouse_icons/mecha_mouse.dmi'
|
||||
base_cooldown = 150 SECONDS
|
||||
cooldown_min = 30 SECONDS
|
||||
level_max = 10
|
||||
@@ -930,7 +930,7 @@
|
||||
desc = "Deploy an area of metal foam to rapidly repair and seal hull breaches."
|
||||
action_icon = 'icons/obj/structures.dmi'
|
||||
action_icon_state = "reinforced"
|
||||
ranged_mousepointer = 'icons/mecha/mecha_mouse.dmi'
|
||||
ranged_mousepointer = 'icons/mouse_icons/mecha_mouse.dmi'
|
||||
base_cooldown = 180 SECONDS
|
||||
cooldown_min = 30 SECONDS
|
||||
level_max = 5
|
||||
@@ -983,7 +983,7 @@
|
||||
desc = "Deploy a holographic sign to alert crewmembers to potential hazards."
|
||||
action_icon = 'icons/obj/device.dmi'
|
||||
action_icon_state = "signmaker"
|
||||
ranged_mousepointer = 'icons/mecha/mecha_mouse.dmi'
|
||||
ranged_mousepointer = 'icons/mouse_icons/mecha_mouse.dmi'
|
||||
base_cooldown = 30 SECONDS
|
||||
cooldown_min = 30 SECONDS
|
||||
level_max = 8
|
||||
@@ -1052,7 +1052,7 @@
|
||||
desc = "Download a program from Clowns.NT to be able to play bike horn sounds on demand."
|
||||
action_icon = 'icons/obj/items.dmi'
|
||||
action_icon_state = "bike_horn"
|
||||
ranged_mousepointer = 'icons/mecha/mecha_mouse.dmi'
|
||||
ranged_mousepointer = 'icons/mouse_icons/mecha_mouse.dmi'
|
||||
base_cooldown = 30 SECONDS
|
||||
cooldown_min = 15 SECONDS
|
||||
level_max = 10
|
||||
@@ -1170,7 +1170,7 @@
|
||||
desc = "Illuminate a hologram to notify or beckon crew."
|
||||
action_icon = 'icons/mob/telegraphing/telegraph_holographic.dmi'
|
||||
action_icon_state = "target_circle"
|
||||
ranged_mousepointer = 'icons/mecha/mecha_mouse.dmi'
|
||||
ranged_mousepointer = 'icons/mouse_icons/mecha_mouse.dmi'
|
||||
base_cooldown = 15 SECONDS
|
||||
cooldown_min = 15 SECONDS
|
||||
level_max = 1
|
||||
|
||||
@@ -153,7 +153,6 @@
|
||||
else
|
||||
inventory.deactivate()
|
||||
update_icons()
|
||||
return
|
||||
|
||||
//deselect_module(module) - Deselects the module slot specified by "module"
|
||||
/mob/living/silicon/robot/proc/deselect_module(module) //Module is 1-3
|
||||
@@ -164,7 +163,6 @@
|
||||
var/atom/movable/screen/robot/active_module/inventory = inventory_screens[i]
|
||||
inventory.deactivate()
|
||||
update_icons()
|
||||
return
|
||||
|
||||
//toggle_module(module) - Toggles the selection of the module slot specified by "module".
|
||||
/mob/living/silicon/robot/proc/toggle_module(module) //Module is 1-3
|
||||
|
||||
@@ -27,7 +27,7 @@ GLOBAL_LIST_INIT(robot_verbs_default, list(
|
||||
/// A reference to the type of cyborg it is, i.e. Engineering, Security, Medical etc.
|
||||
var/obj/item/robot_module/module = null
|
||||
/// The item the borg currently has selected, or null if nothing is selected
|
||||
var/selected_item
|
||||
var/obj/item/selected_item
|
||||
/// The list of up to 3 items the borg can have "equipped". The contents will either be CYBORG_EMPTY_MODULE for nothing, or the item selected
|
||||
var/list/all_active_items = list(CYBORG_EMPTY_MODULE, CYBORG_EMPTY_MODULE, CYBORG_EMPTY_MODULE)
|
||||
|
||||
|
||||
@@ -1625,3 +1625,24 @@ GLOBAL_LIST_INIT(holy_areas, typecacheof(list(
|
||||
. = STATUS_UPDATE_HEALTH
|
||||
if(updating_health)
|
||||
updatehealth()
|
||||
|
||||
/mob/proc/add_mousepointer(priority = INFINITY, new_icon)
|
||||
mousepointers["[priority]"] = new_icon
|
||||
update_mousepointer()
|
||||
|
||||
/mob/proc/remove_mousepointer(priority)
|
||||
mousepointers -= "[priority]"
|
||||
update_mousepointer()
|
||||
|
||||
/mob/proc/update_mousepointer()
|
||||
if(!client)
|
||||
return
|
||||
var/lowest_prio = INFINITY
|
||||
for(var/prio in mousepointers)
|
||||
prio = text2num(prio)
|
||||
if(prio < lowest_prio)
|
||||
lowest_prio = prio
|
||||
if(lowest_prio == INFINITY)
|
||||
client.mouse_pointer_icon = null
|
||||
return
|
||||
client.mouse_pointer_icon = mousepointers["[lowest_prio]"]
|
||||
|
||||
@@ -85,3 +85,5 @@
|
||||
client.init_verbs()
|
||||
SEND_SIGNAL(src, COMSIG_MOB_LOGIN)
|
||||
SEND_SIGNAL(src, COMSIG_MOB_CLIENT_LOGIN, client)
|
||||
|
||||
update_mousepointer()
|
||||
|
||||
@@ -259,3 +259,5 @@
|
||||
/// For storing what do_after's something has, key = string, value = amount of interactions of that type happening.
|
||||
var/list/do_afters
|
||||
new_attack_chain = TRUE
|
||||
|
||||
var/list/mousepointers = list()
|
||||
|
||||
Reference in New Issue
Block a user