Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
doom committed Sep 28, 2023
1 parent 7fbad62 commit 15abb6d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 49 deletions.
36 changes: 20 additions & 16 deletions code/controllers/subsystem/minimap.dm
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ SUBSYSTEM_DEF(minimaps)
else
map_list = GLOB.uscm_svg_overlay


if(map_list.len == 0)
return

Expand Down Expand Up @@ -390,6 +391,7 @@ SUBSYSTEM_DEF(minimaps)
if(xeno.hivenumber == user_faction)
faction_clients += client
else if(client_mob.faction == user_faction) // TODO: not distributing properly, fix.
to_chat(user, SPAN_WARNING(client))
faction_clients += client
COOLDOWN_START(src, flatten_map_cooldown, flatten_map_cooldown_time)
var/flat_tacmap_png = icon2html(flat_map, faction_clients, sourceonly = TRUE)
Expand All @@ -407,19 +409,14 @@ SUBSYSTEM_DEF(minimaps)
* * svg_coords: an array of coordinates corresponding to an svg.
*/
/datum/tacmap/proc/store_current_svg_coords(mob/user, svg_coords)
if(!svg_coords)
to_chat(user, SPAN_WARNING("The tacmap filckers and then shuts off, a critical error has occured")) // tf2heavy: "Oh, this is bad!"
return FALSE

var/datum/svg_overlay/svg_overlay = new(svg_coords)
var/datum/svg_overlay/svg_store_overlay = new(svg_coords)

if(isxeno(user))
GLOB.xeno_svg_overlay += svg_overlay
GLOB.xeno_svg_overlay += svg_store_overlay
else
GLOB.uscm_svg_overlay += svg_overlay
GLOB.uscm_svg_overlay += svg_store_overlay

qdel(svg_overlay)
return TRUE
qdel(svg_store_overlay)


/datum/controller/subsystem/minimaps/proc/fetch_tacmap_datum(zlevel, flags)
Expand Down Expand Up @@ -551,7 +548,7 @@ SUBSYSTEM_DEF(minimaps)
var/updated_canvas = FALSE

var/datum/flattend_tacmap_png/current_map = new

var/datum/svg_overlay/current_svg = new

/datum/tacmap/New(atom/source, minimap_type)
allowed_flags = minimap_type
Expand All @@ -574,19 +571,22 @@ SUBSYSTEM_DEF(minimaps)
current_map = get_current_tacmap_data(user, TRUE)
if(!current_map)
distribute_current_map_png(user)
current_map.flat_tacmap = get_current_tacmap_data(user, TRUE).flat_tacmap
current_map = get_current_tacmap_data(user, TRUE)


user.client.register_map_obj(map_holder.map)
ui = new(user, src, "TacticalMap")
ui.open()

/datum/tacmap/ui_data(mob/user)
var/list/data = list()
data["svgData"] = null

data["flatImage"] = current_map.flat_tacmap
if(current_map)
data["svgData"] = get_current_tacmap_data(user, FALSE).svg_data

data["svgData"] = null

if(current_svg)
data["svgData"] = current_svg.svg_data

data["mapRef"] = map_holder.map_ref
data["toolbarColorSelection"] = toolbar_color_selection
Expand Down Expand Up @@ -667,11 +667,15 @@ SUBSYSTEM_DEF(minimaps)
. = TRUE

if ("selectAnnouncement")

if(!params["image"])
return
var/outgoing_message = stripped_multiline_input(user, "Optional message to announce with the tactical map", "Tactical Map Announcement", "")
if(!outgoing_message)
return
if(!store_current_svg_coords(params["image"]))
return
store_current_svg_coords(user, params["image"])

current_svg = get_current_tacmap_data(user, FALSE)

var/signed
var/mob/living/carbon/xenomorph/xeno
Expand Down
19 changes: 0 additions & 19 deletions code/game/objects/items/devices/helmet_visors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,6 @@
action_icon_string = "blank_hud_sight_down"
helmet_overlay = "weld_visor"

/obj/item/device/helmet_visor/tactical_map_visor
name = "map visor"
icon_state = "meson_sight"
hud_type = null
action_icon_string = "meson_sight_down"
helmet_overlay = "tacmap_visor"

/obj/item/device/helmet_visor/welding_visor/visor_function(obj/item/clothing/head/helmet/marine/attached_helmet, mob/living/carbon/human/user, silent = FALSE)
if(attached_helmet == user.head && attached_helmet.active_visor == src)
attached_helmet.vision_impair = VISION_IMPAIR_MAX
Expand All @@ -97,18 +90,6 @@
user.update_tint()
return TRUE

/obj/item/device/helmet_visor/tactical_map_visor/visor_function(obj/item/clothing/head/helmet/marine/attached_helmet, mob/living/carbon/human/user, silent = FALSE, toggle_type)
if(attached_helmet == user.head && attached_helmet.active_visor == src && toggle_type)
GLOB.tacmap_datum.tgui_interact(user)
if(!silent)
to_chat(user, SPAN_NOTICE("You activate [src] on [attached_helmet]."))
return TRUE

SStgui.close_user_uis(user, GLOB.tacmap_datum)
if(!silent)
to_chat(user, SPAN_NOTICE("You deactivate [src] on [attached_helmet]."))
return TRUE

/obj/item/device/helmet_visor/welding_visor/mercenary
helmet_overlay = ""

Expand Down
22 changes: 8 additions & 14 deletions code/modules/clothing/head/helmet.dm
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list(
var/helmet_overlay_icon = 'icons/mob/humans/onmob/head_1.dmi'

///Any visors built into the helmet
var/list/built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/tactical_map_visor)
var/list/built_in_visors = list(new /obj/item/device/helmet_visor)

///Any visors that have been added into the helmet
var/list/inserted_visors = list()
Expand Down Expand Up @@ -623,10 +623,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list(
return

if(active_visor.can_toggle(user))
if(istype(active_visor, /obj/item/device/helmet_visor/tactical_map_visor))
active_visor.visor_function(src, user, FALSE, TRUE)
else
active_visor.visor_function(src, user)
active_visor.visor_function(src, user)

playsound_client(user.client, active_visor.toggle_on_sound, null, 75)
update_icon()
Expand All @@ -637,10 +634,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list(
return

if(current_visor.can_toggle(user))
if(istype(current_visor, /obj/item/device/helmet_visor/tactical_map_visor))
current_visor.visor_function(src, user, sound, FALSE)
else
current_visor.visor_function(src, user)
current_visor.visor_function(src, user)

if(sound)
playsound_client(user.client, current_visor.toggle_off_sound, null, 75)
Expand Down Expand Up @@ -722,7 +716,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list(
desc = "A modified M10 marine helmet for ComTechs. Features a toggleable welding screen for eye protection."
icon_state = "tech_helmet"
specialty = "M10 technician"
built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/welding_visor, new /obj/item/device/helmet_visor/tactical_map_visor)
built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/welding_visor)

/obj/item/clothing/head/helmet/marine/grey
desc = "A standard M10 Pattern Helmet. This one has not had a camouflage pattern applied to it yet. There is a built-in camera on the right side."
Expand All @@ -741,14 +735,14 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list(
flags_inventory = BLOCKSHARPOBJ
flags_inv_hide = HIDEEARS|HIDETOPHAIR
specialty = "M50 tanker"
built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/welding_visor/tanker, new /obj/item/device/helmet_visor/tactical_map_visor)
built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/welding_visor/tanker)

/obj/item/clothing/head/helmet/marine/medic
name = "\improper M10 corpsman helmet"
desc = "An M10 marine helmet version worn by marine hospital corpsmen. Has red cross painted on its front."
icon_state = "med_helmet"
specialty = "M10 pattern medic"
built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/medical/advanced, new /obj/item/device/helmet_visor/tactical_map_visor)
built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/medical/advanced)
start_down_visor_type = /obj/item/device/helmet_visor/medical/advanced

/obj/item/clothing/head/helmet/marine/covert
Expand Down Expand Up @@ -891,7 +885,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list(
armor_bio = CLOTHING_ARMOR_MEDIUMHIGH
specialty = "M10 pattern captain"
flags_atom = NO_SNOW_TYPE
built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/medical/advanced, new /obj/item/device/helmet_visor/security, new /obj/item/device/helmet_visor/tactical_map_visor)
built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/medical/advanced, new /obj/item/device/helmet_visor/security)

/obj/item/clothing/head/helmet/marine/MP
name = "\improper M10 pattern MP helmet"
Expand All @@ -915,7 +909,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list(
icon_state = "helmet"
item_state = "helmet"
specialty = "M10 pattern officer"
built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/medical/advanced, new /obj/item/device/helmet_visor/tactical_map_visor)
built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/medical/advanced)

/obj/item/clothing/head/helmet/marine/mp/provost/marshal
name = "\improper Provost Marshal Cap"
Expand Down

0 comments on commit 15abb6d

Please sign in to comment.