mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
[MIRROR] Conversion many Globals to Managed Globals (Part 1) (#10665)
Co-authored-by: Selis <12716288+ItsSelis@users.noreply.github.com> Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
06f0821bcf
commit
f7219329ca
@@ -20,7 +20,7 @@
|
||||
sleep(2400)
|
||||
*/
|
||||
|
||||
var/list/event_last_fired = list()
|
||||
GLOBAL_LIST_EMPTY(event_last_fired)
|
||||
|
||||
//Always triggers an event when called, dynamically chooses events based on job population
|
||||
/proc/spawn_dynamic_event()
|
||||
@@ -84,15 +84,15 @@ var/list/event_last_fired = list()
|
||||
possibleEvents[/datum/event/spider_infestation] = max(active_with_role[DEPARTMENT_SECURITY], 5) + 5
|
||||
possibleEvents[/datum/event/random_antag] = max(active_with_role[DEPARTMENT_SECURITY], 5) + 2.5
|
||||
|
||||
for(var/event_type in event_last_fired) if(possibleEvents[event_type])
|
||||
var/time_passed = world.time - event_last_fired[event_type]
|
||||
for(var/event_type in GLOB.event_last_fired) if(possibleEvents[event_type])
|
||||
var/time_passed = world.time - GLOB.event_last_fired[event_type]
|
||||
var/full_recharge_after = 60 * 60 * 10 * 3 // 3 hours
|
||||
var/weight_modifier = max(0, (full_recharge_after - time_passed) / 300)
|
||||
|
||||
possibleEvents[event_type] = max(possibleEvents[event_type] - weight_modifier, 0)
|
||||
|
||||
var/picked_event = pickweight(possibleEvents)
|
||||
event_last_fired[picked_event] = world.time
|
||||
GLOB.event_last_fired[picked_event] = world.time
|
||||
|
||||
// Debug code below here, very useful for testing so don't delete please.
|
||||
var/debug_message = "Firing random event. "
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
/datum/event/grub_infestation/end()
|
||||
var/list/area_names = list()
|
||||
for(var/mob/living/G as anything in existing_solargrubs)
|
||||
for(var/mob/living/G as anything in GLOB.existing_solargrubs)
|
||||
if(!G || G.stat == DEAD)
|
||||
continue
|
||||
if(istype(G, /mob/living/simple_mob/animal/solargrub_larva))
|
||||
|
||||
@@ -9,8 +9,8 @@ GLOBAL_VAR_INIT(account_hack_attempted, 0)
|
||||
|
||||
/datum/event/money_hacker/setup()
|
||||
end_time = world.time + 6000
|
||||
if(all_money_accounts.len)
|
||||
affected_account = pick(all_money_accounts)
|
||||
if(GLOB.all_money_accounts.len)
|
||||
affected_account = pick(GLOB.all_money_accounts)
|
||||
|
||||
GLOB.account_hack_attempted = 1
|
||||
else
|
||||
@@ -50,7 +50,7 @@ GLOBAL_VAR_INIT(account_hack_attempted, 0)
|
||||
T.amount = pick("","([rand(0,99999)])","alla money","9001$","HOLLA HOLLA GET DOLLA","([lost])")
|
||||
var/date1 = "31 December, 1999"
|
||||
var/date2 = "[num2text(rand(1,31))] [pick("January","February","March","April","May","June","July","August","September","October","November","December")], [rand(1000,3000)]"
|
||||
T.date = pick("", current_date_string, date1, date2)
|
||||
T.date = pick("", GLOB.current_date_string, date1, date2)
|
||||
var/time1 = rand(0, 99999999)
|
||||
var/time2 = "[round(time1 / 36000)+12]:[(time1 / 600 % 60) < 10 ? add_zero(time1 / 600 % 60, 1) : time1 / 600 % 60]"
|
||||
T.time = pick("", stationtime2text(), time2)
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
/datum/event/money_lotto/start()
|
||||
winner_sum = pick(5000, 10000, 50000, 100000, 500000, 1000000, 1500000)
|
||||
if(all_money_accounts.len)
|
||||
var/datum/money_account/D = pick(all_money_accounts)
|
||||
if(GLOB.all_money_accounts.len)
|
||||
var/datum/money_account/D = pick(GLOB.all_money_accounts)
|
||||
winner_name = D.owner_name
|
||||
if(!D.suspended)
|
||||
D.money += winner_sum
|
||||
@@ -15,7 +15,7 @@
|
||||
T.target_name = "The [using_map.starsys_name] Times Grand Slam -Stellar- Lottery"
|
||||
T.purpose = "Winner!"
|
||||
T.amount = winner_sum
|
||||
T.date = current_date_string
|
||||
T.date = GLOB.current_date_string
|
||||
T.time = stationtime2text()
|
||||
T.source_terminal = "Sif TCD Terminal #[rand(111,333)]"
|
||||
D.transaction_log.Add(T)
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
/datum/event/random_antag/start()
|
||||
var/list/valid_types = list()
|
||||
for(var/antag_type in all_antag_types)
|
||||
var/datum/antagonist/antag = all_antag_types[antag_type]
|
||||
for(var/antag_type in GLOB.all_antag_types)
|
||||
var/datum/antagonist/antag = GLOB.all_antag_types[antag_type]
|
||||
if(antag.flags & ANTAG_RANDSPAWN)
|
||||
valid_types |= antag
|
||||
if(valid_types.len)
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
for(var/obj/effect/landmark/C in landmarks_list)
|
||||
if(istype(C, /obj/effect/landmark/wildlife))
|
||||
var/obj/effect/landmark/wildlife/WLLM = C
|
||||
if(GLOB.world_time_season == "winter" && WLLM.wildlife_type == 1) //fish forbidden in winter because ice now aparently // CHOMPEdit - Managed Globals
|
||||
if(GLOB.world_time_season == "winter" && WLLM.wildlife_type == 1) //fish forbidden in winter because ice now aparently
|
||||
continue
|
||||
possible_spawns.Add(C)
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
message += "<hr>"
|
||||
message += "Deliver these items to [command_name()] via the supply shuttle. Please put the ones you can into crates!<br>"
|
||||
|
||||
for(var/dpt in req_console_supplies)
|
||||
for(var/dpt in GLOB.req_console_supplies)
|
||||
send_console_message(message, dpt);
|
||||
|
||||
// Also announce over main comms so people know to look
|
||||
|
||||
Reference in New Issue
Block a user