mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-25 06:00:16 +01:00
Ore vents now turn transparent and clickthrough when there's a mob behind them (#95646)
## About The Pull Request When a mob enters a tile above the vent its top half (and the rig, if the vent has been tapped) will turn transparent and clickthrough. The bottom half residing on the tile below is still clickable. https://github.com/user-attachments/assets/5ed1cd3a-4f33-4692-adce-471eb2942d45 Same applies to ore type overlays. Also I've cleaned up ore vent code a bit. ## Why It's Good For The Game During combat some mobs, especially legion skulls, can end up hiding behind the vent and be extremely hard to hit, requiring the player to pull up the alt click menu to dispatch of them. This should resolve that issue. ## Changelog 🆑 qol: Ore vents now turn transparent and clickthrough when a mob enters the tile above them. The bottom half of the vent is still clickable. code: Cleaned up ore vent code /🆑
This commit is contained in:
@@ -54,12 +54,21 @@
|
||||
/mob/living/basic/mining/brimdemon,
|
||||
/mob/living/basic/mining/bileworm,
|
||||
)
|
||||
///What items can be used to scan a vent?
|
||||
/// What items can be used to scan a vent?
|
||||
var/static/list/scanning_equipment = list(
|
||||
/obj/item/t_scanner/adv_mining_scanner,
|
||||
/obj/item/mining_scanner,
|
||||
)
|
||||
|
||||
/// Turf above us that we're currently tracking, stored in case of movement jank
|
||||
var/turf/tracked_turf = null
|
||||
/// Visual overlay for our vent tap
|
||||
var/obj/effect/abstract/vent_visual = null
|
||||
/// Underlay visual for when we turn transparent
|
||||
var/obj/effect/abstract/top_bit = null
|
||||
/// Are we currently hiding our top half because someone is above us?
|
||||
var/trimmed = FALSE
|
||||
|
||||
/// What base icon_state do we use for this vent's boulders?
|
||||
var/boulder_icon_state = "boulder"
|
||||
/// Percent chance that this vent will produce an artifact boulder.
|
||||
@@ -82,13 +91,13 @@
|
||||
))
|
||||
if(tapped)
|
||||
SSore_generation.processed_vents += src
|
||||
icon_state = icon_state_tapped
|
||||
update_appearance(UPDATE_ICON_STATE)
|
||||
add_overlay(mutable_appearance('icons/obj/mining_zones/terrain.dmi', "well", ABOVE_MOB_LAYER))
|
||||
add_tapped_visual()
|
||||
|
||||
RegisterSignal(src, COMSIG_SPAWNER_SPAWNED_DEFAULT, PROC_REF(anti_cheese))
|
||||
RegisterSignal(src, COMSIG_SPAWNER_SPAWNED, PROC_REF(log_mob_spawned))
|
||||
AddElement(/datum/element/give_turf_traits, string_list(list(TRAIT_NO_TERRAFORM)))
|
||||
set_turf_tracking()
|
||||
return ..()
|
||||
|
||||
/obj/structure/ore_vent/Destroy()
|
||||
@@ -286,7 +295,6 @@
|
||||
)
|
||||
COOLDOWN_START(src, wave_cooldown, wave_timer)
|
||||
addtimer(CALLBACK(src, PROC_REF(handle_wave_conclusion)), wave_timer)
|
||||
icon_state = icon_state_tapped
|
||||
update_appearance(UPDATE_ICON_STATE)
|
||||
|
||||
/**
|
||||
@@ -321,7 +329,6 @@
|
||||
*/
|
||||
/obj/structure/ore_vent/proc/initiate_wave_loss(loss_message)
|
||||
visible_message(span_danger(loss_message))
|
||||
icon_state = base_icon_state
|
||||
update_appearance(UPDATE_ICON_STATE)
|
||||
reset_drone(success = FALSE)
|
||||
|
||||
@@ -335,23 +342,113 @@
|
||||
log_game("Ore vent [key_name_and_tag(src)] was tapped")
|
||||
SSblackbox.record_feedback("tally", "ore_vent_completed", 1, type)
|
||||
balloon_alert_to_viewers("vent tapped!")
|
||||
icon_state = icon_state_tapped
|
||||
update_appearance(UPDATE_ICON_STATE)
|
||||
qdel(GetComponent(/datum/component/gps))
|
||||
|
||||
if(!forced)
|
||||
for(var/mob/living/miner in range(7, src)) //Give the miners who are near the vent points and xp.
|
||||
var/obj/item/card/id/user_id_card = miner.get_idcard(TRUE)
|
||||
if(miner.stat <= SOFT_CRIT)
|
||||
miner.mind?.adjust_experience(/datum/skill/mining, MINING_SKILL_BOULDER_SIZE_XP * boulder_size)
|
||||
if(!user_id_card)
|
||||
continue
|
||||
var/point_reward_val = (MINER_POINT_MULTIPLIER * boulder_size) - MINER_POINT_MULTIPLIER // We remove the base value of discovering the vent
|
||||
if(user_id_card.registered_account)
|
||||
user_id_card.registered_account.mining_points += point_reward_val
|
||||
user_id_card.registered_account.bank_card_talk("You have been awarded [point_reward_val] mining points for your efforts.")
|
||||
update_appearance(UPDATE_ICON_STATE)
|
||||
add_tapped_visual()
|
||||
qdel(GetComponent(/datum/component/gps))
|
||||
reset_drone(success = TRUE)
|
||||
add_overlay(mutable_appearance('icons/obj/mining_zones/terrain.dmi', "well", ABOVE_MOB_LAYER))
|
||||
|
||||
if(forced)
|
||||
return
|
||||
|
||||
for(var/mob/living/miner in range(7, src)) //Give the miners who are near the vent points and xp.
|
||||
var/obj/item/card/id/user_id_card = miner.get_idcard(TRUE)
|
||||
if(miner.stat <= SOFT_CRIT)
|
||||
miner.mind?.adjust_experience(/datum/skill/mining, MINING_SKILL_BOULDER_SIZE_XP * boulder_size)
|
||||
if(!user_id_card)
|
||||
continue
|
||||
var/point_reward_val = (MINER_POINT_MULTIPLIER * boulder_size) - MINER_POINT_MULTIPLIER // We remove the base value of discovering the vent
|
||||
if(user_id_card.registered_account)
|
||||
user_id_card.registered_account.mining_points += point_reward_val
|
||||
user_id_card.registered_account.bank_card_talk("You have been awarded [point_reward_val] mining points for your efforts.")
|
||||
|
||||
/obj/structure/ore_vent/proc/add_tapped_visual()
|
||||
if (vent_visual)
|
||||
vis_contents |= vent_visual
|
||||
return
|
||||
|
||||
vent_visual = new(src)
|
||||
vent_visual.icon = 'icons/obj/mining_zones/terrain.dmi'
|
||||
vent_visual.icon_state = "well"
|
||||
vent_visual.layer = ABOVE_MOB_LAYER
|
||||
vent_visual.vis_flags = VIS_INHERIT_PLANE | VIS_INHERIT_ID
|
||||
vis_contents += vent_visual
|
||||
|
||||
/obj/structure/ore_vent/update_icon_state()
|
||||
if (tapped)
|
||||
icon_state = "[base_icon_state]_active"
|
||||
else
|
||||
icon_state = base_icon_state
|
||||
if (trimmed)
|
||||
icon_state = "[icon_state]_trimmed"
|
||||
return ..()
|
||||
|
||||
/obj/structure/ore_vent/Moved(atom/old_loc, movement_dir, forced, list/old_locs, momentum_change)
|
||||
. = ..()
|
||||
set_turf_tracking()
|
||||
|
||||
/// Update the turf which we track for mobs entering/exiting
|
||||
/obj/structure/ore_vent/proc/set_turf_tracking()
|
||||
if (tracked_turf)
|
||||
UnregisterSignal(tracked_turf, list(COMSIG_ATOM_ENTERED, COMSIG_ATOM_EXITED))
|
||||
|
||||
tracked_turf = locate(x, y + 1, z)
|
||||
if (!isnull(tracked_turf))
|
||||
RegisterSignal(tracked_turf, COMSIG_ATOM_ENTERED, PROC_REF(on_entered))
|
||||
RegisterSignal(tracked_turf, COMSIG_ATOM_EXITED, PROC_REF(on_exited))
|
||||
|
||||
/obj/structure/ore_vent/proc/on_entered(atom/source, atom/movable/entered)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
if (!isliving(entered))
|
||||
return
|
||||
|
||||
if (!trimmed)
|
||||
trim_vent()
|
||||
|
||||
/obj/structure/ore_vent/proc/on_exited(atom/source, atom/movable/exited, direction)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
if (!isliving(exited) || !isnull(locate(/mob/living) in tracked_turf))
|
||||
return
|
||||
|
||||
if (trimmed)
|
||||
untrim_vent()
|
||||
|
||||
/// Turn the top part of the vent transparent and clickthrough
|
||||
/obj/structure/ore_vent/proc/trim_vent()
|
||||
trimmed = TRUE
|
||||
update_appearance(UPDATE_ICON_STATE)
|
||||
|
||||
if (vent_visual)
|
||||
vent_visual.vis_flags &= ~VIS_INHERIT_ID
|
||||
vent_visual.mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
||||
|
||||
if (!top_bit)
|
||||
top_bit = new(src)
|
||||
top_bit.icon = 'icons/obj/mining_zones/terrain.dmi'
|
||||
// Because its transparent we can't just underlay the full thing
|
||||
top_bit.icon_state = "[base_icon_state][tapped ? "_active" : ""]_trimmed_top"
|
||||
top_bit.layer = ABOVE_MOB_LAYER
|
||||
top_bit.vis_flags = VIS_INHERIT_PLANE | VIS_INHERIT_LAYER | VIS_UNDERLAY
|
||||
top_bit.mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
||||
|
||||
vis_contents |= top_bit
|
||||
animate(src, 0.5 SECONDS, alpha = 128)
|
||||
|
||||
/// Revert the transparency of the top half of the vent
|
||||
/obj/structure/ore_vent/proc/untrim_vent()
|
||||
trimmed = FALSE
|
||||
update_appearance(UPDATE_ICON_STATE)
|
||||
|
||||
if (vent_visual)
|
||||
vent_visual.mouse_opacity = MOUSE_OPACITY_ICON
|
||||
vent_visual.vis_flags |= VIS_INHERIT_ID
|
||||
|
||||
if (top_bit)
|
||||
vis_contents -= top_bit
|
||||
|
||||
animate(src, 0.5 SECONDS, alpha = 255)
|
||||
|
||||
/**
|
||||
* Sends our node back to base and cleans up after the reference
|
||||
@@ -420,12 +517,13 @@
|
||||
*/
|
||||
/obj/structure/ore_vent/proc/add_mineral_overlays()
|
||||
if(mineral_breakdown.len && !discovered)
|
||||
var/obj/effect/temp_visual/mining_overlay/vent/new_mat = new /obj/effect/temp_visual/mining_overlay/vent(drop_location())
|
||||
new_mat.icon_state = "unknown"
|
||||
var/atom/movable/flick_visual/visual = flick_overlay_view(mutable_appearance('icons/effects/vent_overlays.dmi', "unknown"), 4.5 SECONDS)
|
||||
animate(visual, alpha = 0, time = 4.5 SECONDS, easing = CIRCULAR_EASING|EASE_IN)
|
||||
return
|
||||
|
||||
for(var/datum/material/selected_mat as anything in mineral_breakdown)
|
||||
var/obj/effect/temp_visual/mining_overlay/vent/new_mat = new /obj/effect/temp_visual/mining_overlay/vent(drop_location())
|
||||
new_mat.icon_state = selected_mat.name
|
||||
var/atom/movable/flick_visual/visual = flick_overlay_view(mutable_appearance('icons/effects/vent_overlays.dmi', selected_mat.name), 4.5 SECONDS)
|
||||
animate(visual, alpha = 0, time = 4.5 SECONDS, easing = CIRCULAR_EASING|EASE_IN)
|
||||
|
||||
/**
|
||||
* Here is where we handle producing a new boulder, based on the qualities of this ore vent.
|
||||
@@ -562,7 +660,7 @@
|
||||
|
||||
/obj/structure/ore_vent/random/icebox //The one that shows up on the top level of icebox
|
||||
icon_state = "ore_vent_ice"
|
||||
icon_state_tapped = "ore_vent_ice_active"
|
||||
base_icon_state = "ore_vent_ice"
|
||||
defending_mobs = list(
|
||||
/mob/living/basic/mining/lobstrosity,
|
||||
/mob/living/basic/mining/legion/snow/spawner_made,
|
||||
@@ -653,7 +751,7 @@
|
||||
|
||||
/obj/structure/ore_vent/boss/icebox
|
||||
icon_state = "ore_vent_ice"
|
||||
icon_state_tapped = "ore_vent_ice_active"
|
||||
base_icon_state = "ore_vent_ice"
|
||||
defending_mobs = list(
|
||||
/mob/living/simple_animal/hostile/megafauna/demonic_frost_miner,
|
||||
/mob/living/simple_animal/hostile/megafauna/wendigo/noportal,
|
||||
|
||||
Reference in New Issue
Block a user