Skip to content

Commit

Permalink
fixes ore vents being tapped despite their drones dying (#87359)
Browse files Browse the repository at this point in the history
## About The Pull Request
the vent defense minigames had a 100% win rate because of a small
mistake in the order of args passed to the proc

## Why It's Good For The Game
closes #87284

## Changelog
:cl:
fix: fixes ore vents being tapped despite their drones dying
/:cl:
  • Loading branch information
Ben10Omintrix authored and Majkl-J committed Nov 2, 2024
1 parent 158670c commit f7f0374
Showing 1 changed file with 38 additions and 18 deletions.
56 changes: 38 additions & 18 deletions code/game/objects/structures/lavaland/ore_vent.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
desc = "An ore vent, brimming with underground ore. Scan with an advanced mining scanner to start extracting ore from it."
icon = 'icons/obj/mining_zones/terrain.dmi'
icon_state = "ore_vent"
base_icon_state = "ore_vent"
move_resist = MOVE_FORCE_EXTREMELY_STRONG
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF //This thing will take a beating.
anchored = TRUE
Expand Down Expand Up @@ -91,7 +92,7 @@

/obj/structure/ore_vent/Destroy()
SSore_generation.possible_vents -= src
node = null
reset_drone(success = FALSE)
if(tapped)
SSore_generation.processed_vents -= src
return ..()
Expand Down Expand Up @@ -266,28 +267,40 @@
* Arguments:
* - force: Set to true if you want to just skip all checks and make the vent start producing boulders.
*/
/obj/structure/ore_vent/proc/handle_wave_conclusion(force = FALSE)
/obj/structure/ore_vent/proc/handle_wave_conclusion(datum/source, force = FALSE)
SIGNAL_HANDLER

SEND_SIGNAL(src, COMSIG_VENT_WAVE_CONCLUDED)
COOLDOWN_RESET(src, wave_cooldown)
particles = null

if(QDELETED(node) && !force)
visible_message(span_danger("\the [src] creaks and groans as the mining attempt fails, and the vent closes back up."))
icon_state = initial(icon_state)
update_appearance(UPDATE_ICON_STATE)
node = null
return //Bad end, try again.
else if(!QDELETED(node) && get_turf(node) != get_turf(src) && !force)
visible_message(span_danger("The [node] detaches from the [src], and the vent closes back up!"))
icon_state = initial(icon_state)
update_appearance(UPDATE_ICON_STATE)
UnregisterSignal(node, COMSIG_MOVABLE_MOVED)
node.pre_escape(success = FALSE)
node = null
if(force)
initiate_wave_win()
return

if(QDELETED(node))
initiate_wave_loss(loss_message = "\the [src] creaks and groans as the mining attempt fails, and the vent closes back up.")
return

if(get_turf(node) != get_turf(src))
initiate_wave_loss(loss_message = "The [node] detaches from the [src], and the vent closes back up!")
return //Start over!

initiate_wave_win()

/**
* Handles reseting our ore vent to its original state so we can start over
*/
/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)

/**
* Handles winning the event, gives everyone a payout and start boulder production
*/
/obj/structure/ore_vent/proc/initiate_wave_win()
tapped = TRUE //The Node Drone has survived the wave defense, and the ore vent is tapped.
SSore_generation.processed_vents += src
log_game("Ore vent [key_name_and_tag(src)] was tapped")
Expand All @@ -296,7 +309,6 @@
icon_state = icon_state_tapped
update_appearance(UPDATE_ICON_STATE)
qdel(GetComponent(/datum/component/gps))
UnregisterSignal(node, COMSIG_QDELETING)

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)
Expand All @@ -308,10 +320,18 @@
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.")
node?.pre_escape() //Visually show the drone is done and flies away.
node = null
reset_drone(success = TRUE)
add_overlay(mutable_appearance('icons/obj/mining_zones/terrain.dmi', "well", ABOVE_MOB_LAYER))

/**
* Sends our node back to base and cleans up after the reference
*/
/obj/structure/ore_vent/proc/reset_drone(success)
if(!QDELETED(node))
node.pre_escape(success = success)
UnregisterSignal(node, list(COMSIG_QDELETING, COMSIG_MOVABLE_MOVED))
node = null

/**
* Called when the ore vent is tapped by a scanning device.
* Gives a readout of the ores available in the vent that gets added to the description,
Expand Down

0 comments on commit f7f0374

Please sign in to comment.