mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 03:27:05 +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:
@@ -97,6 +97,7 @@
|
||||
|
||||
if(!QDELETED(clicker))
|
||||
UnregisterSignal(clicker, list(COMSIG_CLIENT_MOUSEDOWN, COMSIG_CLIENT_MOUSEUP, COMSIG_CLIENT_MOUSEDRAG))
|
||||
clicker.mob.remove_mousepointer(MP_AUTO_GUN_PRIORITY)
|
||||
mouse_status = AUTOFIRE_MOUSEUP // In regards to the component there's no click anymore to care about.
|
||||
clicker = null
|
||||
if(!QDELETED(shooter))
|
||||
@@ -164,8 +165,7 @@
|
||||
return
|
||||
autofire_stat = AUTOFIRE_STAT_FIRING
|
||||
|
||||
clicker.mouse_override_icon = 'icons/effects/mouse_pointers/weapon_pointer.dmi'
|
||||
clicker.mouse_pointer_icon = clicker.mouse_override_icon
|
||||
clicker.mob.add_mousepointer(MP_AUTO_GUN_PRIORITY, 'icons/mouse_icons/weapon_pointer.dmi')
|
||||
|
||||
if(mouse_status == AUTOFIRE_MOUSEUP) // See mouse_status definition for the reason for this.
|
||||
RegisterSignal(clicker, COMSIG_CLIENT_MOUSEUP, PROC_REF(on_mouse_up))
|
||||
@@ -206,8 +206,7 @@
|
||||
STOP_PROCESSING(SSprojectiles, src)
|
||||
autofire_stat = AUTOFIRE_STAT_ALERT
|
||||
if(clicker)
|
||||
clicker.mouse_override_icon = null
|
||||
clicker.mouse_pointer_icon = clicker.mouse_override_icon
|
||||
clicker.mob.remove_mousepointer(MP_AUTO_GUN_PRIORITY)
|
||||
UnregisterSignal(clicker, COMSIG_CLIENT_MOUSEDRAG)
|
||||
if(!QDELETED(shooter))
|
||||
UnregisterSignal(shooter, COMSIG_MOB_SWAPPED_HANDS)
|
||||
|
||||
@@ -136,7 +136,7 @@ GLOBAL_LIST_INIT(spells, typesof(/datum/spell))
|
||||
user.ranged_ability = src
|
||||
ranged_ability_user = user
|
||||
user.client.click_intercept = new /datum/click_intercept/proc_holder(user.client, user.ranged_ability)
|
||||
add_mousepointer(user.client)
|
||||
add_mousepointer(user)
|
||||
active = TRUE
|
||||
if(msg)
|
||||
to_chat(user, msg)
|
||||
@@ -145,13 +145,13 @@ GLOBAL_LIST_INIT(spells, typesof(/datum/spell))
|
||||
/datum/spell/proc/update_spell_icon()
|
||||
return
|
||||
|
||||
/datum/spell/proc/add_mousepointer(client/C)
|
||||
if(C && ranged_mousepointer && C.mouse_pointer_icon == initial(C.mouse_pointer_icon))
|
||||
C.mouse_pointer_icon = ranged_mousepointer
|
||||
/datum/spell/proc/add_mousepointer(mob/user)
|
||||
if(ranged_mousepointer)
|
||||
user.add_mousepointer(MP_SPELL_PRIORITY, ranged_mousepointer)
|
||||
|
||||
/datum/spell/proc/remove_mousepointer(client/C)
|
||||
if(C && ranged_mousepointer && C.mouse_pointer_icon == ranged_mousepointer)
|
||||
C.mouse_pointer_icon = initial(C.mouse_pointer_icon)
|
||||
/datum/spell/proc/remove_mousepointer(mob/user)
|
||||
if(ranged_mousepointer)
|
||||
user.remove_mousepointer(MP_SPELL_PRIORITY)
|
||||
|
||||
/datum/spell/proc/remove_ranged_ability(mob/user, msg)
|
||||
if(!user || (user.ranged_ability && user.ranged_ability != src)) //To avoid removing the wrong ability
|
||||
@@ -162,7 +162,7 @@ GLOBAL_LIST_INIT(spells, typesof(/datum/spell))
|
||||
if(user.client)
|
||||
qdel(user.client.click_intercept)
|
||||
user.client.click_intercept = null
|
||||
remove_mousepointer(user.client)
|
||||
remove_mousepointer(user)
|
||||
if(msg)
|
||||
to_chat(user, msg)
|
||||
update_spell_icon()
|
||||
|
||||
Reference in New Issue
Block a user