mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-29 07:59:01 +01:00
Antag Contest Update (#1029)
Fixes #881 Contest: Fix assigning of self Fix objective hoarding Preferences Helpers So we have an easier way of keeping track who's represented where and how. Add aggressive objectives and remove passive ones.
This commit is contained in:
@@ -23,3 +23,22 @@
|
||||
return list(TCD, "Tup Commandos Division")
|
||||
else
|
||||
return list(INDEP, "Independent")
|
||||
|
||||
// Helper vars for the datum class. Not for use outside of this module!
|
||||
/datum/preferences/var/antag_contest_faction = null
|
||||
/datum/preferences/var/antag_contest_side = null
|
||||
|
||||
/datum/preferences/proc/load_character_contest(slot)
|
||||
if (config.antag_contest_enabled && config.sql_enabled && establish_db_connection(dbcon))
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT contest_faction FROM ss13_contest_participants WHERE character_id = :char_id")
|
||||
query.Execute(list(":char_id" = slot))
|
||||
|
||||
if (query.NextRow())
|
||||
antag_contest_faction = text2num(query.item[1])
|
||||
|
||||
if (antag_contest_faction in contest_factions_prosynth)
|
||||
antag_contest_side = PRO_SYNTH
|
||||
else if (antag_contest_faction in contest_factions_antisynth)
|
||||
antag_contest_side = ANTI_SYNTH
|
||||
else
|
||||
antag_contest_side = 0
|
||||
|
||||
@@ -69,6 +69,18 @@
|
||||
if (log_query.ErrorMsg())
|
||||
log_debug("CONTEST: Error uploading results. Datadump: [list2params(params)]")
|
||||
|
||||
/*
|
||||
* One flippy objective.
|
||||
*/
|
||||
/datum/objective/competition/assassinate_supporter/find_target()
|
||||
var/list/possible_targets = list()
|
||||
for(var/datum/mind/possible_target in ticker.minds)
|
||||
if(possible_target != owner && ishuman(possible_target.current) && (possible_target.current.stat != 2))
|
||||
if (possible_target.current.client && possible_target.current.client.prefs && possible_target.current.client.prefs.antag_contest_side != side)
|
||||
possible_targets += possible_target
|
||||
if(possible_targets.len > 0)
|
||||
target = pick(possible_targets)
|
||||
|
||||
/*
|
||||
* Pro-synth objectives
|
||||
*/
|
||||
|
||||
@@ -88,6 +88,16 @@
|
||||
src << "<span class='warning'>You do not have a valid role! You must be a traitor, mercenary, or a raider for these to be usable! Contact an admin if you need assignment.</span>"
|
||||
return
|
||||
|
||||
if (src.mob.mind.objectives.len >= 3)
|
||||
var/uncompleted_objectives = 0
|
||||
for (var/datum/objective/O in src.mob.mind.objectives)
|
||||
if (!O.completed)
|
||||
uncompleted_objectives++
|
||||
|
||||
if (uncompleted_objectives >= 3)
|
||||
src << span("warning", "You have [uncompleted_objectives] uncompleted objectives underway right now. Please finish them before requesting new ones.")
|
||||
return
|
||||
|
||||
if (!establish_db_connection(dbcon))
|
||||
src << "<span class='warning'>Failed to establish SQL connection! Contact a member of staff!</span>"
|
||||
return
|
||||
@@ -105,15 +115,15 @@
|
||||
var/list/faction_data = contest_faction_data(part_check.item[1])
|
||||
|
||||
if (side == "Pro-synth")
|
||||
if (faction_data[1] in contest_factions_antisynth && alert("This choice goes against your faction's current allegience.\nDo you wish to continue?", "Yes", "No") == "No")
|
||||
if (faction_data[1] in contest_factions_antisynth && alert("This choice goes against your faction's current allegience.\nDo you wish to continue?", "Decisions", "Yes", "No") == "No")
|
||||
return
|
||||
|
||||
available_objs = list("Promote a Synth", "Protect Robotics", "Borgify", "Protect a Synth", "Unslave Borgs")
|
||||
available_objs = list("Assassinate Anti-Synth Supporter", "Promote a Synth", "Borgify", "Unslave Borgs")
|
||||
else
|
||||
if (faction_data[1] in contest_factions_prosynth && alert("This choice goes against your faction's current allegience.\nDo you wish to continue?", "Yes", "No") == "No")
|
||||
if (faction_data[1] in contest_factions_prosynth && alert("This choice goes against your faction's current allegience.\nDo you wish to continue?", "Decisions", "Yes", "No") == "No")
|
||||
return
|
||||
|
||||
available_objs = list("Sabotage Robotics", "Fire a Synth", "Brig a Synth", "Harm a Synth")
|
||||
available_objs = list("Assassinate Pro-Synth Supporter", "Sabotage Robotics", "Fire a Synth", "Brig a Synth", "Harm a Synth")
|
||||
|
||||
if (!available_objs)
|
||||
src << "<span class='warning'>No objectives were found for you! This is odd!</span>"
|
||||
@@ -125,22 +135,39 @@
|
||||
src << "<span class='warning'>Cancelled.</span>"
|
||||
return
|
||||
|
||||
var/datum/objective/new_objective
|
||||
var/datum/objective/competition/new_objective
|
||||
var/failed_target = 0
|
||||
|
||||
switch (choice)
|
||||
if ("Assassinate Pro-Synth Supporter")
|
||||
new_objective = new /datum/objective/competition/assassinate_supporter
|
||||
new_objective.side = ANTI_SYNTH
|
||||
new_objective.type_name = "anti_synth/assassin"
|
||||
new_objective.owner = src.mob.mind
|
||||
if (!new_objective.find_target())
|
||||
failed_target = 1
|
||||
if ("Assassinate Anti-Synth Supporter")
|
||||
new_objective = new /datum/objective/competition/assassinate_supporter
|
||||
new_objective.side = PRO_SYNTH
|
||||
new_objective.type_name = "pro_synth/assassin"
|
||||
new_objective.owner = src.mob.mind
|
||||
if (!new_objective.find_target())
|
||||
failed_target = 1
|
||||
if ("Promote a Synth")
|
||||
new_objective = new /datum/objective/competition/pro_synth/promote
|
||||
new_objective.owner = src.mob.mind
|
||||
if (!new_objective.find_target())
|
||||
failed_target = 1
|
||||
if ("Protect Robotics")
|
||||
new_objective = new /datum/objective/competition/pro_synth/protect_robotics
|
||||
if ("Borgify")
|
||||
new_objective = new /datum/objective/competition/pro_synth/borgify
|
||||
new_objective.owner = src.mob.mind
|
||||
if (!new_objective.find_target())
|
||||
failed_target = 1
|
||||
if ("Protect a Synth")
|
||||
new_objective = new /datum/objective/competition/pro_synth/protect
|
||||
new_objective.owner = src.mob.mind
|
||||
if (!new_objective.find_target())
|
||||
failed_target = 1
|
||||
if ("Unslave Borgs")
|
||||
@@ -161,14 +188,17 @@
|
||||
new_objective = new /datum/objective/competition/anti_synth/sabotage
|
||||
if ("Fire a Synth")
|
||||
new_objective = new /datum/objective/competition/anti_synth/demote
|
||||
new_objective.owner = src.mob.mind
|
||||
if (!new_objective.find_target())
|
||||
failed_target = 1
|
||||
if ("Brig a Synth")
|
||||
new_objective = new /datum/objective/competition/anti_synth/brig
|
||||
new_objective.owner = src.mob.mind
|
||||
if (!new_objective.find_target())
|
||||
failed_target = 1
|
||||
if ("Harm a Synth")
|
||||
new_objective = new /datum/objective/competition/anti_synth/harm
|
||||
new_objective.owner = src.mob.mind
|
||||
if (!new_objective.find_target())
|
||||
failed_target = 1
|
||||
else
|
||||
@@ -181,7 +211,8 @@
|
||||
qdel(new_objective)
|
||||
return
|
||||
|
||||
new_objective.owner = src.mob.mind
|
||||
if (!new_objective.owner)
|
||||
new_objective.owner = src.mob.mind
|
||||
src.mob.mind.objectives += new_objective
|
||||
src << "<span class='notice'>New objective assigned! Have fun, and roleplay well!</span>"
|
||||
log_admin("CONTEST: [key_name(src)] has assigned themselves an objective: [new_objective.type].")
|
||||
|
||||
@@ -167,7 +167,6 @@
|
||||
|
||||
if ("logie")
|
||||
if (config.sql_stats && href_list["ie_data"])
|
||||
testing("Data recovered: [href_list["ie_data"]]")
|
||||
var/list/data = json_decode(href_list["ie_data"])
|
||||
data["_ckey"] = src.ckey
|
||||
if (data.len != 7)
|
||||
|
||||
@@ -406,6 +406,8 @@
|
||||
if (!faction) faction = "None"
|
||||
if (!religion) religion = "None"
|
||||
|
||||
load_character_contest(slot)
|
||||
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/save_character_sql(var/client/C)
|
||||
|
||||
Reference in New Issue
Block a user