mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-29 23:17:02 +01:00
Merge branch 'master' of https://github.com/ParadiseSS13/Paradise into lavaland_megafauna
# Conflicts: # code/__HELPERS/unsorted.dm # code/_globalvars/lists/objects.dm # code/controllers/verbs.dm # code/game/gamemodes/cult/ritual.dm # code/game/gamemodes/cult/runes.dm # code/game/objects/items/stacks/sheets/sheet_types.dm # code/modules/mob/spirit/mask/mask.dm # code/modules/mob/spirit/viewpoint.dm # icons/effects/96x96.dmi # icons/effects/effects.dmi # icons/mob/actions.dmi # icons/obj/weapons.dmi # icons/obj/wizard.dmi # icons/turf/floors.dmi
This commit is contained in:
@@ -0,0 +1,157 @@
|
||||
var/global/datum/controller/process/mob_hunt/mob_hunt_server
|
||||
|
||||
/datum/controller/process/mob_hunt
|
||||
var/max_normal_spawns = 15 //change this to adjust the number of normal spawns that can exist at one time. trapped spawns (from traitors) don't count towards this
|
||||
var/list/normal_spawns = list()
|
||||
var/max_trap_spawns = 15 //change this to adjust the number of trap spawns that can exist at one time. traps spawned beyond this point clear the oldest traps
|
||||
var/list/trap_spawns = list()
|
||||
var/list/connected_clients = list()
|
||||
var/server_status = 1 //1 is online, 0 is offline
|
||||
var/reset_cooldown = 0 //number of controller cycles before the manual_reboot proc can be used again (ignored if server is offline so you can always boot back up)
|
||||
var/obj/machinery/computer/mob_battle_terminal/red_terminal
|
||||
var/obj/machinery/computer/mob_battle_terminal/blue_terminal
|
||||
var/battle_turn = null
|
||||
|
||||
/datum/controller/process/mob_hunt/setup()
|
||||
name = "Nano-Mob Hunter GO Server"
|
||||
start_delay = 20
|
||||
mob_hunt_server = src
|
||||
|
||||
/datum/controller/process/mob_hunt/doWork()
|
||||
if(reset_cooldown) //if reset_cooldown is set (we are on cooldown, duh), reduce the remaining cooldown every cycle
|
||||
reset_cooldown--
|
||||
if(!server_status)
|
||||
return
|
||||
client_mob_update()
|
||||
if(normal_spawns.len < max_normal_spawns)
|
||||
spawn_mob()
|
||||
|
||||
//leaving this here in case admins want to use it for a random mini-event or something
|
||||
/datum/controller/process/mob_hunt/proc/server_crash(recover_time = 3000)
|
||||
server_status = 0
|
||||
for(var/datum/data/pda/app/mob_hunter_game/client in connected_clients)
|
||||
client.disconnect("Server Crash")
|
||||
for(var/obj/effect/nanomob/N in trap_spawns)
|
||||
N.despawn()
|
||||
for(var/obj/effect/nanomob/N in normal_spawns)
|
||||
N.despawn()
|
||||
//just in case
|
||||
normal_spawns.Cut()
|
||||
trap_spawns.Cut()
|
||||
connected_clients.Cut()
|
||||
if(!isnum(recover_time))
|
||||
recover_time = 3000
|
||||
if(recover_time > 0) //when provided with a negative or zero valued recover_time argument, the server won't auto-restart but can be manually rebooted still
|
||||
//set a timer to automatically recover after recover_time has passed (can be manually restarted if you get impatient too)
|
||||
addtimer(src, "auto_recover", recover_time, TRUE)
|
||||
|
||||
/datum/controller/process/mob_hunt/proc/client_mob_update()
|
||||
var/list/ex_players = list()
|
||||
for(var/datum/data/pda/app/mob_hunter_game/client in connected_clients)
|
||||
var/mob/living/carbon/human/H = client.get_player()
|
||||
if(connected_clients[client])
|
||||
if(!H || H != connected_clients[client])
|
||||
ex_players |= connected_clients[client]
|
||||
connected_clients[client] = H
|
||||
if(ex_players.len) //to make sure we don't do this if we didn't lose any player since the last update
|
||||
for(var/obj/effect/nanomob/N in (normal_spawns + trap_spawns))
|
||||
N.conceal(ex_players)
|
||||
|
||||
/datum/controller/process/mob_hunt/proc/auto_recover()
|
||||
if(server_status != 0)
|
||||
return
|
||||
server_status = 1
|
||||
while(normal_spawns.len < max_normal_spawns) //repopulate the server's spawns completely if we auto-recover from crash
|
||||
spawn_mob()
|
||||
|
||||
/datum/controller/process/mob_hunt/proc/manual_reboot()
|
||||
if(server_status && reset_cooldown)
|
||||
return 0
|
||||
for(var/obj/effect/nanomob/N in trap_spawns)
|
||||
N.despawn()
|
||||
for(var/obj/effect/nanomob/N in normal_spawns)
|
||||
N.despawn()
|
||||
server_status = 1
|
||||
reset_cooldown = 25 //25 controller cycle cooldown for manual restarts
|
||||
return 1
|
||||
|
||||
/datum/controller/process/mob_hunt/proc/spawn_mob()
|
||||
var/list/nanomob_types = subtypesof(/datum/mob_hunt)
|
||||
var/datum/mob_hunt/mob_info = pick(nanomob_types)
|
||||
new mob_info()
|
||||
|
||||
/datum/controller/process/mob_hunt/proc/register_spawn(datum/mob_hunt/mob_info)
|
||||
if(!mob_info)
|
||||
return 0
|
||||
var/obj/effect/nanomob/new_mob = new /obj/effect/nanomob(mob_info.spawn_point, mob_info)
|
||||
normal_spawns += new_mob
|
||||
new_mob.reveal()
|
||||
return 1
|
||||
|
||||
/datum/controller/process/mob_hunt/proc/register_trap(datum/mob_hunt/mob_info)
|
||||
if(!mob_info)
|
||||
return 0
|
||||
if(!mob_info.is_trap)
|
||||
return register_spawn(mob_info)
|
||||
var/obj/effect/nanomob/new_mob = new /obj/effect/nanomob(mob_info.spawn_point, mob_info)
|
||||
trap_spawns += new_mob
|
||||
new_mob.reveal()
|
||||
if(trap_spawns.len > max_trap_spawns)
|
||||
var/obj/effect/nanomob/old_trap = trap_spawns[1]
|
||||
old_trap.despawn()
|
||||
return 1
|
||||
|
||||
/datum/controller/process/mob_hunt/proc/start_check()
|
||||
if(battle_turn) //somehow we got called mid-battle, so lets just stop now
|
||||
return
|
||||
if(red_terminal && red_terminal.ready && blue_terminal && blue_terminal.ready)
|
||||
battle_turn = pick("Red", "Blue")
|
||||
red_terminal.audible_message("Battle starting!", null, 5)
|
||||
blue_terminal.audible_message("Battle starting!", null, 5)
|
||||
if(battle_turn == "Red")
|
||||
red_terminal.audible_message("Red Player's Turn!", null, 5)
|
||||
else if(battle_turn == "Blue")
|
||||
blue_terminal.audible_message("Blue Player's Turn!", null, 5)
|
||||
|
||||
/datum/controller/process/mob_hunt/proc/launch_attack(team, raw_damage, datum/mob_type/attack_type)
|
||||
if(!team || !raw_damage)
|
||||
return
|
||||
var/obj/machinery/computer/mob_battle_terminal/target = null
|
||||
if(team == "Red")
|
||||
target = blue_terminal
|
||||
else if(team == "Blue")
|
||||
target = red_terminal
|
||||
else
|
||||
return
|
||||
target.receive_attack(raw_damage, attack_type)
|
||||
|
||||
/datum/controller/process/mob_hunt/proc/end_battle(loser, surrender = 0)
|
||||
var/obj/machinery/computer/mob_battle_terminal/winner_terminal = null
|
||||
var/obj/machinery/computer/mob_battle_terminal/loser_terminal = null
|
||||
if(loser == "Red")
|
||||
loser_terminal = red_terminal
|
||||
winner_terminal = blue_terminal
|
||||
else if (loser == "Blue")
|
||||
loser_terminal = blue_terminal
|
||||
winner_terminal = red_terminal
|
||||
battle_turn = null
|
||||
winner_terminal.ready = 0
|
||||
loser_terminal.ready = 0
|
||||
if(surrender) //surrender doesn't give exp, to avoid people just farming exp without actually doing a battle
|
||||
winner_terminal.audible_message("Your rival surrendered!", null, 2)
|
||||
else
|
||||
var/progress_message = winner_terminal.mob_info.gain_exp()
|
||||
winner_terminal.audible_message("[winner_terminal.team] Player wins!", null, 5)
|
||||
winner_terminal.audible_message(progress_message, null, 2)
|
||||
|
||||
/datum/controller/process/mob_hunt/proc/end_turn()
|
||||
red_terminal.updateUsrDialog()
|
||||
blue_terminal.updateUsrDialog()
|
||||
if(!battle_turn)
|
||||
return
|
||||
if(battle_turn == "Red")
|
||||
battle_turn = "Blue"
|
||||
blue_terminal.audible_message("Blue's turn.", null, 5)
|
||||
else if(battle_turn == "Blue")
|
||||
battle_turn = "Red"
|
||||
blue_terminal.audible_message("Red's turn.", null, 5)
|
||||
@@ -89,6 +89,8 @@
|
||||
var/overflow_server_url
|
||||
var/forbid_singulo_possession = 0
|
||||
|
||||
var/check_randomizer = 0
|
||||
|
||||
//game_options.txt configs
|
||||
|
||||
var/health_threshold_softcrit = 0
|
||||
@@ -127,6 +129,10 @@
|
||||
var/use_age_restriction_for_jobs = 0 //Do jobs use account age restrictions? --requires database
|
||||
var/use_age_restriction_for_antags = 0 //Do antags use account age restrictions? --requires database
|
||||
|
||||
var/use_exp_tracking = 0
|
||||
var/use_exp_restrictions = 0
|
||||
var/use_exp_restrictions_admin_bypass = 0
|
||||
|
||||
var/simultaneous_pm_warning_timeout = 100
|
||||
|
||||
var/assistant_maint = 0 //Do assistants get maint access?
|
||||
@@ -140,6 +146,7 @@
|
||||
var/main_irc = ""
|
||||
var/admin_irc = ""
|
||||
var/admin_notify_irc = ""
|
||||
var/cidrandomizer_irc = ""
|
||||
var/python_path = "" //Path to the python executable. Defaults to "python" on windows and "/usr/bin/env python2" on unix
|
||||
|
||||
var/default_laws = 0 //Controls what laws the AI spawns with.
|
||||
@@ -240,6 +247,15 @@
|
||||
if("use_age_restriction_for_antags")
|
||||
config.use_age_restriction_for_antags = 1
|
||||
|
||||
if("use_exp_tracking")
|
||||
config.use_exp_tracking = 1
|
||||
|
||||
if("use_exp_restrictions")
|
||||
config.use_exp_restrictions = 1
|
||||
|
||||
if("use_exp_restrictions_admin_bypass")
|
||||
config.use_exp_restrictions_admin_bypass = 1
|
||||
|
||||
if("jobs_have_minimal_access")
|
||||
config.jobs_have_minimal_access = 1
|
||||
|
||||
@@ -405,6 +421,9 @@
|
||||
if("forbid_singulo_possession")
|
||||
forbid_singulo_possession = 1
|
||||
|
||||
if("check_randomizer")
|
||||
check_randomizer = 1
|
||||
|
||||
if("popup_admin_pm")
|
||||
config.popup_admin_pm = 1
|
||||
|
||||
@@ -472,6 +491,9 @@
|
||||
if("admin_notify_irc")
|
||||
config.admin_notify_irc = value
|
||||
|
||||
if("cidrandomizer_irc")
|
||||
config.cidrandomizer_irc = value
|
||||
|
||||
if("python_path")
|
||||
if(value)
|
||||
config.python_path = value
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
message_admins("Admin [key_name_admin(usr)] has restarted the [controller] controller.")
|
||||
return
|
||||
|
||||
|
||||
/client/proc/debug_controller(controller in list("Master","failsafe","Ticker","Air","Lighting","Jobs","Sun","Radio","Configuration","pAI", "Cameras","Garbage", "Transfer Controller","Event","Alarm","Scheduler","Nano","Vote","Diseases","Fires","Mob","NPC AI","Shuttle","Timer","Weather","Space"))
|
||||
/client/proc/debug_controller(controller in list("Master","failsafe","Ticker","Air","Lighting","Jobs","Sun","Radio","Configuration","pAI", "Cameras","Garbage", "Transfer Controller","Event","Alarm","Scheduler","Nano","Vote","Diseases","Fires","Mob","NPC AI","Shuttle","Timer","Weather","Space","Mob Hunt Server"))
|
||||
set category = "Debug"
|
||||
set name = "Debug Controller"
|
||||
set desc = "Debug the various periodic loop controllers for the game (be careful!)"
|
||||
@@ -100,6 +99,9 @@
|
||||
if("Space")
|
||||
debug_variables(space_manager)
|
||||
feedback_add_details("admin_verb","DSpace")
|
||||
if("Mob Hunt Server")
|
||||
debug_variables(mob_hunt_server)
|
||||
feedback_add_details("admin_verb","DMobHuntServer")
|
||||
|
||||
message_admins("Admin [key_name_admin(usr)] is debugging the [controller] controller.")
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user