mirror of
https://github.com/fulpstation/fulpstation.git
synced 2025-12-09 16:09:15 +00:00
Several months worth of updates. --------- Co-authored-by: A miscellaneous Fern <80640114+FernandoJ8@users.noreply.github.com> Co-authored-by: Pepsilawn <reisenrui@gmail.com> Co-authored-by: Ray <64306407+OneAsianTortoise@users.noreply.github.com> Co-authored-by: Cure221 <106662180+Cure221@users.noreply.github.com>
43 lines
1.5 KiB
Plaintext
43 lines
1.5 KiB
Plaintext
//this file has procs that help ais think good. used by behaviors mostly
|
|
|
|
|
|
/// Returns either the best weapon from the given choices or null if held weapons are better
|
|
/proc/GetBestWeapon(datum/ai_controller/controller, list/choices, list/held_weapons)
|
|
var/gun_neurons_activated = controller.blackboard[BB_MONKEY_GUN_NEURONS_ACTIVATED]
|
|
var/top_force = 0
|
|
var/obj/item/top_force_item
|
|
for(var/obj/item/item in held_weapons)
|
|
if(HAS_TRAIT(item, TRAIT_NEEDS_TWO_HANDS) || controller.blackboard[BB_MONKEY_BLACKLISTITEMS][item])
|
|
continue
|
|
if(gun_neurons_activated && isgun(item))
|
|
// We have a gun, why bother looking for something inferior
|
|
// Also yes it is intentional that pawns dont know how to pick the best gun
|
|
return item
|
|
if(item.force > top_force)
|
|
top_force = item.force
|
|
top_force_item = item
|
|
|
|
for(var/obj/item/item in choices)
|
|
if(HAS_TRAIT(item, TRAIT_NEEDS_TWO_HANDS) || controller.blackboard[BB_MONKEY_BLACKLISTITEMS][item])
|
|
continue
|
|
if(gun_neurons_activated && isgun(item))
|
|
return item
|
|
if(item.force <= top_force)
|
|
continue
|
|
top_force_item = item
|
|
top_force = item.force
|
|
|
|
return top_force_item
|
|
|
|
///returns if something can be consumed, drink or food
|
|
/proc/IsEdible(obj/item/thing)
|
|
if(!istype(thing))
|
|
return FALSE
|
|
if(IS_EDIBLE(thing))
|
|
return TRUE
|
|
if(istype(thing, /obj/item/reagent_containers/cup/glass/drinkingglass))
|
|
var/obj/item/reagent_containers/cup/glass/drinkingglass/glass = thing
|
|
if(glass.reagents.total_volume) // The glass has something in it, time to drink the mystery liquid!
|
|
return TRUE
|
|
return FALSE
|