Skip to content

Commit

Permalink
Merge branch 'master' into tacmap-ref
Browse files Browse the repository at this point in the history
  • Loading branch information
Cthulhu80 authored Dec 21, 2023
2 parents 9bca4b7 + 3ca6df6 commit cd6e1cc
Show file tree
Hide file tree
Showing 27 changed files with 215 additions and 74 deletions.
10 changes: 9 additions & 1 deletion code/__DEFINES/mode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,16 @@ GLOBAL_LIST_INIT(whitelist_hierarchy, list(WHITELIST_NORMAL, WHITELIST_COUNCIL,

#define FACTION_LIST_MARINE list(FACTION_MARINE)
#define FACTION_LIST_HUMANOID list(FACTION_MARINE, FACTION_PMC, FACTION_WY, FACTION_WY_DEATHSQUAD, FACTION_CLF, FACTION_CONTRACTOR, FACTION_MARSHAL, FACTION_UPP, FACTION_FREELANCER, FACTION_SURVIVOR, FACTION_NEUTRAL, FACTION_COLONIST, FACTION_MERCENARY, FACTION_DUTCH, FACTION_HEFA, FACTION_GLADIATOR, FACTION_PIRATE, FACTION_PIZZA, FACTION_SOUTO, FACTION_YAUTJA, FACTION_ZOMBIE, FACTION_TWE)
#define FACTION_LIST_ERT list(FACTION_PMC, FACTION_WY_DEATHSQUAD, FACTION_CLF, FACTION_CONTRACTOR, FACTION_UPP, FACTION_FREELANCER, FACTION_MERCENARY, FACTION_DUTCH, FACTION_HEFA, FACTION_GLADIATOR, FACTION_PIRATE, FACTION_PIZZA, FACTION_SOUTO, FACTION_MARSHAL, FACTION_TWE)
#define FACTION_LIST_ERT list(FACTION_HEFA, FACTION_GLADIATOR, FACTION_PIRATE, FACTION_PIZZA, FACTION_SOUTO)
#define FACTION_LIST_WY list(FACTION_PMC, FACTION_WY_DEATHSQUAD, FACTION_WY)
#define FACTION_LIST_UPP list(FACTION_UPP)
#define FACTION_LIST_CLF list(FACTION_CLF)
#define FACTION_LIST_TWE list(FACTION_TWE)
#define FACTION_LIST_FREELANCER list(FACTION_FREELANCER)
#define FACTION_LIST_CONTRACTOR list(FACTION_CONTRACTOR)
#define FACTION_LIST_MERCENARY list(FACTION_MERCENARY)
#define FACTION_LIST_MARSHAL list(FACTION_MARSHAL)
#define FACTION_LIST_DUTCH list(FACTION_DUTCH)
#define FACTION_LIST_MARINE_WY list(FACTION_MARINE, FACTION_PMC, FACTION_WY_DEATHSQUAD, FACTION_WY)
#define FACTION_LIST_MARINE_UPP list(FACTION_MARINE, FACTION_UPP)
#define FACTION_LIST_MARINE_TWE list(FACTION_MARINE, FACTION_TWE)
Expand Down
76 changes: 50 additions & 26 deletions code/controllers/subsystem/minimap.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#define CANVAS_COOLDOWN_TIME 4 MINUTES
#define FLATTEN_MAP_COOLDOWN_TIME 3 MINUTES

/**
* # Minimaps subsystem
*
Expand Down Expand Up @@ -438,11 +441,11 @@ SUBSYSTEM_DEF(minimaps)
if(faction == FACTION_MARINE)
if(!COOLDOWN_FINISHED(GLOB, uscm_flatten_map_icon_cooldown))
return FALSE
COOLDOWN_START(GLOB, uscm_flatten_map_icon_cooldown, flatten_map_cooldown_time)
COOLDOWN_START(GLOB, uscm_flatten_map_icon_cooldown, FLATTEN_MAP_COOLDOWN_TIME)
else if(faction == XENO_HIVE_NORMAL)
if(!COOLDOWN_FINISHED(GLOB, xeno_flatten_map_icon_cooldown))
return FALSE
COOLDOWN_START(GLOB, xeno_flatten_map_icon_cooldown, flatten_map_cooldown_time)
COOLDOWN_START(GLOB, xeno_flatten_map_icon_cooldown, FLATTEN_MAP_COOLDOWN_TIME)
else
return FALSE

Expand Down Expand Up @@ -500,6 +503,8 @@ SUBSYSTEM_DEF(minimaps)
qdel(svg_store_overlay)
debug_log("SVG coordinates for [faction] are not implemented!")

#define can_draw(faction, user) ((faction == FACTION_MARINE && skillcheck(user, SKILL_LEADERSHIP, SKILL_LEAD_EXPERT)) || (faction == XENO_HIVE_NORMAL && isqueen(user)))

/datum/controller/subsystem/minimaps/proc/fetch_tacmap_datum(zlevel, flags)
var/hash = "[zlevel]-[flags]"
if(hashed_tacmaps[hash])
Expand Down Expand Up @@ -625,9 +630,6 @@ SUBSYSTEM_DEF(minimaps)
var/toolbar_color_selection = "black"
var/toolbar_updated_selection = "black"

var/canvas_cooldown_time = 4 MINUTES
var/flatten_map_cooldown_time = 3 MINUTES

/// boolean value to keep track if the canvas has been updated or not, the value is used in tgui state.
var/updated_canvas = FALSE
/// current flattend map
Expand Down Expand Up @@ -740,7 +742,6 @@ SUBSYSTEM_DEF(minimaps)
else
data["canvasCooldown"] = max(GLOB.uscm_canvas_cooldown - world.time, 0)

data["nextCanvasTime"] = canvas_cooldown_time
data["updatedCanvas"] = updated_canvas

data["lastUpdateTime"] = last_update_time
Expand All @@ -750,6 +751,7 @@ SUBSYSTEM_DEF(minimaps)

/datum/tacmap/ui_static_data(mob/user)
var/list/data = list()

data["mapRef"] = map_holder?.map_ref
data["canDraw"] = FALSE
data["canViewTacmap"] = TRUE
Expand All @@ -761,6 +763,7 @@ SUBSYSTEM_DEF(minimaps)
/datum/tacmap/drawing/ui_static_data(mob/user)
var/list/data = list()

data["canvasCooldownDuration"] = CANVAS_COOLDOWN_TIME
data["mapRef"] = map_holder?.map_ref
data["canDraw"] = FALSE
data["mapFallback"] = wiki_map_fallback
Expand All @@ -773,14 +776,16 @@ SUBSYSTEM_DEF(minimaps)
data["canViewTacmap"] = is_xeno
data["canViewCanvas"] = faction == FACTION_MARINE || faction == XENO_HIVE_NORMAL

if(faction == FACTION_MARINE && skillcheck(user, SKILL_LEADERSHIP, SKILL_LEAD_EXPERT) || faction == XENO_HIVE_NORMAL && isqueen(user))
if(can_draw(faction, user))
data["canDraw"] = TRUE
data["canViewTacmap"] = TRUE

return data

/datum/tacmap/drawing/status_tab_view/ui_static_data(mob/user)
var/list/data = list()

data["canvasCooldownDuration"] = CANVAS_COOLDOWN_TIME
data["mapFallback"] = wiki_map_fallback
data["canDraw"] = FALSE
data["canViewTacmap"] = FALSE
Expand All @@ -791,6 +796,8 @@ SUBSYSTEM_DEF(minimaps)

/datum/tacmap/drawing/status_tab_view/xeno/ui_static_data(mob/user)
var/list/data = list()

data["canvasCooldownDuration"] = CANVAS_COOLDOWN_TIME
data["mapFallback"] = wiki_map_fallback
data["canDraw"] = FALSE
data["canViewTacmap"] = FALSE
Expand All @@ -814,8 +821,10 @@ SUBSYSTEM_DEF(minimaps)
var/mob/user = ui.user
var/mob/living/carbon/xenomorph/xeno = user
var/faction = istype(xeno) ? xeno.hivenumber : user.faction
if(faction == FACTION_NEUTRAL && isobserver(user))
var/is_observer = isobserver(user)
if(faction == FACTION_NEUTRAL && is_observer)
faction = allowed_flags == MINIMAP_FLAG_XENO ? XENO_HIVE_NORMAL : FACTION_MARINE
var/drawing_allowed = !is_observer && can_draw(faction, user)

switch (action)
if ("menuSelect")
Expand All @@ -824,6 +833,9 @@ SUBSYSTEM_DEF(minimaps)
updated_canvas = FALSE
toolbar_updated_selection = toolbar_color_selection // doing this if it == canvas can cause a latency issue with the stroke.
else
if(!drawing_allowed)
msg_admin_niche("[key_name(user)] made an unauthorized attempt to 'menuSelect' the 'new canvas' panel of the [faction] tacmap!")
return FALSE
distribute_current_map_png(faction)
last_update_time = world.time
// An attempt to get the image to load on first try in the interface, but doesn't seem always reliable
Expand All @@ -832,60 +844,68 @@ SUBSYSTEM_DEF(minimaps)
old_map = get_tacmap_data_png(faction)
current_svg = get_tacmap_data_svg(faction)

if ("updateCanvas")
// forces state change, this will export the svg.
if("updateCanvas")
toolbar_updated_selection = "export"
updated_canvas = TRUE
action_queue_change += 1

if ("clearCanvas")
if("clearCanvas")
toolbar_updated_selection = "clear"
updated_canvas = FALSE
action_queue_change += 1

if ("undoChange")
if("undoChange")
toolbar_updated_selection = "undo"
updated_canvas = FALSE
action_queue_change += 1

if ("selectColor")
if("selectColor")
var/newColor = params["color"]
if(newColor)
toolbar_color_selection = newColor
toolbar_updated_selection = newColor
action_queue_change += 1

if ("onDraw")
if("onDraw")
updated_canvas = FALSE

if ("selectAnnouncement")
if("selectAnnouncement")
if(!drawing_allowed)
msg_admin_niche("[key_name(user)] made an unauthorized attempt to 'selectAnnouncement' the [faction] tacmap!")
return FALSE

if(!istype(params["image"], /list)) // potentially very serious?
return FALSE

var/cooldown_satisfied = FALSE
if(faction == FACTION_MARINE)
GLOB.uscm_flat_tacmap_data += new_current_map
cooldown_satisfied = COOLDOWN_FINISHED(GLOB, uscm_canvas_cooldown)
else if(faction == XENO_HIVE_NORMAL)
GLOB.xeno_flat_tacmap_data += new_current_map

store_current_svg_coords(faction, params["image"], user)
current_svg = get_tacmap_data_svg(faction)
old_map = get_tacmap_data_png(faction)
cooldown_satisfied = COOLDOWN_FINISHED(GLOB, xeno_canvas_cooldown)
if(!cooldown_satisfied)
msg_admin_niche("[key_name(user)] attempted to 'selectAnnouncement' the [faction] tacmap while it is still on cooldown!")
return FALSE

if(faction == FACTION_MARINE)
COOLDOWN_START(GLOB, uscm_canvas_cooldown, canvas_cooldown_time)
var/mob/living/carbon/human/human_leader = user
GLOB.uscm_flat_tacmap_data += new_current_map
COOLDOWN_START(GLOB, uscm_canvas_cooldown, CANVAS_COOLDOWN_TIME)
for(var/datum/squad/current_squad in GLOB.RoleAuthority.squads)
current_squad.send_maptext("Tactical map update in progress...", "Tactical Map:")
var/mob/living/carbon/human/human_leader = user
human_leader.visible_message(SPAN_BOLDNOTICE("Tactical map update in progress..."))
playsound_client(human_leader.client, "sound/effects/sos-morse-code.ogg")
notify_ghosts(header = "Tactical Map", message = "The USCM tactical map has been updated.", ghost_sound = "sound/effects/sos-morse-code.ogg", notify_volume = 80, action = NOTIFY_USCM_TACMAP, enter_link = "uscm_tacmap=1", enter_text = "View", source = owner)

else if(faction == XENO_HIVE_NORMAL)
var/mutable_appearance/appearance = mutable_appearance(icon('icons/mob/hud/actions_xeno.dmi'), "toggle_queen_zoom")
COOLDOWN_START(GLOB, xeno_canvas_cooldown, canvas_cooldown_time)
GLOB.xeno_flat_tacmap_data += new_current_map
COOLDOWN_START(GLOB, xeno_canvas_cooldown, CANVAS_COOLDOWN_TIME)
xeno_maptext("The Queen has updated our hive mind map", "We sense something unusual...", faction)
var/mutable_appearance/appearance = mutable_appearance(icon('icons/mob/hud/actions_xeno.dmi'), "toggle_queen_zoom")
notify_ghosts(header = "Tactical Map", message = "The Xenomorph tactical map has been updated.", ghost_sound = "sound/voice/alien_distantroar_3.ogg", notify_volume = 50, action = NOTIFY_XENO_TACMAP, enter_link = "xeno_tacmap=1", enter_text = "View", source = user, alert_overlay = appearance)

store_current_svg_coords(faction, params["image"], user)
current_svg = get_tacmap_data_svg(faction)
old_map = get_tacmap_data_png(faction)

toolbar_updated_selection = toolbar_color_selection
message_admins("[key_name(user)] has updated the <a href='?tacmaps_panel=1'>tactical map</a> for [faction].")
updated_canvas = FALSE
Expand Down Expand Up @@ -995,3 +1015,7 @@ SUBSYSTEM_DEF(minimaps)
if(XENO_HIVE_RENEGADE)
return MINIMAP_FLAG_XENO_RENEGADE
return 0

#undef CANVAS_COOLDOWN_TIME
#undef FLATTEN_MAP_COOLDOWN_TIME
#undef can_draw
4 changes: 4 additions & 0 deletions code/game/objects/items/reagent_containers/food/drinks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
to_chat(user, SPAN_DANGER("The [src.name] is empty!"))
return FALSE

if(HAS_TRAIT(M, TRAIT_CANNOT_EAT))
to_chat(user, SPAN_DANGER("[user == M ? "You are" : "[M] is"] unable to drink!"))
return FALSE

if(M == user)
to_chat(M, SPAN_NOTICE(" You swallow a gulp from \the [src]."))
if(reagents.total_volume)
Expand Down
14 changes: 7 additions & 7 deletions code/game/objects/items/reagent_containers/food/snacks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
..()

if (world.time <= user.next_move)
return
return FALSE
attack(user, user, "head")//zone does not matter
user.next_move += attack_speed

Expand All @@ -51,24 +51,24 @@
to_chat(user, SPAN_DANGER("None of [src] left, oh no!"))
M.drop_inv_item_on_ground(src) //so icons update :[
qdel(src)
return 0
return FALSE

if(package)
to_chat(M, SPAN_WARNING("How do you expect to eat this with the package still on?"))
return 0
return FALSE

if(istype(M, /mob/living/carbon))
var/mob/living/carbon/C = M
var/fullness = M.nutrition + (M.reagents.get_reagent_amount("nutriment") * 25)
if(fullness > NUTRITION_HIGH && world.time < C.overeat_cooldown)
to_chat(user, SPAN_WARNING("[user == M ? "You" : "They"] don't feel like eating more right now."))
return
return FALSE
if(issynth(C))
fullness = 200 //Synths never get full

if(HAS_TRAIT(M, TRAIT_CANNOT_EAT)) //Do not feed the Working Joes
to_chat(user, SPAN_DANGER("[user == M ? "You are" : "[M] is"] unable to eat!"))
return
return FALSE

if(fullness > NUTRITION_HIGH)
C.overeat_cooldown = world.time + OVEREAT_TIME
Expand Down Expand Up @@ -120,9 +120,9 @@
reagents.trans_to_ingest(M, reagents.total_volume)
bitecount++
On_Consume(M)
return 1
return TRUE

return 0
return FALSE

/obj/item/reagent_container/food/snacks/afterattack(obj/target, mob/user, proximity)
return ..()
Expand Down
1 change: 1 addition & 0 deletions code/modules/decorators/christmas.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
helmet.icon_override = 'icons/mob/humans/onmob/head_0.dmi'
helmet.flags_inv_hide = HIDEEARS|HIDEALLHAIR
helmet.flags_marine_helmet = NO_FLAGS
helmet.flags_atom |= NO_SNOW_TYPE|NO_NAME_OVERRIDE
if(prob(50))
helmet.icon_state = "santa_hat_red"
else
Expand Down
2 changes: 1 addition & 1 deletion code/modules/gear_presets/contractor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
rank = JOB_CONTRACTOR
idtype = /obj/item/card/id/data
faction = FACTION_CONTRACTOR
faction_group = FACTION_LIST_ERT
faction_group = list(FACTION_CONTRACTOR)
languages = list(LANGUAGE_ENGLISH, LANGUAGE_SPANISH, LANGUAGE_RUSSIAN)
var/human_versus_human = FALSE
var/headset_type = /obj/item/device/radio/headset/distress/contractor
Expand Down
36 changes: 36 additions & 0 deletions code/modules/mob/dead/observer/orbit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@
var/list/survivors = list()
var/list/xenos = list()
var/list/ert_members = list()
var/list/upp = list()
var/list/clf = list()
var/list/wy = list()
var/list/twe = list()
var/list/freelancer = list()
var/list/contractor = list()
var/list/mercenary = list()
var/list/dutch = list()
var/list/marshal = list()
var/list/synthetics = list()
var/list/predators = list()
var/list/animals = list()
Expand Down Expand Up @@ -132,12 +141,30 @@

if(SSticker.mode.is_in_endgame == TRUE && !is_mainship_level(M.z) && !(human.faction in FACTION_LIST_ERT))
escaped += list(serialized)
else if(human.faction in FACTION_LIST_WY)
wy += list(serialized)
else if(issynth(human) && !isinfiltratorsynthetic(human))
synthetics += list(serialized)
else if(isyautja(human))
predators += list(serialized)
else if(human.faction in FACTION_LIST_ERT)
ert_members += list(serialized)
else if(human.faction in FACTION_LIST_UPP)
upp += list(serialized)
else if(human.faction in FACTION_LIST_CLF)
clf += list(serialized)
else if(human.faction in FACTION_LIST_TWE)
twe += list(serialized)
else if(human.faction in FACTION_LIST_FREELANCER)
freelancer += list(serialized)
else if(human.faction in FACTION_LIST_CONTRACTOR)
contractor += list(serialized)
else if(human.faction in FACTION_LIST_MERCENARY)
mercenary += list(serialized)
else if(human.faction in FACTION_LIST_MARSHAL)
marshal += list(serialized)
else if(human.faction in FACTION_LIST_DUTCH)
dutch += list(serialized)
else if(human.faction in FACTION_LIST_MARINE)
marines += list(serialized)
else if(issurvivorjob(human.job))
Expand All @@ -156,6 +183,15 @@
data["survivors"] = survivors
data["xenos"] = xenos
data["ert_members"] = ert_members
data["upp"] = upp
data["clf"] = clf
data["wy"] = wy
data["twe"] = twe
data["freelancer"] = freelancer
data["contractor"] = contractor
data["mercenary"] = mercenary
data["dutch"] = dutch
data["marshal"] = marshal
data["synthetics"] = synthetics
data["predators"] = predators
data["animals"] = animals
Expand Down
Loading

0 comments on commit cd6e1cc

Please sign in to comment.