mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-24 13:38:41 +01:00
Durand shield now shows correctly on top of the mech. (#67437)
- Fixes the shield being on the wrong plane. - Fixes the shield undeploy animation being hidden due to invisibility being set too early. - Fixes the shield having the wrong glide_size and having its movement desync from the Durand. - Removes unused currentuser var.
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
|
||||
/obj/vehicle/sealed/mecha/combat/durand/Initialize(mapload)
|
||||
. = ..()
|
||||
shield = new /obj/durand_shield(loc, src, layer, dir)
|
||||
shield = new /obj/durand_shield(loc, src, plane, layer, dir)
|
||||
RegisterSignal(src, COMSIG_MECHA_ACTION_TRIGGER, .proc/relay)
|
||||
RegisterSignal(src, COMSIG_PROJECTILE_PREHIT, .proc/prehit)
|
||||
|
||||
@@ -158,28 +158,34 @@ own integrity back to max. Shield is automatically dropped if we run out of powe
|
||||
light_power = 5
|
||||
light_color = LIGHT_COLOR_ELECTRIC_CYAN
|
||||
light_on = FALSE
|
||||
resistance_flags = LAVA_PROOF | FIRE_PROOF | ACID_PROOF //The shield should not take damage from fire, lava, or acid; that's the mech's job.
|
||||
///Our link back to the durand
|
||||
var/obj/vehicle/sealed/mecha/combat/durand/chassis
|
||||
///To keep track of things during the animation
|
||||
var/switching = FALSE
|
||||
var/currentuser
|
||||
resistance_flags = LAVA_PROOF | FIRE_PROOF | ACID_PROOF //The shield should not take damage from fire, lava, or acid; that's the mech's job.
|
||||
|
||||
|
||||
/obj/durand_shield/Initialize(mapload, _chassis, _layer, _dir)
|
||||
/obj/durand_shield/Initialize(mapload, chassis, plane, layer, dir)
|
||||
. = ..()
|
||||
chassis = _chassis
|
||||
layer = _layer
|
||||
setDir(_dir)
|
||||
src.chassis = chassis
|
||||
src.layer = layer
|
||||
src.plane = plane
|
||||
setDir(dir)
|
||||
RegisterSignal(src, COMSIG_MECHA_ACTION_TRIGGER, .proc/activate)
|
||||
RegisterSignal(chassis, COMSIG_MOVABLE_UPDATE_GLIDE_SIZE, .proc/shield_glide_size_update)
|
||||
|
||||
|
||||
/obj/durand_shield/Destroy()
|
||||
UnregisterSignal(src, COMSIG_MECHA_ACTION_TRIGGER)
|
||||
if(chassis)
|
||||
UnregisterSignal(chassis, COMSIG_MOVABLE_UPDATE_GLIDE_SIZE)
|
||||
chassis.shield = null
|
||||
chassis = null
|
||||
return ..()
|
||||
|
||||
/obj/durand_shield/proc/shield_glide_size_update(datum/source, target)
|
||||
SIGNAL_HANDLER
|
||||
glide_size = target
|
||||
|
||||
/**
|
||||
* Handles activating and deactivating the shield.
|
||||
*
|
||||
@@ -195,7 +201,6 @@ own integrity back to max. Shield is automatically dropped if we run out of powe
|
||||
*/
|
||||
/obj/durand_shield/proc/activate(datum/source, mob/owner, list/signal_args)
|
||||
SIGNAL_HANDLER
|
||||
currentuser = owner
|
||||
if(!LAZYLEN(chassis?.occupants))
|
||||
return
|
||||
if(switching && !signal_args[1])
|
||||
@@ -229,10 +234,21 @@ own integrity back to max. Shield is automatically dropped if we run out of powe
|
||||
playsound(src, 'sound/mecha/mech_shield_drop.ogg', 50, FALSE)
|
||||
set_light(0)
|
||||
icon_state = "shield_null"
|
||||
invisibility = INVISIBILITY_MAXIMUM //no showing on right-click
|
||||
addtimer(CALLBACK(src, .proc/make_invisible), 1 SECONDS, TIMER_UNIQUE|TIMER_OVERRIDE)
|
||||
UnregisterSignal(chassis, COMSIG_ATOM_DIR_CHANGE)
|
||||
switching = FALSE
|
||||
|
||||
/**
|
||||
* Sets invisibility to INVISIBILITY_MAXIMUM if defense mode is disabled
|
||||
*
|
||||
* We need invisibility set to higher than 25 for the shield to not appear
|
||||
* in the right-click context menu, but if we do it too early, we miss the
|
||||
* deactivate animation. Hense, timer and this proc.
|
||||
*/
|
||||
/obj/durand_shield/proc/make_invisible()
|
||||
if(!chassis.defense_mode)
|
||||
invisibility = INVISIBILITY_MAXIMUM
|
||||
|
||||
/obj/durand_shield/proc/resetdir(datum/source, olddir, newdir)
|
||||
SIGNAL_HANDLER
|
||||
setDir(newdir)
|
||||
|
||||
Reference in New Issue
Block a user