All Downloads are FREE. Search and download functionalities are using the official Maven repository.

APT.all-test.HauntBot.record-actor.soar Maven / Gradle / Ivy

echo "\nLoading record-actor"

## Create link to a new enemy
# [1] REW: 2002-07-27
#     Don't record a actor for an agent for any friendly team members 
#     Note that Haunt under ^entity.agent.name is not upcased.  They have
#     to be |HauntBot1| to match here.
# AMN: 2002-08-02 - Added |Player| as a friendly team member so agent will
#                   ignore the "ghost" that shows up.  (Devvan's working on it...)
# [3] REW: 2002-08-26
#     Added production to copy new actors to the sentry-watch structure
# [4] REW: 2002-08-28
#     Evidently the HauntBot names are now HauntBot so I added these to the record-actor proposal
# [5] REW: 2002-09-11
#     Made basic proposal depend on active objective other than sentry-watch
#     Must assume that sentry-watch will terminate if it's ever true that a actor is present
#     (ie, where a actor is different from a contact).
#     Basic idea is to not use record actor for contacts made during sentry-watch
#     This means that sentry-watch will not record actors.
# [6] REW: 2002-09-25
#     Completed and tested changes described in [6].
#     Note that the actor is never deleted unless we can't determine
#     it's name.  The ^actor.enemy is deleted/re-added as actors change
#     from visible to not visible and back again.


# REW: This should fire both when the active objective is not sentry-watch and also 
# when there is no active objective at all.
sp {haunt*propose*record-actor
   (state  ^name haunt
              ^io.input-link.objects.entity 
             -^actors.actor.enemy.name )
   (  ^name { <> |Player| <> |HauntBot1| <> |HauntBot2| <> |HauntBot3| <> |HauntBot4| <> |HauntBot5| 
                                 <> |HauntBot1| <> |HauntBot2| <> |HauntBot3| <> |HauntBot4| <> |HauntBot5|           } )
   -->
   #(write (crlf) | Recording actor for enemy | )
    ( ^operator  + =, >)
   ( ^name record-actor
        ^type new
        ^enemy )}

## If have saved a actor and the enemy reappears on vision - replace the 
## saved version with the new enemey

sp {haunt*propose*enemy-record*replace
   (state  ^name haunt
              ^io.input-link.objects.entity 
              ^actors.actor.enemy { <>   })
   ( ^name 
             ^visible false)
   ( ^name 
            ^visible true)
   -->
   ( ^operator  + =, >)
   ( ^name record-actor
        ^enemy 
        ^old-enemy 
        ^type replace)}

## If the enemy disappears off vision, then create a record of him

sp {haunt*propose*enemy-record*save
   (state  ^name haunt
              ^io.input-link.objects.entity 
              ^actors.actor )
   ( ^enemy )
   (  ^name 
             ^visible false)
-->
   (write (crlf) |Actor |  | has disappeared - visible false.|)
   ( ^operator  + =, >)
   ( ^name record-actor
        ^enemy 
        ^type save)} 
                     
###### ELABORTIONS ######
       
#Elaborate the enemy with the area that it currently resides in
sp {haunt*record-actor*area
   (state  ^name haunt
              ^operator 
              ^top-state.map )
   ( ^name record-actor
        ^enemy )
   ( ^position )
   ( ^area )
   ( ^min-x 
           ^min-y 
           ^max-x 
           ^max-y 
           ^min-z 
           ^max-z )
   ( -^x > 
          -^x < 
          -^y > 
          -^y < 
          -^z < 
          -^z > )
-->
   ( ^area-id )
}


###### APPLICATIONS #####

#### NEW

sp {apply*record-actor*new
   (state  ^operator 
              ^actors )
   ( ^name record-actor
         ^type new
         ^enemy )
   -->
   ( ^actor  )
   ( ^enemy )
}


# REW: 2002-08-26
# If there is a sentry-watch going on and we record a actor, then also record that it has not been
# reported (not all actors will be reported but we generally want to report actors observed while
# on sentry-watch)
# REW: 2002-09-26 (deleted: apply*record-actor*sentry-watch*new-actor)

## Mark all areas that the enemy is seen in.

sp {apply*record-actor*area
   (state  ^operator 
              ^actors )
   ( ^name record-actor
        ^enemy.area-id )
   ( -^controlled-area )
-->
   ( ^controlled-area )
}

#### SAVE 

## REW: Not sure what this is supposed to do:  
## Just delete a actor that doesn't have a name?
sp {haunt*apply*record-actor*clean-up
   (state  ^operator 
              ^actors )
   ( ^name record-actor)
   ( ^actor )
   ( -^enemy.name) 
-->
   (write (crlf) |Deleting actor |   | .|)
   ( ^actor  -)}

sp {haunt*apply*record-actor*save*remove-old-enemy
   (state  ^operator 
              ^io.input-link.objects.entity 
              ^actors )
   ( ^name record-actor
        ^type save
        ^enemy )
   ( ^actor )
   ( ^enemy )
   -->   
   ( ^enemy  -)}
   
sp {haunt*apply*record-actor*save
   (state  ^operator 
              ^io.input-link.agent.cycle 
              ^parameters.actor-remember-time 
              ^actors )
   ( ^actor )
   ( ^enemy )
   ( ^name record-actor
        ^type save
        ^enemy )
   ( ^range 
            ^area 
            ^aspect 
            ^angle-off 
            ^health 
            ^weapon 
            ^position 

^team ^name ) ( ^v ^h ) (

^x ^y ^z ) ( ^v ^h ) --> (write (crlf) |Saving information about disappearing actor: | ) ( ^enemy ^area-name ^last-seen-time ) ( ^name ^area ^team ^position ^health ^weapon ^aspect ^angle-off ^visible false ) ( ^h ^v ) ( ^x ^y ^z ) ( ^v ^h ) } #### REPLACE sp {haunt*apply*record-actor*replace (state ^operator ^actors ) ( ^name record-actor ^type replace ^enemy ^old-enemy ) ( ^actor ) ( ^enemy ) --> ( ^enemy - +)} # REW: 2002-09-25 # When replacing a actor, delete the last-seen-time sp {haunt*apply*record-actor*replace*delete*last-seen-time (state ^operator ^actors ) ( ^name record-actor ^type replace ^enemy ^old-enemy ) ( ^actor ) ( ^enemy ^last-seen-time ) --> ( ^last-seen-time -)} # REW: 2002-08-26 # When a actor appears that we have previously seen, record it on the # sentry-watch structure iff it hasn't been reported before for this # sentry-watch objective. # REW: 2002-09-26 (delete: apply*record-actor*sentry-watch*new-actor*replace) ### SEARCH CONTROL sp {haunt*select*record-actor (state ^name haunt ^operator + ^operator +) ( ^name record-actor) ( ^name << execute-script explore >>) --> ( ^operator > )}