mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 03:27:05 +01:00
Reworks the lwap to make it better. (#20884)
* Boss you killed a child... AMAZING MISSION COMPL- * small patch fix other stuff later * More fixes to clicking on the dot * lwap scopes better / decativates on movement * Apply suggestions from code review Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com> * requested changes * lower speed by marms suggestion * scope keeps creeping * Apply suggestions from code review Co-authored-by: Farie82 <farie82@users.noreply.github.com> * henks changes * define --------- Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com> Co-authored-by: Farie82 <farie82@users.noreply.github.com>
This commit is contained in:
co-authored by
Ryan
Farie82
parent
5e8e9c6df4
commit
d5567103fd
@@ -143,3 +143,78 @@
|
||||
/datum/status_effect/charging
|
||||
id = "charging"
|
||||
alert_type = null
|
||||
|
||||
#define LWAP_LOCK_CAP 10
|
||||
|
||||
/datum/status_effect/lwap_scope
|
||||
id = "lwap_scope"
|
||||
alert_type = null
|
||||
duration = -1
|
||||
tick_interval = 4
|
||||
/// The number of people the gun has locked on to. Caps at 10 for sanity.
|
||||
var/locks = 0
|
||||
/// What direction the owner was in when using the scope.
|
||||
var/owner_dir = 0
|
||||
|
||||
/datum/status_effect/lwap_scope/on_creation(mob/living/new_owner, stored_dir = 0)
|
||||
owner_dir = stored_dir
|
||||
return ..()
|
||||
|
||||
/datum/status_effect/lwap_scope/tick()
|
||||
locks = 0
|
||||
var/turf/owner_turf = get_turf(owner)
|
||||
var/scope_turf
|
||||
for(var/turf/T in RANGE_EDGE_TURFS(7, owner_turf))
|
||||
if(get_dir(owner, T) != owner_dir)
|
||||
continue
|
||||
if(T in range(owner, 6))
|
||||
continue
|
||||
scope_turf = T
|
||||
break
|
||||
if(scope_turf)
|
||||
for(var/mob/living/L in range(10, scope_turf))
|
||||
if(locks >= LWAP_LOCK_CAP)
|
||||
return
|
||||
if(L == owner || L.stat == DEAD || isslime(L) || ismonkeybasic(L)) //xenobio moment
|
||||
continue
|
||||
new /obj/effect/temp_visual/lwap_ping(owner.loc, owner, L)
|
||||
locks++
|
||||
|
||||
#undef LWAP_LOCK_CAP
|
||||
|
||||
/obj/effect/temp_visual/lwap_ping
|
||||
duration = 0.5 SECONDS
|
||||
randomdir = FALSE
|
||||
icon = 'icons/obj/projectiles.dmi'
|
||||
/// The image shown to lwap users
|
||||
var/image/lwap_image
|
||||
/// The person with the lwap at the moment, really just used to remove this from their screen
|
||||
var/source_UID
|
||||
/// The icon state applied to the image created for this ping.
|
||||
var/real_icon_state = "red_laser"
|
||||
|
||||
/obj/effect/temp_visual/lwap_ping/Initialize(mapload, mob/living/looker, mob/living/creature)
|
||||
. = ..()
|
||||
if(!looker || !creature)
|
||||
return INITIALIZE_HINT_QDEL
|
||||
lwap_image = image(icon = icon, loc = src, icon_state = real_icon_state, layer = ABOVE_ALL_MOB_LAYER, pixel_x = ((creature.x - looker.x) * 32), pixel_y = ((creature.y - looker.y) * 32))
|
||||
lwap_image.plane = ABOVE_LIGHTING_PLANE
|
||||
lwap_image.mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
||||
source_UID = looker.UID()
|
||||
add_mind(looker)
|
||||
|
||||
/obj/effect/temp_visual/lwap_ping/Destroy()
|
||||
var/mob/living/previous_user = locateUID(source_UID)
|
||||
if(previous_user)
|
||||
remove_mind(previous_user)
|
||||
// Null so we don't shit the bed when we delete
|
||||
lwap_image = null
|
||||
return ..()
|
||||
|
||||
/// Add the image to the lwap user's screen
|
||||
/obj/effect/temp_visual/lwap_ping/proc/add_mind(mob/living/looker)
|
||||
looker.client?.images |= lwap_image
|
||||
|
||||
/// Remove the image from the lwap user's screen
|
||||
/obj/effect/temp_visual/lwap_ping/proc/remove_mind(mob/living/looker)
|
||||
looker.client?.images -= lwap_image
|
||||
|
||||
Reference in New Issue
Block a user