More work on refactor.

This commit is contained in:
Rob Nelson
2014-11-08 11:14:23 -08:00
parent 7785bd7050
commit 3c551d5acd
12 changed files with 84 additions and 40 deletions

View File

@@ -331,35 +331,41 @@ var/list/DummyCache = list()
DummyCache.Add(D)
return 1
// Comment out when done testing shit.
#define DEBUG_ROLESELECT
#ifdef DEBUG_ROLESELECT
# define roleselect_debug(x) testing(x)
# warning DEBUG_ROLESELECT is defined!
#else
# define roleselect_debug(x)
#endif
// Will return a list of active candidates. It increases the buffer 5 times until it finds a candidate which is active within the buffer.
/proc/get_active_candidates(var/buffer = 1)
var/list/candidates = list() //List of candidate KEYS to assume control of the new larva ~Carn
/proc/get_active_candidates(var/role_id=null, var/buffer=ROLE_SELECT_AFK_BUFFER, var/poll=0)
var/list/candidates = list() //List of candidate mobs to assume control of the new larva ~fuck you
var/i = 0
while(candidates.len <= 0 && i < 5)
roleselect_debug("get_active_candidates(role_id=[role_id], buffer=[buffer], poll=[poll]): Player list is [player_list.len] items long.")
for(var/mob/dead/observer/G in player_list)
if(((G.client.inactivity/10)/60) <= buffer + i) // the most active players are more likely to become an alien
if(!(G.mind && G.mind.current && G.mind.current.stat != DEAD))
candidates += G.key
if(!G.mind || (G.mind.current && G.mind.current.stat != DEAD))
roleselect_debug("get_active_candidates(role_id=[role_id], buffer=[buffer], poll=[poll]): Skipping [G] - Shitty candidate.")
continue
if(!G.client.desires_role(role_id,display_to_user=(poll && i==0))) // Only ask once.
roleselect_debug("get_active_candidates(role_id=[role_id], buffer=[buffer], poll=[poll]): Skipping [G] - Doesn't want role.")
continue
if(((G.client.inactivity/10)/60) > buffer + i) // the most active players are more likely to become an alien
roleselect_debug("get_active_candidates(role_id=[role_id], buffer=[buffer], poll=[poll]): Skipping [G] - Inactive.")
continue
roleselect_debug("get_active_candidates(role_id=[role_id], buffer=[buffer], poll=[poll]): Selected [G] as candidate.")
candidates += G
i++
return candidates
// Same as above but for alien candidates.
/proc/get_alien_candidates(var/role_id=ROLE_ALIEN)
var/list/candidates = list() //List of candidate KEYS to assume control of the new larva ~Carn
var/i = 0
while(candidates.len <= 0 && i < 5)
for(var/mob/dead/observer/G in player_list)
if(G.client.desires_role(role_id))
if(((G.client.inactivity/10)/60) <= ALIEN_SELECT_AFK_BUFFER + i) // the most active players are more likely to become an alien
if(!(G.mind && G.mind.current && G.mind.current.stat != DEAD))
candidates += G.key
i++
return candidates
/proc/get_candidates(role_id=null)
/proc/get_candidates(var/role_id=null)
. = list()
for(var/mob/dead/observer/G in player_list)
if(!(G.mind && G.mind.current && G.mind.current.stat != DEAD))

View File

@@ -189,7 +189,7 @@
if(temp_vent.network.normal_members.len > 50) // Stops Aliens getting stuck in small networks. See: Security, Virology
vents += temp_vent
var/list/candidates = get_alien_candidates()
var/list/candidates = get_active_candidates(ROLE_ALIEN,buffer=ALIEN_SELECT_AFK_BUFFER, poll=1)
if(prob(40)) spawncount++ //sometimes, have two larvae spawn instead of one
while((spawncount >= 1) && vents.len && candidates.len)

View File

@@ -321,5 +321,5 @@
/client/proc/desires_role(var/role_id, var/display_to_user=0)
var/role_desired = prefs.roles[role_id]
if(display_to_user)
src << "<span style='sinister'>The game is currently looking for [role_id] candidates. Your current answer is <a href='?src=\ref[prefs]&reset_role_pref=[role_id]'>[get_role_desire_str(role_desired)]</a>.</span>"
src << "<span style='recruit'>The game is currently looking for [role_id] candidates. Your current answer is <a href='?src=\ref[prefs]&reset_role_pref=[role_id]'>[get_role_desire_str(role_desired)]</a>.</span>"
return role_desired & ROLEPREF_ENABLE

View File

@@ -686,7 +686,7 @@ var/const/MAX_SAVE_SLOTS = 8
if(!(role_id in href_list))
user << "<span class='danger'>BUG: Unable to find role [role_id].</span>"
continue
var/oldval=roles[role_id]
var/oldval=text2num(roles[role_id])
roles[role_id] = text2num(href_list[role_id])
if(oldval!=roles[role_id])
user << "<span class='info'>Set role [role_id] to [get_role_desire_str(user.client.prefs.roles[role_id])]!</span>"

View File

@@ -27,14 +27,14 @@
if(temp_vent.network.normal_members.len > 50) //Stops Aliens getting stuck in small networks. See: Security, Virology
vents += temp_vent
var/list/candidates = get_alien_candidates()
var/list/candidates = get_active_candidates(ROLE_ALIEN, buffer=ALIEN_SELECT_AFK_BUFFER, poll=1)
while(spawncount > 0 && vents.len && candidates.len)
var/obj/vent = pick(vents)
var/candidate = pick(candidates)
var/mob/candidate = pick(candidates)
var/mob/living/carbon/alien/larva/new_xeno = new(vent.loc)
new_xeno.key = candidate
new_xeno.key = candidate.key
candidates -= candidate
vents -= vent

View File

@@ -123,7 +123,7 @@
continue
break
if(!ghostpicked || !istype(ghostpicked))
var/list/candidates = get_alien_candidates()
var/list/candidates = get_active_candidates(ROLE_ALIEN, buffer=ALIEN_SELECT_AFK_BUFFER, poll=1)
if(!candidates.len)
picked = affected_mob.key
else

View File

@@ -56,7 +56,7 @@
var/mob/living/simple_animal/borer/borer = target.has_brain_worms()
if(borer)
borer.detatch() //Should remove borer if the brain is removed - RR
borer.detach() //Should remove borer if the brain is removed - RR
var/mob/living/carbon/human/H = target
var/obj/item/organ/brain/B = src

View File

@@ -571,7 +571,7 @@
H << "\red <B>With an immense exertion of will, you regain control of your body!</B>"
B.host << "\red <B>You feel control of the host brain ripped from your grasp, and retract your probosci before the wild neural impulses can damage you.</b>"
B.detatch()
B.detach()
verbs -= /mob/living/carbon/proc/release_control
verbs -= /mob/living/carbon/proc/punish_host

View File

@@ -68,8 +68,8 @@
//if(host.brainloss > 100)
/mob/living/simple_animal/borer/New(var/by_gamemode=0)
..()
/mob/living/simple_animal/borer/New(var/loc,var/by_gamemode=0)
..(loc)
truename = "[pick("Primary","Secondary","Tertiary","Quaternary")] [rand(1000,9999)]"
host_brain = new/mob/living/captive_brain(src)
@@ -229,9 +229,9 @@
src << "You wiggle out of [host]'s ear and plop to the ground."
detatch()
detach()
mob/living/simple_animal/borer/proc/detatch()
mob/living/simple_animal/borer/proc/detach()
if(!host) return
@@ -397,10 +397,20 @@ mob/living/simple_animal/borer/proc/detatch()
//Procs for grabbing players.
mob/living/simple_animal/borer/proc/request_player()
var/list/candidates=list()
testing("Polling for borers.")
for(var/mob/dead/observer/G in get_active_candidates(ROLE_BORER, poll="HEY KID, YOU WANNA BE A BORER?"))
if(G.client && !G.client.holder)
if(!jobban_isbanned(G, "Syndicate"))
if(!G.client)
testing("Client of [G] inexistent")
continue
if(G.client.holder)
testing("Client of [G] is admin.")
continue
if(jobban_isbanned(G, "Syndicate"))
testing("Jobbanned.")
continue
candidates += G
if(!candidates.len)

View File

@@ -201,7 +201,7 @@
var/mob/living/simple_animal/borer/worm = obj
if(worm.controlling)
target.release_control()
worm.detatch()
worm.detach()
obj.loc = get_turf(target)
if(istype(obj,/obj/item/weapon/implant))

View File

@@ -157,6 +157,7 @@ var/MAX_EXPLOSION_RANGE = 14
#define HUMAN_STRIP_DELAY 40 //takes 40ds = 4s to strip someone.
#define ALIEN_SELECT_AFK_BUFFER 1 // How many minutes that a person can be AFK before not being allowed to be an alien.
#define ROLE_SELECT_AFK_BUFFER 1 // Default value.
#define NORMPIPERATE 30 //pipe-insulation rate divisor
#define HEATPIPERATE 8 //heat-exch pipe insulation

27
html/browser/clean.css Normal file
View File

@@ -0,0 +1,27 @@
html, body {
font-family: sans-serif, verdana;
font-size: smaller;
color: #666;
}
h1 {
border-bottom: 1px solid maroon;
}
table {
border-spacing: 0;
border-collapse: collapse;
}
td, th {
margin: 0;
font-size: small;
border-bottom: 1px solid #ccc;
padding: 3px;
}
tr:nth-child(even) {
background: #efefef;
}
dt {
font-weight: bold;
}