Skip to content

Commit

Permalink
Merge pull request tgstation#9320 from GunHog/Botcall_V2
Browse files Browse the repository at this point in the history
Bot performance and PDA features update
  • Loading branch information
RemieRichards committed May 9, 2015
2 parents c77fefc + cdc3e5c commit fdeb840
Show file tree
Hide file tree
Showing 15 changed files with 342 additions and 917 deletions.
5 changes: 4 additions & 1 deletion code/_globalvars/lists/objects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ var/global/list/airlocks = list() //list of all airlocks
var/global/list/mechas_list = list() //list of all mechs. Used by hostile mobs target tracking.
var/global/list/shuttle_caller_list = list() //list of all communication consoles and AIs, for automatic shuttle calls when there are none.
var/global/list/machines = list() //NOTE: this is a list of ALL machines now. The processing machines list is SSmachine.processing !
var/global/list/navbeacons = list() //list of all bot nagivation beacons, used for patrolling.
var/global/list/deliverybeacons = list() //list of all MULEbot delivery beacons.
var/global/list/deliverybeacontags = list() //list of all tags associated with delivery beacons.

var/global/list/chemical_reactions_list //list of all /datum/chemical_reaction datums. Used during chemical reactions
var/global/list/chemical_reagents_list //list of all /datum/reagent datums indexed by reagent id. Used by chemistry stuff
var/global/list/surgeries_list = list() //list of all surgeries by name, associated with their path.
var/global/list/table_recipes = list() //list of all table craft recipes
var/global/list/table_recipes = list() //list of all table craft recipes
34 changes: 1 addition & 33 deletions code/controllers/subsystem/npcpool.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,10 @@ var/datum/subsystem/npcpool/SSbp
/datum/subsystem/npcpool/proc/insertBot(var/toInsert)
if(istype(toInsert,/mob/living/carbon/human/interactive))
botPool_l |= toInsert
else if(istype(toInsert,/obj/machinery/bot))
botPool_l_non |= toInsert

/datum/subsystem/npcpool/New()
NEW_SS_GLOBAL(SSbp)


/datum/subsystem/npcpool/stat_entry()
..("T:[botPool_l.len + botPool_l_non.len]|D:[needsDelegate.len]|A:[needsAssistant.len + needsHelp_non.len]|U:[canBeUsed.len + canBeUsed_non.len]")

Expand All @@ -36,21 +33,6 @@ var/datum/subsystem/npcpool/SSbp
// 5. Do all assignments: goes through the delegated/coordianted bots and assigns the right variables/tasks to them.
var/npcCount = 1

//bot handling
for(var/obj/machinery/bot/check in botPool_l_non)
if(!check)
botPool_l_non.Cut(npcCount,npcCount+1)
continue
if(check.hacked)
needsHelp_non |= check
else if(check.frustration > 5) //average for most bots
needsHelp_non |= check
else if(check.mode == 0)
canBeUsed_non |= check
npcCount++

npcCount = 1 //reset the count

//SNPC handling
for(var/mob/living/carbon/human/interactive/check in botPool_l)
if(!check)
Expand Down Expand Up @@ -116,18 +98,4 @@ var/datum/subsystem/npcpool/SSbp
needsAssistant -= check
canBeUsed -= candidate
candidate.eye_color = "yellow"
npcCount++

if(needsHelp_non.len)
npcCount = 1 //reset the count
for(var/obj/machinery/bot/B in needsHelp_non)
if (!B)
needsHelp_non.Cut(npcCount,npcCount+1)
continue
if(canBeUsed_non.len)
var/obj/machinery/bot/candidate = pick(canBeUsed_non)
candidate.call_bot(B,get_turf(B),FALSE)
canBeUsed_non -= B
needsHelp_non -= candidate
npcCount++

npcCount++
Loading

0 comments on commit fdeb840

Please sign in to comment.