mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Merge pull request #552 from cadyn/cadyn-actually-optimizes
Machines.dm Optimization + Bots improvements
This commit is contained in:
@@ -121,11 +121,10 @@ SUBSYSTEM_DEF(machines)
|
||||
while(current_run.len)
|
||||
var/obj/machinery/M = current_run[current_run.len]
|
||||
current_run.len--
|
||||
|
||||
if(!istype(M) || QDELETED(M) || (M.process(wait) == PROCESS_KILL))
|
||||
var/q = QDELETED(M) //CHOMPStation edit
|
||||
if(!istype(M) || q || (M.process(wait) == PROCESS_KILL)) //CHOMPStation edit
|
||||
global.processing_machines.Remove(M)
|
||||
if(!QDELETED(M))
|
||||
DISABLE_BITFIELD(M.datum_flags, DF_ISPROCESSING)
|
||||
M.datum_flags &= ~DF_ISPROCESSING + q*DF_ISPROCESSING; //CHOMPStation edit
|
||||
if(MC_TICK_CHECK)
|
||||
return
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
var/list/req_one_access = list()
|
||||
|
||||
var/atom/target = null
|
||||
var/list/ignore_past = list() //CHOMPStation edit
|
||||
var/list/ignore_list = list()
|
||||
var/list/patrol_path = list()
|
||||
var/list/target_path = list()
|
||||
@@ -165,7 +166,15 @@
|
||||
if(ignore_list.len)
|
||||
for(var/atom/A in ignore_list)
|
||||
if(!A || !A.loc || prob(1))
|
||||
ignore_list -= A
|
||||
//CHOMPEdit Begin
|
||||
if(A in ignore_past)
|
||||
if(prob(10/ignore_past[A]) || !A || !A.loc)
|
||||
ignore_past[A]++
|
||||
ignore_list -= A
|
||||
else
|
||||
ignore_past[A] = 1
|
||||
ignore_list -= A
|
||||
//CHOMPEdit End
|
||||
handleRegular()
|
||||
|
||||
var/panic_speed_mod = 0
|
||||
@@ -249,7 +258,7 @@
|
||||
if(makeStep(target_path))
|
||||
frustration = 0
|
||||
else if(max_frustration)
|
||||
++frustration
|
||||
frustration++ //CHOMPEdit
|
||||
return
|
||||
|
||||
/mob/living/bot/proc/handleFrustrated(var/targ)
|
||||
@@ -271,7 +280,12 @@
|
||||
return 1
|
||||
|
||||
/mob/living/bot/proc/handlePatrol()
|
||||
makeStep(patrol_path)
|
||||
//CHOMPEdit Begin
|
||||
if(makeStep(patrol_path))
|
||||
frustration = 0
|
||||
else if(max_frustration)
|
||||
frustration++
|
||||
//CHOMPEdit End
|
||||
return
|
||||
|
||||
/mob/living/bot/proc/startPatrol()
|
||||
@@ -315,6 +329,8 @@
|
||||
ignore_list |= target
|
||||
resetTarget()
|
||||
obstacle = null
|
||||
else if(target in ignore_past) //CHOMPEdit
|
||||
ignore_past.Remove(target) //CHOMPEdit
|
||||
return
|
||||
|
||||
/mob/living/bot/proc/makeStep(var/list/path)
|
||||
@@ -330,8 +346,8 @@
|
||||
/mob/living/bot/proc/resetTarget()
|
||||
target = null
|
||||
target_path = list()
|
||||
frustration = 0
|
||||
obstacle = null
|
||||
//CHOMPEdit frustration = 0
|
||||
//CHOMPEdit obstacle = null
|
||||
|
||||
/mob/living/bot/proc/turn_on()
|
||||
if(stat)
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
botcard_access = list(access_janitor)
|
||||
pass_flags = PASSTABLE
|
||||
|
||||
max_frustration = 12 //CHOMPEdit
|
||||
locked = 0 // Start unlocked so roboticist can set them to patrol.
|
||||
wait_if_pulled = 1
|
||||
min_target_dist = 0
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
icon_state = "medibot0"
|
||||
req_one_access = list(access_robotics, access_medical)
|
||||
botcard_access = list(access_medical, access_morgue, access_surgery, access_chemistry, access_virology, access_genetics)
|
||||
max_frustration = 7 //CHOMPEdit
|
||||
|
||||
var/skin = null //Set to "tox", "ointment" or "o2" for the other two firstaid kits.
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
botcard_access = list(access_security, access_sec_doors, access_forensics_lockers, access_maint_tunnels)
|
||||
patrol_speed = 2
|
||||
target_speed = 3
|
||||
max_frustration = 7 //CHOMPEdit
|
||||
|
||||
density = 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user