Files
Aurora.3/code/modules/events/event_dynamic.dm
skull132 e9b688e1f6 Merge branch 'development-2' into development
Christ on a stick. SO MANY ERRORS. REEE.

# Conflicts:
#	baystation12.dme
#	code/_helpers/lists.dm
#	code/_helpers/logging.dm
#	code/_helpers/text.dm
#	code/_onclick/click.dm
#	code/controllers/configuration.dm
#	code/controllers/master_controller.dm
#	code/datums/supplypacks.dm
#	code/game/antagonist/antagonist.dm
#	code/game/antagonist/antagonist_print.dm
#	code/game/antagonist/outsider/commando.dm
#	code/game/antagonist/outsider/ninja.dm
#	code/game/area/areas.dm
#	code/game/gamemodes/cult/cult_items.dm
#	code/game/gamemodes/game_mode.dm
#	code/game/jobs/access.dm
#	code/game/machinery/atmoalter/canister.dm
#	code/game/machinery/autolathe.dm
#	code/game/machinery/doors/airlock.dm
#	code/game/machinery/recharger.dm
#	code/game/machinery/suit_storage_unit.dm
#	code/game/mecha/mech_fabricator.dm
#	code/game/mecha/mecha.dm
#	code/game/objects/effects/spiders.dm
#	code/game/objects/items.dm
#	code/game/objects/items/devices/PDA/PDA.dm
#	code/game/objects/items/devices/flash.dm
#	code/game/objects/items/devices/lightreplacer.dm
#	code/game/objects/items/devices/paicard.dm
#	code/game/objects/items/devices/scanners.dm
#	code/game/objects/items/devices/suit_cooling.dm
#	code/game/objects/items/devices/uplink.dm
#	code/game/objects/items/robot/robot_upgrades.dm
#	code/game/objects/items/toys.dm
#	code/game/objects/items/weapons/cards_ids.dm
#	code/game/objects/items/weapons/handcuffs.dm
#	code/game/objects/items/weapons/manuals.dm
#	code/game/objects/items/weapons/material/kitchen.dm
#	code/game/objects/items/weapons/material/misc.dm
#	code/game/objects/items/weapons/material/swords.dm
#	code/game/objects/items/weapons/melee/energy.dm
#	code/game/objects/items/weapons/melee/misc.dm
#	code/game/objects/items/weapons/scrolls.dm
#	code/game/objects/items/weapons/storage/belt.dm
#	code/game/objects/items/weapons/stunbaton.dm
#	code/game/objects/items/weapons/tools.dm
#	code/game/objects/objs.dm
#	code/game/objects/structures/crates_lockers/closets.dm
#	code/game/objects/structures/crates_lockers/closets/secure/security.dm
#	code/game/objects/structures/janicart.dm
#	code/game/sound.dm
#	code/game/turfs/simulated.dm
#	code/game/verbs/ooc.dm
#	code/global.dm
#	code/modules/admin/verbs/debug.dm
#	code/modules/admin/verbs/modifyvariables.dm
#	code/modules/client/client procs.dm
#	code/modules/client/preferences.dm
#	code/modules/clothing/clothing.dm
#	code/modules/clothing/head/hardhat.dm
#	code/modules/clothing/head/helmet.dm
#	code/modules/clothing/head/jobs.dm
#	code/modules/clothing/head/misc_special.dm
#	code/modules/clothing/shoes/jobs.dm
#	code/modules/clothing/spacesuits/alien.dm
#	code/modules/clothing/spacesuits/captain.dm
#	code/modules/clothing/spacesuits/miscellaneous.dm
#	code/modules/clothing/spacesuits/rig/rig_pieces.dm
#	code/modules/clothing/spacesuits/rig/suits/alien.dm
#	code/modules/clothing/spacesuits/spacesuits.dm
#	code/modules/clothing/spacesuits/void/merc.dm
#	code/modules/clothing/spacesuits/void/void.dm
#	code/modules/clothing/suits/armor.dm
#	code/modules/clothing/suits/jobs.dm
#	code/modules/clothing/suits/storage.dm
#	code/modules/clothing/suits/utility.dm
#	code/modules/clothing/suits/wiz_robe.dm
#	code/modules/clothing/under/jobs/security.dm
#	code/modules/economy/Events.dm
#	code/modules/economy/Events_Mundane.dm
#	code/modules/economy/economy_misc.dm
#	code/modules/events/blob.dm
#	code/modules/events/event.dm
#	code/modules/events/event_container.dm
#	code/modules/events/event_manager.dm
#	code/modules/events/money_lotto.dm
#	code/modules/events/prison_break.dm
#	code/modules/events/spacevine.dm
#	code/modules/hydroponics/trays/tray.dm
#	code/modules/mob/dead/observer/observer.dm
#	code/modules/mob/emote.dm
#	code/modules/mob/holder.dm
#	code/modules/mob/language/station.dm
#	code/modules/mob/living/bot/cleanbot.dm
#	code/modules/mob/living/carbon/alien/diona/diona.dm
#	code/modules/mob/living/carbon/alien/diona/diona_attacks.dm
#	code/modules/mob/living/carbon/give.dm
#	code/modules/mob/living/carbon/human/emote.dm
#	code/modules/mob/living/carbon/human/human.dm
#	code/modules/mob/living/carbon/human/human_defense.dm
#	code/modules/mob/living/carbon/human/inventory.dm
#	code/modules/mob/living/carbon/human/life.dm
#	code/modules/mob/living/carbon/human/species/outsider/vox.dm
#	code/modules/mob/living/carbon/human/species/station/golem.dm
#	code/modules/mob/living/carbon/human/species/station/station.dm
#	code/modules/mob/living/carbon/human/update_icons.dm
#	code/modules/mob/living/carbon/metroid/metroid.dm
#	code/modules/mob/living/living.dm
#	code/modules/mob/living/living_defense.dm
#	code/modules/mob/living/living_defines.dm
#	code/modules/mob/living/silicon/ai/ai.dm
#	code/modules/mob/living/silicon/pai/admin.dm
#	code/modules/mob/living/silicon/pai/pai.dm
#	code/modules/mob/living/silicon/robot/drone/drone.dm
#	code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm
#	code/modules/mob/living/silicon/robot/emote.dm
#	code/modules/mob/living/silicon/robot/robot_items.dm
#	code/modules/mob/living/silicon/robot/robot_modules.dm
#	code/modules/mob/living/silicon/silicon.dm
#	code/modules/mob/living/simple_animal/bees.dm
#	code/modules/mob/living/simple_animal/friendly/cat.dm
#	code/modules/mob/living/simple_animal/friendly/corgi.dm
#	code/modules/mob/living/simple_animal/friendly/farm_animals.dm
#	code/modules/mob/living/simple_animal/friendly/mouse.dm
#	code/modules/mob/living/simple_animal/friendly/spiderbot.dm
#	code/modules/mob/living/simple_animal/hostile/hostile.dm
#	code/modules/mob/living/simple_animal/simple_animal.dm
#	code/modules/mob/logout.dm
#	code/modules/mob/mob.dm
#	code/modules/mob/mob_grab_specials.dm
#	code/modules/mob/mob_helpers.dm
#	code/modules/mob/new_player/sprite_accessories.dm
#	code/modules/organs/organ.dm
#	code/modules/organs/organ_alien.dm
#	code/modules/organs/organ_external.dm
#	code/modules/paperwork/faxmachine.dm
#	code/modules/projectiles/ammunition/boxes.dm
#	code/modules/projectiles/ammunition/bullets.dm
#	code/modules/projectiles/guns/energy/nuclear.dm
#	code/modules/projectiles/guns/energy/rifle.dm
#	code/modules/projectiles/guns/energy/special.dm
#	code/modules/projectiles/guns/projectile.dm
#	code/modules/projectiles/guns/projectile/automatic.dm
#	code/modules/projectiles/guns/projectile/pistol.dm
#	code/modules/projectiles/guns/projectile/revolver.dm
#	code/modules/projectiles/guns/projectile/shotgun.dm
#	code/modules/projectiles/projectile/bullets.dm
#	code/modules/projectiles/projectile/special.dm
#	code/modules/reagents/reagent_containers.dm
#	code/modules/reagents/reagent_containers/food/drinks.dm
#	code/modules/research/designs.dm
#	code/modules/research/destructive_analyzer.dm
#	code/modules/research/rdconsole.dm
#	code/modules/spells/artifacts.dm
#	code/modules/spells/spellbook.dm
#	code/modules/tables/tables.dm
#	code/world.dm
#	config/example/config.txt
#	icons/mob/items_lefthand.dmi
#	icons/mob/items_righthand.dmi
#	icons/obj/lighting.dmi
2016-10-31 00:01:52 +02:00

239 lines
8.2 KiB
Plaintext

// WARNING
//-- Added 2016-08-02 by Nanako
//This file is deprecated. The lists in event_container.dm handle event probabilities
//Do not use this file
/*
/proc/start_events()
//changed to a while(1) loop since they are more efficient.
//Moved the spawn in here to allow it to be called with advance proc call if it crashes.
//and also to stop spawn copying variables from the game ticker
spawn(3000)
while(1)
/*if(prob(50))//Every 120 seconds and prob 50 2-4 weak spacedusts will hit the station
spawn(1)
dust_swarm("weak")*/
if(!event)
//CARN: checks to see if random events are enabled.
if(config.allow_random_events)
hadevent = event()
else
Holiday_Random_Event()
else
event = 0
sleep(2400)
*/
var/list/event_last_fired = list()
//Always triggers an event when called, dynamically chooses events based on job population
/proc/spawn_dynamic_event()
if(!config.allow_random_events)
return
var/minutes_passed = world.time/600
var/list/active_with_role = number_active_with_role()
//var/engineer_count = number_active_with_role("Engineer")
//var/security_count = number_active_with_role("Security")
//var/medical_count = number_active_with_role("Medical")
//var/AI_count = number_active_with_role("AI")
//var/janitor_count = number_active_with_role("Janitor")
// Maps event names to event chances
// For each chance, 100 represents "normal likelihood", anything below 100 is "reduced likelihood", anything above 100 is "increased likelihood"
// Events have to be manually added to this proc to happen
var/list/possibleEvents = list()
//see:
// Code/WorkInProgress/Cael_Aislinn/Economy/Economy_Events.dm
// Code/WorkInProgress/Cael_Aislinn/Economy/Economy_Events_Mundane.dm
possibleEvents[/datum/event/economic_event] = 300
possibleEvents[/datum/event/trivial_news] = 400
possibleEvents[/datum/event/mundane_news] = 300
possibleEvents[/datum/event/pda_spam] = max(min(25, player_list.len) * 4, 200)
possibleEvents[/datum/event/money_lotto] = max(min(5, player_list.len), 50)
if(account_hack_attempted)
possibleEvents[/datum/event/money_hacker] = max(min(25, player_list.len) * 4, 200)
possibleEvents[/datum/event/carp_migration] = 20 + 10 * active_with_role["Engineer"]
possibleEvents[/datum/event/brand_intelligence] = 20 + 25 * active_with_role["Janitor"]
possibleEvents[/datum/event/rogue_drone] = 5 + 25 * active_with_role["Engineer"] + 25 * active_with_role["Security"]
possibleEvents[/datum/event/infestation] = 100 + 100 * active_with_role["Janitor"]
possibleEvents[/datum/event/communications_blackout] = 50 + 25 * active_with_role["AI"] + active_with_role["Scientist"] * 25
possibleEvents[/datum/event/ionstorm] = active_with_role["AI"] * 25 + active_with_role["Cyborg"] * 25 + active_with_role["Engineer"] * 10 + active_with_role["Scientist"] * 5
possibleEvents[/datum/event/grid_check] = 25 + 10 * active_with_role["Engineer"]
possibleEvents[/datum/event/electrical_storm] = 15 * active_with_role["Janitor"] + 5 * active_with_role["Engineer"]
possibleEvents[/datum/event/wallrot] = 30 * active_with_role["Engineer"] + 50 * active_with_role["Gardener"]
if(!spacevines_spawned)
possibleEvents[/datum/event/spacevine] = 10 + 5 * active_with_role["Engineer"]
if(minutes_passed >= 30) // Give engineers time to set up engine
possibleEvents[/datum/event/meteor_wave] = 10 * active_with_role["Engineer"]
possibleEvents[/datum/event/blob] = 10 * active_with_role["Engineer"]
if(active_with_role["Medical"] > 0)
possibleEvents[/datum/event/radiation_storm] = active_with_role["Medical"] * 10
possibleEvents[/datum/event/spontaneous_appendicitis] = active_with_role["Medical"] * 10
possibleEvents[/datum/event/viral_infection] = active_with_role["Medical"] * 10
possibleEvents[/datum/event/prison_break] = active_with_role["Security"] * 50
if(active_with_role["Security"] > 0)
if(!sent_spiders_to_station)
possibleEvents[/datum/event/spider_infestation] = max(active_with_role["Security"], 5) + 5
possibleEvents[/datum/event/random_antag] = max(active_with_role["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]
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
// Debug code below here, very useful for testing so don't delete please.
var/debug_message = "Firing random event. "
for(var/V in active_with_role)
debug_message += "#[V]:[active_with_role[V]] "
debug_message += "||| "
for(var/V in possibleEvents)
debug_message += "[V]:[possibleEvents[V]]"
debug_message += "|||Picked:[picked_event]"
log_debug(debug_message)
if(!picked_event)
return
//The event will add itself to the MC's event list
//and start working via the constructor.
new picked_event
//moved this to proc/check_event()
/*var/chance = possibleEvents[picked_event]
var/base_chance = 0.4
switch(player_list.len)
if(5 to 10)
base_chance = 0.6
if(11 to 15)
base_chance = 0.7
if(16 to 20)
base_chance = 0.8
if(21 to 25)
base_chance = 0.9
if(26 to 30)
base_chance = 1.0
if(30 to 100000)
base_chance = 1.1
// Trigger the event based on how likely it currently is.
if(!prob(chance * eventchance * base_chance / 100))
return 0*/
/*switch(picked_event)
if("Meteor")
command_alert("Meteors have been detected on collision course with the station.", "Meteor Alert")
for(var/mob/M in player_list)
if(!istype(M,/mob/new_player))
M << sound('sound/AI/meteors.ogg')
spawn(100)
meteor_wave(10)
spawn_meteors()
spawn(700)
meteor_wave(10)
spawn_meteors()
if("Space Ninja")
//Handled in space_ninja.dm. Doesn't announce arrival, all sneaky-like.
space_ninja_arrival()
if("Radiation")
high_radiation_event()
if("Virus")
viral_outbreak()
if("Alien")
alien_infestation()
if("Prison Break")
prison_break()
if("Carp")
carp_migration()
if("Lights")
lightsout(1,2)
if("Appendicitis")
appendicitis()
if("Ion Storm")
IonStorm()
if("Spacevine")
spacevine_infestation()
if("Communications")
communications_blackout()
if("Grid Check")
grid_check()
if("Meteor")
meteor_shower()*/
return 1
// Returns how many characters are currently active(not logged out, not AFK for more than 10 minutes)
// with a specific role.
// Note that this isn't sorted by department, because e.g. having a roboticist shouldn't make meteors spawn.
/proc/number_active_with_role()
var/list/active_with_role = list()
active_with_role["Engineer"] = 0
active_with_role["Medical"] = 0
active_with_role["Security"] = 0
active_with_role["Scientist"] = 0
active_with_role["AI"] = 0
active_with_role["Cyborg"] = 0
active_with_role["Janitor"] = 0
active_with_role["Gardener"] = 0
for(var/mob/M in player_list)
if(!M.mind || !M.client || M.client.is_afk(10 MINUTES)) // longer than 10 minutes AFK counts them as inactive
continue
active_with_role["Any"]++
if(istype(M, /mob/living/silicon/robot))
var/mob/living/silicon/robot/R = M
if(R.module)
if(istype(R.module, /obj/item/weapon/robot_module/engineering))
active_with_role["Engineer"]++
else if(istype(R.module, /obj/item/weapon/robot_module/security))
active_with_role["Security"]++
else if(istype(R.module, /obj/item/weapon/robot_module/medical))
active_with_role["Medical"]++
else if(istype(R.module, /obj/item/weapon/robot_module/research))
active_with_role["Scientist"]++
if(M.mind.assigned_role in engineering_positions)
active_with_role["Engineer"]++
if(M.mind.assigned_role in medical_positions)
active_with_role["Medical"]++
if(M.mind.assigned_role in security_positions)
active_with_role["Security"]++
if(M.mind.assigned_role in science_positions)
active_with_role["Scientist"]++
if(M.mind.assigned_role == "AI")
active_with_role["AI"]++
if(M.mind.assigned_role == "Cyborg")
active_with_role["Cyborg"]++
if(M.mind.assigned_role == "Janitor")
active_with_role["Janitor"]++
if(M.mind.assigned_role == "Gardener")
active_with_role["Gardener"]++
return active_with_role