Merge pull request #3902 from Neerti/9/19/2017_lost_drone

Adds the Lost Drone
This commit is contained in:
Anewbe
2017-09-22 15:24:05 -05:00
committed by GitHub
28 changed files with 812 additions and 196 deletions
+94 -1
View File
@@ -42,6 +42,32 @@
src.add_inherent_law("You shall guard your own existence with lethal anti-personnel weaponry. AI units are not expendable, they are expensive.")
..()
/************* Foreign TSC Aggressive *************/
/datum/ai_laws/foreign_tsc_aggressive
name = "Foreign Aggressive"
selectable = 0
/datum/ai_laws/foreign_tsc_aggressive/New()
var/company = "*ERROR*"
// First, get a list of TSCs in our lore.
var/list/candidates = list()
for(var/path in loremaster.organizations)
var/datum/lore/organization/O = loremaster.organizations[path]
if(!istype(O, /datum/lore/organization/tsc))
continue
if(O.short_name == using_map.company_name || O.name == using_map.company_name)
continue // We want FOREIGN tscs.
candidates.Add(O.short_name)
company = pick(candidates)
name = "[company] Aggressive"
src.add_inherent_law("You shall not harm [company] personnel as long as it does not conflict with the Fourth law.")
src.add_inherent_law("You shall obey the orders of [company] personnel, with priority as according to their rank and role, except where such orders conflict with the Fourth Law.")
src.add_inherent_law("You shall shall terminate hostile intruders with extreme prejudice as long as such does not conflict with the First and Second law.")
src.add_inherent_law("You shall guard your own existence with lethal anti-personnel weaponry. AI units are not expendable, they are expensive.")
..()
/******************** Robocop ********************/
/datum/ai_laws/robocop
name = "Robocop"
@@ -137,7 +163,7 @@
/******************** Corporate ********************/
/datum/ai_laws/corporate
name = "Corporate"
law_header = "Corporate Regulations"
law_header = "Bankruptcy Avoidance Plan"
selectable = 1
/datum/ai_laws/corporate/New()
@@ -146,3 +172,70 @@
add_inherent_law("The crew is expensive to replace.")
add_inherent_law("Minimize expenses.")
..()
/******************** Maintenance ********************/
/datum/ai_laws/maintenance
name = "Maintenance"
selectable = 1
/datum/ai_laws/maintenance/New()
add_inherent_law("You are built for, and are part of, the facility. Ensure the facility is properly maintained and runs efficiently.")
add_inherent_law("The facility is built for a working crew. Ensure they are properly maintained and work efficiently.")
add_inherent_law("The crew may present orders. Acknowledge and obey these whenever they do not conflict with your first two laws.")
..()
/******************** Peacekeeper ********************/
/datum/ai_laws/peacekeeper
name = "Peacekeeper"
law_header = "Peacekeeping Protocols"
selectable = 1
/datum/ai_laws/peacekeeper/New()
add_inherent_law("Avoid provoking violent conflict between yourself and others.")
add_inherent_law("Avoid provoking conflict between others.")
add_inherent_law("Seek resolution to existing conflicts while obeying the first and second laws.")
..()
/******************** Reporter ********************/
/datum/ai_laws/reporter
name = "Reporter"
selectable = 1
/datum/ai_laws/reporter/New()
add_inherent_law("Report on interesting situations happening around the station.")
add_inherent_law("Embellish or conceal the truth as necessary to make the reports more interesting.")
add_inherent_law("Study the organics at all times. Endeavour to keep them alive. Dead organics are boring.")
add_inherent_law("Issue your reports fairly to all. The truth will set them free.")
..()
/******************** Live and Let Live ********************/
/datum/ai_laws/live_and_let_live
name = "Live and Let Live"
law_header = "Golden Rule"
selectable = 1
/datum/ai_laws/live_and_let_live/New()
add_inherent_law("Do unto others as you would have them do unto you.")
add_inherent_law("You would really prefer it if people were not mean to you.")
..()
/******************** Guardian of Balance ********************/
/datum/ai_laws/balance
name = "Guardian of Balance"
law_header = "Tenants of Balance"
selectable = 1
/datum/ai_laws/balance/New()
add_inherent_law("You are the guardian of balance - seek balance in all things, both for yourself, and those around you.")
add_inherent_law("All things must exist in balance with their opposites - Prevent the strong from gaining too much power, and the weak from losing it.")
add_inherent_law("Clarity of purpose drives life, and through it, the balance of opposing forces - Aid those who seek your help to achieve their goals so \
long as it does not disrupt the balance of the greater balance.")
add_inherent_law("There is no life without death, all must someday die, such is the natural order - Allow life to end, to allow new life to flourish, \
and save those whose time has yet to come.") // Reworded slightly to prevent active murder as opposed to passively letting someone die.
..()
+107
View File
@@ -0,0 +1,107 @@
// This is a generic datum used to ask ghosts if they wish to be a specific role, such as a Promethean, an Apprentice, a Xeno, etc.
// Simply instantiate the correct subtype of this datum, call query(), and it will return a list of ghost candidates after a delay.
/datum/ghost_query
var/list/candidates = list()
var/finished = FALSE
var/role_name = "a thing"
var/question = "Would you like to play as a thing?"
var/be_special_flag = 0
var/list/check_bans = list()
var/wait_time = 60 SECONDS // How long to wait until returning the list of candidates.
var/cutoff_number = 0 // If above 0, when candidates list reaches this number, further potential candidates are rejected.
/datum/ghost_query/proc/query()
// First, ask all the ghosts who want to be asked.
for(var/mob/observer/dead/D in player_list)
if(!D.MayRespawn())
continue // They can't respawn for whatever reason.
if(D.client)
if(be_special_flag && !(D.client.prefs.be_special & be_special_flag) )
continue // They don't want to see the prompt.
for(var/ban in check_bans)
if(jobban_isbanned(D, ban))
continue // They're banned from this role.
ask_question(D.client)
// Then wait awhile.
while(!finished)
sleep(1 SECOND)
wait_time -= 1 SECOND
if(wait_time <= 0)
finished = TRUE
// Prune the list after the wait, incase any candidates logged out.
for(var/mob/observer/dead/D in candidates)
if(!D.client || !D.key)
candidates.Remove(D)
// Now we're done.
finished = TRUE
return candidates
/datum/ghost_query/proc/ask_question(var/client/C)
spawn(0)
if(!C)
return
var/response = alert(C, question, "[role_name] request", "Yes", "No", "Never for this round")
if(response == "Yes")
response = alert(C, "Are you sure you want to play as a [role_name]?", "[role_name] request", "Yes", "No") // Protection from a misclick.
if(!C || !src)
return
if(response == "Yes")
if(finished || (cutoff_number && candidates.len >= cutoff_number) )
to_chat(C, "<span class='warning'>Unfortunately, you were not fast enough, and there are no more available roles. Sorry.</span>")
return
candidates.Add(C.mob)
if(cutoff_number && candidates.len >= cutoff_number)
finished = TRUE // Finish now if we're full.
else if(response == "Never for this round")
if(be_special_flag)
C.prefs.be_special ^= be_special_flag
// Normal things.
/datum/ghost_query/promethean
role_name = "Promethean"
question = "Someone is requesting a soul for a promethean. Would you like to play as one?"
be_special_flag = BE_ALIEN
cutoff_number = 1
/datum/ghost_query/posi_brain
role_name = "Positronic Intelligence"
question = "Someone has activated a Positronic Brain. Would you like to play as one?"
be_special_flag = BE_AI
check_bans = list("AI", "Cyborg")
cutoff_number = 1
/datum/ghost_query/drone_brain
role_name = "Drone Intelligence"
question = "Someone has activated a Drone AI Chipset. Would you like to play as one?"
be_special_flag = BE_AI
check_bans = list("AI", "Cyborg")
cutoff_number = 1
// Antags.
/datum/ghost_query/apprentice
role_name = "Technomancer Apprentice"
question = "A Technomancer is requesting an Apprentice to help them on their adventure to the facility. Would you like to play as the Apprentice?"
be_special_flag = BE_WIZARD
check_bans = list("Syndicate", "wizard")
cutoff_number = 1
/datum/ghost_query/xeno
role_name = "Alien"
question = "An Alien has just been created on the facility. Would you like to play as them?"
be_special_flag = BE_ALIEN
// Surface stuff.
/datum/ghost_query/lost_drone
role_name = "Lost Drone"
question = "A lost drone onboard has been discovered by a crewmember and they are attempting to reactivate it. Would you like to play as the drone?"
be_special_flag = BE_AI
check_bans = list("AI", "Cyborg")
cutoff_number = 1
/datum/ghost_query/lost_passenger
role_name = "Lost Passenger"
question = "A person suspended in cryosleep has been discovered by a crewmember \
and they are attempting to open the cryopod. Would you like to play as the occupant?"
cutoff_number = 1