mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +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)
|
while(current_run.len)
|
||||||
var/obj/machinery/M = current_run[current_run.len]
|
var/obj/machinery/M = current_run[current_run.len]
|
||||||
current_run.len--
|
current_run.len--
|
||||||
|
var/q = QDELETED(M) //CHOMPStation edit
|
||||||
if(!istype(M) || QDELETED(M) || (M.process(wait) == PROCESS_KILL))
|
if(!istype(M) || q || (M.process(wait) == PROCESS_KILL)) //CHOMPStation edit
|
||||||
global.processing_machines.Remove(M)
|
global.processing_machines.Remove(M)
|
||||||
if(!QDELETED(M))
|
M.datum_flags &= ~DF_ISPROCESSING + q*DF_ISPROCESSING; //CHOMPStation edit
|
||||||
DISABLE_BITFIELD(M.datum_flags, DF_ISPROCESSING)
|
|
||||||
if(MC_TICK_CHECK)
|
if(MC_TICK_CHECK)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
var/list/req_one_access = list()
|
var/list/req_one_access = list()
|
||||||
|
|
||||||
var/atom/target = null
|
var/atom/target = null
|
||||||
|
var/list/ignore_past = list() //CHOMPStation edit
|
||||||
var/list/ignore_list = list()
|
var/list/ignore_list = list()
|
||||||
var/list/patrol_path = list()
|
var/list/patrol_path = list()
|
||||||
var/list/target_path = list()
|
var/list/target_path = list()
|
||||||
@@ -165,7 +166,15 @@
|
|||||||
if(ignore_list.len)
|
if(ignore_list.len)
|
||||||
for(var/atom/A in ignore_list)
|
for(var/atom/A in ignore_list)
|
||||||
if(!A || !A.loc || prob(1))
|
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()
|
handleRegular()
|
||||||
|
|
||||||
var/panic_speed_mod = 0
|
var/panic_speed_mod = 0
|
||||||
@@ -249,7 +258,7 @@
|
|||||||
if(makeStep(target_path))
|
if(makeStep(target_path))
|
||||||
frustration = 0
|
frustration = 0
|
||||||
else if(max_frustration)
|
else if(max_frustration)
|
||||||
++frustration
|
frustration++ //CHOMPEdit
|
||||||
return
|
return
|
||||||
|
|
||||||
/mob/living/bot/proc/handleFrustrated(var/targ)
|
/mob/living/bot/proc/handleFrustrated(var/targ)
|
||||||
@@ -271,7 +280,12 @@
|
|||||||
return 1
|
return 1
|
||||||
|
|
||||||
/mob/living/bot/proc/handlePatrol()
|
/mob/living/bot/proc/handlePatrol()
|
||||||
makeStep(patrol_path)
|
//CHOMPEdit Begin
|
||||||
|
if(makeStep(patrol_path))
|
||||||
|
frustration = 0
|
||||||
|
else if(max_frustration)
|
||||||
|
frustration++
|
||||||
|
//CHOMPEdit End
|
||||||
return
|
return
|
||||||
|
|
||||||
/mob/living/bot/proc/startPatrol()
|
/mob/living/bot/proc/startPatrol()
|
||||||
@@ -315,6 +329,8 @@
|
|||||||
ignore_list |= target
|
ignore_list |= target
|
||||||
resetTarget()
|
resetTarget()
|
||||||
obstacle = null
|
obstacle = null
|
||||||
|
else if(target in ignore_past) //CHOMPEdit
|
||||||
|
ignore_past.Remove(target) //CHOMPEdit
|
||||||
return
|
return
|
||||||
|
|
||||||
/mob/living/bot/proc/makeStep(var/list/path)
|
/mob/living/bot/proc/makeStep(var/list/path)
|
||||||
@@ -330,8 +346,8 @@
|
|||||||
/mob/living/bot/proc/resetTarget()
|
/mob/living/bot/proc/resetTarget()
|
||||||
target = null
|
target = null
|
||||||
target_path = list()
|
target_path = list()
|
||||||
frustration = 0
|
//CHOMPEdit frustration = 0
|
||||||
obstacle = null
|
//CHOMPEdit obstacle = null
|
||||||
|
|
||||||
/mob/living/bot/proc/turn_on()
|
/mob/living/bot/proc/turn_on()
|
||||||
if(stat)
|
if(stat)
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
botcard_access = list(access_janitor)
|
botcard_access = list(access_janitor)
|
||||||
pass_flags = PASSTABLE
|
pass_flags = PASSTABLE
|
||||||
|
|
||||||
|
max_frustration = 12 //CHOMPEdit
|
||||||
locked = 0 // Start unlocked so roboticist can set them to patrol.
|
locked = 0 // Start unlocked so roboticist can set them to patrol.
|
||||||
wait_if_pulled = 1
|
wait_if_pulled = 1
|
||||||
min_target_dist = 0
|
min_target_dist = 0
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
icon_state = "medibot0"
|
icon_state = "medibot0"
|
||||||
req_one_access = list(access_robotics, access_medical)
|
req_one_access = list(access_robotics, access_medical)
|
||||||
botcard_access = list(access_medical, access_morgue, access_surgery, access_chemistry, access_virology, access_genetics)
|
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.
|
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)
|
botcard_access = list(access_security, access_sec_doors, access_forensics_lockers, access_maint_tunnels)
|
||||||
patrol_speed = 2
|
patrol_speed = 2
|
||||||
target_speed = 3
|
target_speed = 3
|
||||||
|
max_frustration = 7 //CHOMPEdit
|
||||||
|
|
||||||
density = 1
|
density = 1
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user