Merge pull request #3780 from Tastyfish/democracy

Fixes several midround antag/creature assignments not asking ghosts first
This commit is contained in:
Fox McCloud
2016-03-08 13:28:43 -05:00
20 changed files with 293 additions and 348 deletions

View File

@@ -21,16 +21,17 @@
if(temp_vent.parent.other_atmosmch.len > 50) //Stops Aliens getting stuck in small networks. See: Security, Virology
vents += temp_vent
var/list/candidates = get_candidates(ROLE_ALIEN,ALIEN_AFK_BRACKET)
spawn()
var/list/candidates = pollCandidates("Do you want to play as an alien?", ROLE_ALIEN, 1)
while(spawncount > 0 && vents.len && candidates.len)
var/obj/vent = pick_n_take(vents)
var/client/C = pick_n_take(candidates)
if(C)
respawnable_list -= C
var/mob/living/carbon/alien/larva/new_xeno = new(vent.loc)
new_xeno.key = C.key
while(spawncount > 0 && vents.len && candidates.len)
var/obj/vent = pick_n_take(vents)
var/mob/C = pick_n_take(candidates)
if(C)
respawnable_list -= C.client
var/mob/living/carbon/alien/larva/new_xeno = new(vent.loc)
new_xeno.key = C.key
spawncount--
successSpawn = 1
spawncount--
successSpawn = 1

View File

@@ -2,56 +2,44 @@
var/key_of_slaughter
/datum/event/spawn_slaughter/proc/get_slaughter(var/end_if_fail = 0)
key_of_slaughter = null
if(!key_of_slaughter)
var/list/candidates = get_candidates(ROLE_DEMON)
spawn()
var/list/candidates = pollCandidates("Do you want to play as a slaughter demon?", ROLE_DEMON, 1)
if(!candidates.len)
if(end_if_fail)
return 0
return find_slaughter()
var/client/C = pick(candidates)
key_of_slaughter = null
return kill()
var/mob/C = pick(candidates)
key_of_slaughter = C.key
if(!key_of_slaughter)
if(end_if_fail)
return 0
return find_slaughter()
var/datum/mind/player_mind = new /datum/mind(key_of_slaughter)
player_mind.active = 1
var/list/spawn_locs = list()
for(var/obj/effect/landmark/L in landmarks_list)
if(isturf(L.loc))
switch(L.name)
if("revenantspawn")
spawn_locs += L.loc
if(!spawn_locs) //If we can't find any revenant spawns, try the carp spawns
if(!key_of_slaughter)
return kill()
var/datum/mind/player_mind = new /datum/mind(key_of_slaughter)
player_mind.active = 1
var/list/spawn_locs = list()
for(var/obj/effect/landmark/L in landmarks_list)
if(isturf(L.loc))
switch(L.name)
if("carpspawn")
if("revenantspawn")
spawn_locs += L.loc
if(!spawn_locs) //If we can't find either, just spawn the revenant at the player's location
spawn_locs += get_turf(player_mind.current)
if(!spawn_locs) //If we can't find THAT, then just retry
return find_slaughter()
var /obj/effect/dummy/slaughter/holder = new /obj/effect/dummy/slaughter(pick(spawn_locs))
var/mob/living/simple_animal/slaughter/S = new /mob/living/simple_animal/slaughter/(holder)
S.holder = holder
player_mind.transfer_to(S)
player_mind.assigned_role = "Slaughter Demon"
player_mind.special_role = "Slaughter Demon"
message_admins("[key_of_slaughter] has been made into a Slaughter Demon by an event.")
log_game("[key_of_slaughter] was spawned as a Slaughter Demon by an event.")
return 1
if(!spawn_locs) //If we can't find any revenant spawns, try the carp spawns
for(var/obj/effect/landmark/L in landmarks_list)
if(isturf(L.loc))
switch(L.name)
if("carpspawn")
spawn_locs += L.loc
if(!spawn_locs) //If we can't find either, just spawn the revenant at the player's location
spawn_locs += get_turf(player_mind.current)
if(!spawn_locs) //If we can't find THAT, then just retry
return kill()
var /obj/effect/dummy/slaughter/holder = new /obj/effect/dummy/slaughter(pick(spawn_locs))
var/mob/living/simple_animal/slaughter/S = new /mob/living/simple_animal/slaughter/(holder)
S.holder = holder
player_mind.transfer_to(S)
player_mind.assigned_role = "Slaughter Demon"
player_mind.special_role = "Slaughter Demon"
message_admins("[key_of_slaughter] has been made into a Slaughter Demon by an event.")
log_game("[key_of_slaughter] was spawned as a Slaughter Demon by an event.")
return 1
/datum/event/spawn_slaughter/start()
get_slaughter()
/datum/event/spawn_slaughter/proc/find_slaughter()
message_admins("Attempted to spawn a Slaughter Demon but there was no players available. Will try again momentarily.")
spawn(50)
if(get_slaughter(1))
message_admins("Situation has been resolved, [key_of_slaughter] has been spawned as a Slaughter Demon.")
log_game("[key_of_slaughter] was spawned as a Slaughter Demon by an event.")
return 0
message_admins("Unfortunately, no candidates were available for becoming a Slaugter Demon. Shutting down.")
kill()
get_slaughter()

View File

@@ -1,14 +1,13 @@
// This is to replace the previous datum/disease/alien_embryo for slightly improved handling and maintainability
// It functions almost identically (see code/datums/diseases/alien_embryo.dm)
var/const/ALIEN_AFK_BRACKET = 450 // 45 seconds
/obj/item/organ/internal/body_egg/alien_embryo
name = "alien embryo"
desc = "All slimy and yuck."
icon = 'icons/mob/alien.dmi'
icon_state = "larva0_dead"
var/mob/living/affected_mob
var/stage = 0
var/growing = 0
/obj/item/organ/internal/body_egg/alien_embryo/on_find(mob/living/finder)
..()
@@ -53,63 +52,55 @@ var/const/ALIEN_AFK_BRACKET = 450 // 45 seconds
owner.adjustToxLoss(10)
/obj/item/organ/internal/body_egg/alien_embryo/egg_process()
if(!affected_mob) return
if(loc != affected_mob)
affected_mob.status_flags &= ~(XENO_HOST)
if(istype(affected_mob,/mob/living/carbon))
var/mob/living/carbon/H = affected_mob
H.med_hud_set_status()
processing_objects.Remove(src)
spawn(0)
RemoveInfectionImages(affected_mob)
affected_mob = null
return
if(stage < 5 && prob(3))
stage++
spawn(0)
RefreshInfectionImage()
if(stage == 5 && prob(50))
AttemptGrow()
/obj/item/organ/internal/body_egg/alien_embryo/proc/AttemptGrow(var/gib_on_success = 1)
var/list/candidates = get_candidates(ROLE_ALIEN,ALIEN_AFK_BRACKET,1)
var/client/C = null
// To stop clientless larva, we will check that our host has a client
// if we find no ghosts to become the alien. If the host has a client
// he will become the alien but if he doesn't then we will set the stage
// to 2, so we don't do a process heavy check everytime.
if(candidates.len)
C = pick(candidates)
else if(affected_mob.client)
C = affected_mob.client
else
stage = 4 // Let's try again later.
if(growing)
return
growing = 1
if(affected_mob.lying)
affected_mob.overlays += image('icons/mob/alien.dmi', loc = affected_mob, icon_state = "burst_lie")
else
affected_mob.overlays += image('icons/mob/alien.dmi', loc = affected_mob, icon_state = "burst_stand")
spawn(6)
var/mob/living/carbon/alien/larva/new_xeno = new(affected_mob.loc)
new_xeno.key = C.key
if(ticker && ticker.mode)
ticker.mode.xenos += new_xeno.mind
new_xeno.mind.name = new_xeno.name
new_xeno.mind.assigned_role = "MODE"
new_xeno.mind.special_role = "Alien"
new_xeno << sound('sound/voice/hiss5.ogg',0,0,0,100) //To get the player's attention
if(gib_on_success)
affected_mob.gib()
if(istype(new_xeno.loc,/mob/living/carbon))
var/mob/living/carbon/digester = new_xeno.loc
digester.stomach_contents += new_xeno
qdel(src)
spawn()
var/list/candidates = pollCandidates("Do you want to play as an alien?", ROLE_ALIEN, 0)
var/mob/C = null
// To stop clientless larva, we will check that our host has a client
// if we find no ghosts to become the alien. If the host has a client
// he will become the alien but if he doesn't then we will set the stage
// to 2, so we don't do a process heavy check everytime.
if(candidates.len)
C = pick(candidates)
else if(owner.client)
C = owner
else
stage = 4 // Let's try again later.
return
if(owner.lying)
owner.overlays += image('icons/mob/alien.dmi', loc = owner, icon_state = "burst_lie")
else
owner.overlays += image('icons/mob/alien.dmi', loc = owner, icon_state = "burst_stand")
spawn(6)
var/mob/living/carbon/alien/larva/new_xeno = new(owner.loc)
new_xeno.key = C.key
if(ticker && ticker.mode)
ticker.mode.xenos += new_xeno.mind
new_xeno.mind.name = new_xeno.name
new_xeno.mind.assigned_role = "MODE"
new_xeno.mind.special_role = "Alien"
new_xeno << sound('sound/voice/hiss5.ogg',0,0,0,100) //To get the player's attention
if(gib_on_success)
owner.gib()
if(istype(new_xeno.loc,/mob/living/carbon))
var/mob/living/carbon/digester = new_xeno.loc
digester.stomach_contents += new_xeno
qdel(src)
/*----------------------------------------
Proc: RefreshInfectionImage()
@@ -126,7 +117,7 @@ Des: Adds the infection image to all aliens for this embryo
/obj/item/organ/internal/body_egg/alien_embryo/AddInfectionImages()
for(var/mob/living/carbon/alien/alien in player_list)
if(alien.client)
var/I = image('icons/mob/alien.dmi', loc = affected_mob, icon_state = "infected[stage]")
var/I = image('icons/mob/alien.dmi', loc = owner, icon_state = "infected[stage]")
alien.client.images += I
/*----------------------------------------
@@ -137,5 +128,5 @@ Des: Removes all images from the mob infected by this embryo
for(var/mob/living/carbon/alien/alien in player_list)
if(alien.client)
for(var/image/I in alien.client.images)
if(dd_hasprefix_case(I.icon_state, "infected") && I.loc == affected_mob)
if(dd_hasprefix_case(I.icon_state, "infected") && I.loc == owner)
qdel(I)

View File

@@ -1355,7 +1355,7 @@ var/list/robot_verbs_default = list(
if(isnull(ckey) && !searching_for_ckey)
searching_for_ckey = 1
user << "<span class='notice'>Now checking for possible borgs.</span>"
var/list/borg_candidates = pollCandidates("Do you want to play as a Nanotrasen Combat borg?", poll_time = 300)
var/list/borg_candidates = pollCandidates("Do you want to play as a Nanotrasen Combat borg?")
if(borg_candidates.len > 0 && isnull(ckey))
searching_for_ckey = 0
var/mob/M = pick(borg_candidates)

View File

@@ -215,39 +215,13 @@
user << "<span class='notice'>You offer the sentience potion to [M]...</span>"
being_used = 1
var/list/candidates = get_candidates(ROLE_SENTIENT, ALIEN_AFK_BRACKET)
shuffle(candidates)
var/time_passed = world.time
var/list/consenting_candidates = list()
for(var/candidate in candidates)
if(candidate in not_interested)
continue
spawn(0)
switch(alert(candidate, "Would you like to play as [M.name]? Please choose quickly!","Confirmation","Yes","No"))
if("Yes")
if((world.time-time_passed)>=50 || !src)
return
consenting_candidates += candidate
if("No")
if(!src)
return
not_interested += candidate
sleep(50)
var/list/candidates = pollCandidates("Do you want to play as [M.name]?", ROLE_SENTIENT, 0, 100)
if(!src)
return
listclearnulls(consenting_candidates) //some candidates might have left during sleep(50)
if(consenting_candidates.len)
var/client/C = null
C = pick(consenting_candidates)
if(candidates.len)
var/mob/C = pick(candidates)
M.key = C.key
M.universal_speak = 1
M.faction |= "sentient"