From 3b322b9f7cbea0c8c9db76770dc0621fd9cf5104 Mon Sep 17 00:00:00 2001 From: Timothy Teakettle <59849408+timothyteakettle@users.noreply.github.com> Date: Mon, 6 Apr 2020 17:34:34 +0100 Subject: [PATCH 1/4] population locked uplink items use current population yay? --- code/datums/components/uplink.dm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/code/datums/components/uplink.dm b/code/datums/components/uplink.dm index e73465d785..068245e9b9 100644 --- a/code/datums/components/uplink.dm +++ b/code/datums/components/uplink.dm @@ -27,6 +27,7 @@ GLOBAL_LIST_EMPTY(uplinks) var/datum/ui_state/checkstate var/compact_mode = FALSE var/debug = FALSE + var/saved_player_population = 0 /datum/component/uplink/Initialize(_owner, _lockable = TRUE, _enabled = FALSE, datum/game_mode/_gamemode, starting_tc = 20, datum/ui_state/_checkstate, datum/traitor_class/traitor_class) if(!isitem(parent)) @@ -68,6 +69,7 @@ GLOBAL_LIST_EMPTY(uplinks) if(!lockable) active = TRUE locked = FALSE + saved_player_population = GLOB.joined_player_list.len /datum/component/uplink/InheritComponent(datum/component/uplink/U) lockable |= U.lockable @@ -118,6 +120,13 @@ GLOBAL_LIST_EMPTY(uplinks) active = TRUE if(user) ui_interact(user) + //update the saved population + previous_player_population = saved_player_population + saved_player_population = GLOB.joined_player_list.len + //if population has changed, update uplink items + if(saved_player_population != current_player_population) + uplink_items = get_uplink_items(gamemode, TRUE, allow_restricted, filters) + // an unlocked uplink blocks also opening the PDA or headset menu return COMPONENT_NO_INTERACT @@ -190,7 +199,9 @@ GLOBAL_LIST_EMPTY(uplinks) if(item in buyable_items) var/datum/uplink_item/I = buyable_items[item] - MakePurchase(usr, I) + //check to make sure people cannot buy items when the player pop is below the requirement + if(saved_player_population >= I.player_minimum) + MakePurchase(usr, I) . = TRUE if("lock") active = FALSE From e8002ee4494899ee1d969ee80634afcb31a6bb89 Mon Sep 17 00:00:00 2001 From: Timothy Teakettle <59849408+timothyteakettle@users.noreply.github.com> Date: Mon, 6 Apr 2020 17:45:19 +0100 Subject: [PATCH 2/4] imagine if it compiled and was less bad --- code/datums/components/uplink.dm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/datums/components/uplink.dm b/code/datums/components/uplink.dm index 068245e9b9..0e9fb9d1f7 100644 --- a/code/datums/components/uplink.dm +++ b/code/datums/components/uplink.dm @@ -28,6 +28,7 @@ GLOBAL_LIST_EMPTY(uplinks) var/compact_mode = FALSE var/debug = FALSE var/saved_player_population = 0 + var/list/filters = list() /datum/component/uplink/Initialize(_owner, _lockable = TRUE, _enabled = FALSE, datum/game_mode/_gamemode, starting_tc = 20, datum/ui_state/_checkstate, datum/traitor_class/traitor_class) if(!isitem(parent)) @@ -48,7 +49,6 @@ GLOBAL_LIST_EMPTY(uplinks) RegisterSignal(parent, COMSIG_PEN_ROTATED, .proc/pen_rotation) GLOB.uplinks += src - var/list/filters = list() if(istype(traitor_class)) filters = traitor_class.uplink_filters starting_tc = traitor_class.TC @@ -121,10 +121,10 @@ GLOBAL_LIST_EMPTY(uplinks) if(user) ui_interact(user) //update the saved population - previous_player_population = saved_player_population + var/previous_player_population = saved_player_population saved_player_population = GLOB.joined_player_list.len //if population has changed, update uplink items - if(saved_player_population != current_player_population) + if(saved_player_population != previous_player_population) uplink_items = get_uplink_items(gamemode, TRUE, allow_restricted, filters) // an unlocked uplink blocks also opening the PDA or headset menu From 864f9b324434ee8d8b9311ec4f7308ab15b6f9b2 Mon Sep 17 00:00:00 2001 From: Timothy Teakettle <59849408+timothyteakettle@users.noreply.github.com> Date: Mon, 6 Apr 2020 18:59:48 +0100 Subject: [PATCH 3/4] except this times its in the right order --- code/datums/components/uplink.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/components/uplink.dm b/code/datums/components/uplink.dm index 0e9fb9d1f7..7df570587d 100644 --- a/code/datums/components/uplink.dm +++ b/code/datums/components/uplink.dm @@ -119,13 +119,13 @@ GLOBAL_LIST_EMPTY(uplinks) return active = TRUE if(user) - ui_interact(user) //update the saved population var/previous_player_population = saved_player_population saved_player_population = GLOB.joined_player_list.len //if population has changed, update uplink items if(saved_player_population != previous_player_population) uplink_items = get_uplink_items(gamemode, TRUE, allow_restricted, filters) + ui_interact(user) // an unlocked uplink blocks also opening the PDA or headset menu return COMPONENT_NO_INTERACT From aabcfb580bc3ee999decbca1de237fde0769a153 Mon Sep 17 00:00:00 2001 From: Timothy Teakettle <59849408+timothyteakettle@users.noreply.github.com> Date: Mon, 6 Apr 2020 19:49:06 +0100 Subject: [PATCH 4/4] discounts rerolling is bad --- code/datums/components/uplink.dm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/code/datums/components/uplink.dm b/code/datums/components/uplink.dm index 7df570587d..dde8961482 100644 --- a/code/datums/components/uplink.dm +++ b/code/datums/components/uplink.dm @@ -124,7 +124,11 @@ GLOBAL_LIST_EMPTY(uplinks) saved_player_population = GLOB.joined_player_list.len //if population has changed, update uplink items if(saved_player_population != previous_player_population) - uplink_items = get_uplink_items(gamemode, TRUE, allow_restricted, filters) + //make sure discounts are not rerolled + var/old_discounts = uplink_items["Discounted Gear"] + uplink_items = get_uplink_items(gamemode, FALSE, allow_restricted, filters) + if(old_discounts) + uplink_items["Discounted Gear"] = old_discounts ui_interact(user) // an unlocked uplink blocks also opening the PDA or headset menu @@ -200,7 +204,7 @@ GLOBAL_LIST_EMPTY(uplinks) if(item in buyable_items) var/datum/uplink_item/I = buyable_items[item] //check to make sure people cannot buy items when the player pop is below the requirement - if(saved_player_population >= I.player_minimum) + if(GLOB.joined_player_list.len >= I.player_minimum) MakePurchase(usr, I) . = TRUE if("lock")