Fixes several midround antag assignments not asking ghosts first

This commit is contained in:
Tastyfish
2016-03-07 03:03:45 -05:00
parent 422a2e6ed4
commit 0e0225b1ee
20 changed files with 291 additions and 348 deletions
@@ -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)
@@ -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)