Skip to content

Commit

Permalink
Adds an ability to hivemind that lets it select a location to telepor…
Browse files Browse the repository at this point in the history
…t to on minimap (#13507)
  • Loading branch information
ivanmixo authored Jul 19, 2023
1 parent 281c7fd commit 97055bf
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 4 deletions.
1 change: 1 addition & 0 deletions code/__DEFINES/dcs/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@

#define COMSIG_XENOMORPH_CORE_RETURN "xenomorph_core_return"
#define COMSIG_XENOMORPH_HIVEMIND_CHANGE_FORM "xenomorph_hivemind_change_form"
#define COMISG_XENOMORPH_HIVEMIND_TELEPORT "xeno_hivemind_teleport"

#define COMSIG_XENO_OBJ_THROW_HIT "xeno_obj_throw_hit" ///from [/mob/living/carbon/xenomorph/throw_impact]: (obj/target, speed)
#define COMSIG_XENO_LIVING_THROW_HIT "xeno_living_throw_hit" ///from [/mob/living/carbon/xenomorph/throw_impact]: (mob/living/target)
Expand Down
9 changes: 8 additions & 1 deletion code/datums/keybinding/xeno.dm
Original file line number Diff line number Diff line change
Expand Up @@ -466,10 +466,17 @@
/datum/keybinding/xeno/change_form
name = "change_form"
full_name = "Hivemind: Change Form"
description = ""
description = "Change form to/from incorporeal."
keybind_signal = COMSIG_XENOMORPH_HIVEMIND_CHANGE_FORM
hotkey_keys = list("F")

/datum/keybinding/xeno/change_form
name = "change_form"
full_name = "Hivemind: Open teleportation minimap"
description = "Opens up the minimap which, when you click somewhere, tries to teleport you to the selected location"
keybind_signal = COMISG_XENOMORPH_HIVEMIND_TELEPORT
hotkey_keys = list("C")

/datum/keybinding/xeno/toggle_stealth
name = "toggle_stealth"
full_name = "Hunter: Toggle Stealth"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

/datum/action/xeno_action/return_to_core/action_activate()
SEND_SIGNAL(owner, COMSIG_XENOMORPH_CORE_RETURN)
return ..()

/datum/action/xeno_action/activable/secrete_resin/hivemind/can_use_action(silent = FALSE, override_flags, selecting = FALSE)
if (owner.status_flags & INCORPOREAL)
Expand Down Expand Up @@ -87,3 +88,48 @@
var/mob/living/carbon/xenomorph/hivemind/hivemind = source
hivemind.jump(selected_xeno)

/datum/action/xeno_action/teleport
name = "Teleport"
action_icon_state = "resync"
desc = "Pick a location on the map and instantly manifest there if possible."
keybinding_signals = list(
KEYBINDING_NORMAL = COMISG_XENOMORPH_HIVEMIND_TELEPORT,
)
use_state_flags = XACT_USE_CLOSEDTURF
///Is the map being shown to the player right now?
var/showing_map = FALSE

/datum/action/xeno_action/teleport/action_activate()
var/atom/movable/screen/minimap/shown_map = SSminimaps.fetch_minimap_object(owner.z, MINIMAP_FLAG_XENO)

if(showing_map) // The map is open on their screen, close it
owner.client?.screen -= shown_map
shown_map.UnregisterSignal(owner, COMSIG_MOB_CLICKON)
showing_map = FALSE
return

owner.client?.screen += shown_map
showing_map = TRUE
var/list/polled_coords = shown_map.get_coords_from_click(owner)

if(!polled_coords)
owner.client?.screen -= shown_map
shown_map.UnregisterSignal(owner, COMSIG_MOB_CLICKON)
showing_map = FALSE
return

owner.client?.screen -= shown_map
showing_map = FALSE
var/turf/turf_to_teleport_to = locate(polled_coords[1], polled_coords[2], owner.z)

if(!turf_to_teleport_to)
return

var/mob/living/carbon/xenomorph/hivemind/hivemind_owner = owner
if(!hivemind_owner.check_weeds(turf_to_teleport_to, TRUE))
owner.balloon_alert(owner, "No weeds in selected location")
return
if(!(hivemind_owner.status_flags & INCORPOREAL))
hivemind_owner.start_teleport(turf_to_teleport_to)
return
hivemind_owner.abstract_move(turf_to_teleport_to)
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
/datum/action/xeno_action/watch_xeno/hivemind,
/datum/action/xeno_action/change_form,
/datum/action/xeno_action/return_to_core,
/datum/action/xeno_action/teleport,
/datum/action/xeno_action/rally_hive/hivemind,
/datum/action/xeno_action/activable/command_minions,
/datum/action/xeno_action/activable/plant_weeds/ranged,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
if(loc_weeds_type || check_weeds(get_turf(src)))
return
return_to_core()
to_chat(src, "<span class='xenonotice'>We had no weeds nearby, we got moved to our core.")
to_chat(src, span_xenonotice("We had no weeds nearby, we got moved to our core."))
return

/mob/living/carbon/xenomorph/hivemind/proc/return_to_core()
Expand All @@ -179,7 +179,7 @@
///Start the teleportation process to send the hivemind manifestation to the selected turf
/mob/living/carbon/xenomorph/hivemind/proc/start_teleport(turf/T)
if(!isopenturf(T))
to_chat(src, span_notice("You cannot teleport into a wall"))
balloon_alert(src, "Can't teleport into a wall")
return
TIMER_COOLDOWN_START(src, COOLDOWN_HIVEMIND_MANIFESTATION, TIME_TO_TRANSFORM)
flick("Hivemind_materialisation_fast_reverse", src)
Expand All @@ -189,7 +189,7 @@
/mob/living/carbon/xenomorph/hivemind/proc/end_teleport(turf/T)
flick("Hivemind_materialisation_fast", src)
if(!check_weeds(T, TRUE))
to_chat(src, span_warning("The weeds on our destination were destroyed"))
balloon_alert(src, "No weeds in destination")
else
forceMove(T)

Expand Down

0 comments on commit 97055bf

Please sign in to comment.