Advertisement
L00K3

build.per

Oct 25th, 2021
2,554
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Per 19.36 KB | None | 0 0
  1. ;***BUILD FUNCTIONS***
  2. ;Init Builders For Each Building
  3. (defrule
  4.     (true)
  5. =>
  6.     (set-strategic-number sn-enable-new-building-system 1)
  7.     (set-strategic-number sn-placement-zone-size 0)
  8.     (set-strategic-number sn-placement-fail-delta 0)
  9.     (set-strategic-number sn-placement-to-center 0)
  10.    
  11.     ;Set Dropoff Distances
  12.     (set-strategic-number sn-dropsite-separation-distance 6)
  13.     (set-strategic-number sn-food-dropsite-distance 10)
  14.     (set-strategic-number sn-wood-dropsite-distance 2)
  15.     (set-strategic-number sn-stone-dropsite-distance 2)
  16.     (set-strategic-number sn-gold-dropsite-distance 2)
  17.     (set-strategic-number sn-camp-max-distance 255)
  18.    
  19.     ;Build Goals Init
  20.     (set-goal goal-townsize 4)
  21.     (set-goal goal-spacefromself 0)
  22.     (set-goal goal-buildresource -1)
  23.     (set-goal goal-buildgather -1)
  24.     (set-goal goal-build-itteration-cur 0)
  25.    
  26.     ;Set Point, Start Timer
  27.     (up-copy-point point-build-x point-self-x)
  28.     (up-modify-goal point-build-x g:- goal-townsize)
  29.     (up-modify-goal point-build-y g:- goal-townsize)
  30.     (enable-timer timer-build 3)
  31.    
  32.     ;Vill Assignments Set
  33. ;   (up-assign-builders c: house c: 3)
  34.     (disable-self)
  35. )
  36.  
  37. ;Add House
  38. (defrule
  39.     (goal goal-build 0)
  40.     (up-compare-goal goal-townsize <= 6)
  41.     (housing-headroom <= sn-min-pop-head)
  42.     (population-headroom > 0)
  43.     (up-pending-objects c: house < sn-max-pending-house)
  44.     (up-compare-goal flag-market-progress <= 1)
  45.     (timer-triggered timer-build)
  46.     (can-afford-building house)
  47. =>
  48.    
  49.     (set-goal goal-build 1)
  50.     (set-goal goal-queued house)
  51.     (chat-local-to-self "House")
  52. )
  53. (defrule
  54.     (goal goal-build 0)
  55.     (up-compare-goal goal-townsize > 8)
  56.     (housing-headroom <= sn-min-pop-head)
  57.     (population-headroom > 0)
  58.     (up-pending-objects c: house < sn-max-pending-house)
  59.     (up-compare-goal flag-market-progress <= 1)
  60.     (timer-triggered timer-build)
  61.     (can-afford-building house)
  62. =>
  63.    
  64.     (set-goal goal-build 1)
  65.     (set-goal goal-spacefromself 8)
  66.     (set-goal goal-queued house)
  67.     (chat-local-to-self "House")
  68. )
  69. (defrule
  70.     (up-compare-goal goal-townsize > 8)
  71.     (civilian-population > 40)
  72. =>
  73.     ;(up-delete-objects c: house c: 32768)
  74.     (up-full-reset-search)
  75.     (up-set-target-point point-self-x)
  76.     (up-filter-distance c: 1 c: 8)
  77.     (up-find-local c: house c: 1)
  78.     (up-target-objects 1 action-delete -1 -1)
  79.     (disable-self)
  80. )
  81.  
  82. ;Add Mill
  83. (defrule
  84.     (goal goal-build 0)
  85.     (up-compare-goal goal-townsize > 8)
  86.     (or (housing-headroom > sn-min-pop-head)
  87.     (population-headroom <= 0))
  88.     (up-pending-objects c: mill < sn-max-pending-drop)
  89.     (building-type-count-total mill < goal-max-mills)
  90.     (goal flag-market-progress 0)
  91.     (timer-triggered timer-build)
  92.     (can-afford-building mill)
  93. =>
  94.    
  95.     (set-goal goal-build 1)
  96.     (set-goal goal-spacefromself 8)
  97.     (set-goal goal-queued mill)
  98.     (chat-local-to-self "Consecutive Mill")
  99. )
  100. (defrule ;Expand Goal goal-max-mills
  101.     (goal goal-build 0)
  102.     (up-compare-goal goal-townsize > 12)
  103.     (or (housing-headroom > sn-min-pop-head)
  104.     (population-headroom <= 0))
  105.     (building-type-count-total farm > goal-increase-mills)
  106.     (timer-triggered timer-build)
  107. =>
  108.     (up-modify-goal goal-increase-mills c:+ 8)
  109.     (up-modify-goal goal-max-mills c:+ 1)
  110.     (chat-local-to-self "Allowed Extra Mill")
  111. )
  112.  
  113. ;Add Farm
  114. (defrule
  115.     (goal goal-build 0)
  116.     (idle-farm-count <= sn-min-farm-head)
  117.     (or (housing-headroom > sn-min-pop-head)
  118.     (population-headroom <= 0))
  119.     (building-type-count-total farm g:< goal-max-farms)
  120.     (up-compare-goal flag-market-progress <= 1)
  121.     (timer-triggered timer-build)
  122.     (can-build farm)
  123.     (can-afford-building farm)
  124. =>
  125.    
  126.     (set-goal goal-build 1)
  127.     (set-goal goal-spacefromself 0)
  128.     (set-goal goal-spacefromgather 6)
  129.     (set-goal goal-buildgather mill)
  130.     (set-goal goal-queued farm)
  131.     (chat-local-to-self "Farm")
  132. )
  133.  
  134. (defrule
  135.     (resource-found wood)
  136.     (dropsite-min-distance wood > 5)
  137.     (up-compare-goal goal-townsize > 6)
  138. =>
  139.     (chat-local-to-self "Found Wood, After Town Size 6")
  140.     (disable-self)
  141. )
  142.  
  143. ;Add Lumbercamp
  144. (defrule
  145.     (goal goal-build 0)
  146.     (resource-found wood)
  147.     (dropsite-min-distance wood > 5)
  148.     (up-compare-goal goal-townsize > 6)
  149.     (or (housing-headroom > sn-min-pop-head)
  150.     (population-headroom <= 0))
  151.     (up-pending-objects c: lumber-camp < sn-max-pending-drop)
  152.     (up-compare-goal flag-market-progress <= 1)
  153.     (timer-triggered timer-build)
  154.     (can-afford-building lumber-camp)
  155. =>
  156.     (set-goal goal-build 1)
  157.     (set-goal goal-spacefromself 6)
  158.     (set-goal goal-spacefromresource 2)
  159.     (set-goal goal-buildresource wood)
  160.     (set-goal goal-queued lumber-camp)
  161.     (chat-local-to-self "Lumbercamp")
  162. )
  163.  
  164. ;Add Mining-Camp (Gold)
  165. (defrule
  166.     (goal goal-build 0)
  167.     (resource-found gold)
  168.     (dropsite-min-distance gold > 5)
  169.     (up-compare-goal goal-townsize > 6)
  170.     (or (housing-headroom > sn-min-pop-head)
  171.     (population-headroom <= 0))
  172.     (up-pending-objects c: lumber-camp < sn-max-pending-drop)
  173.     (up-compare-goal flag-market-progress <= 1)
  174.     (timer-triggered timer-build)
  175.     (can-afford-building mining-camp)
  176. =>
  177.     (set-goal goal-build 1)
  178.     (set-goal goal-spacefromself 6)
  179.     (set-goal goal-spacefromresource 2)
  180.     (set-goal goal-buildresource gold)
  181.     (set-goal goal-queued mining-camp)
  182.     (chat-local-to-self "Mining-Camp (Gold)")
  183. )
  184.  
  185. ;Add Mining-Camp (Stone)
  186. (defrule
  187.     (goal goal-build 0)
  188.     (resource-found stone)
  189.     (dropsite-min-distance food > 5)
  190.     (up-compare-goal goal-townsize > 6)
  191.     (or (housing-headroom > sn-min-pop-head)
  192.     (population-headroom <= 0))
  193.     (up-pending-objects c: lumber-camp < sn-max-pending-drop)
  194.     (up-compare-goal flag-market-progress <= 1)
  195.     (timer-triggered timer-build)
  196.     (can-afford-building mining-camp)
  197. =>
  198.     (set-goal goal-build 1)
  199.     (set-goal goal-spacefromself 6)
  200.     (set-goal goal-spacefromresource 4)
  201.     (set-goal goal-buildresource stone)
  202.     (set-goal goal-queued mining-camp)
  203.     (chat-local-to-self "Mining-Camp (Stone)")
  204. )
  205.  
  206. ;Town Size Adjust
  207. (defrule
  208.     ;(timer-triggered timer-checkspace)
  209.     (building-count-total g:> goal-townmaxbuild)
  210. =>
  211. ;   (disable-timer timer-checkspace)
  212.     (chat-local-to-self "Town Size Increase")
  213.     (up-chat-data-to-self "goal-townsize: %d" g: goal-townsize)
  214.     (up-chat-data-to-self "goal-townmaxbuild: %d" g: goal-townmaxbuild)
  215.     (up-modify-goal goal-townsize c:+ 2)
  216.     (up-modify-goal goal-townmaxbuild c:* 3)
  217.     (up-modify-goal goal-townmaxbuild c:/ 2)
  218. ;   (enable-timer timer-checkspace 120)
  219. )
  220.  
  221. ;---Init Build---
  222. (defrule
  223.     (goal goal-build 1)
  224.     (game-time g:> goal-min-time)
  225.     (timer-triggered timer-build)
  226.     (up-compare-goal flag-market-progress <= 1)
  227. =>
  228.     ;Set Build Start
  229.     (up-copy-point point-startbuild-x point-self-x)
  230.     (up-modify-goal point-startbuild-x g:- goal-townsize)
  231.     (up-modify-goal point-startbuild-y g:- goal-townsize)
  232.    
  233.     ;Set Build End
  234.     (up-copy-point point-endbuild-x point-self-x)
  235.     (up-modify-goal point-endbuild-x g:+ goal-townsize)
  236.     (up-modify-goal point-endbuild-y g:+ goal-townsize)
  237.    
  238.     ;Copy In Start, GO!
  239.     (set-goal goal-buildrestriction 0)
  240.     (set-goal goal-build 2)
  241.     ; (chat-local-to-self "Init Build")
  242. )
  243. (defrule
  244.     (goal goal-build 2)
  245.     (goal goal-build-itteration-cur 0)
  246. =>
  247.     (set-goal goal-build-itteration-end 1)
  248.     (set-goal goal-build -1)
  249. )
  250. (defrule
  251.     (goal goal-build 2)
  252.     (goal goal-build-itteration-cur 1)
  253. =>
  254.     (set-goal goal-build-itteration-end 2)
  255.     (set-goal goal-build -1)
  256. )
  257. (defrule
  258.     (goal goal-build 2)
  259.     (goal goal-build-itteration-cur 2)
  260. =>
  261.     (set-goal goal-build-itteration-end 3)
  262.     (set-goal goal-build -1)
  263. )
  264. (defrule
  265.     (goal goal-build 2)
  266.     (goal goal-build-itteration-cur 3)
  267. =>
  268.     (set-goal goal-build-itteration-end 0)
  269.     (set-goal goal-build -1)
  270. )
  271.  
  272. ;---Check Requirements---
  273. (defrule
  274.     (goal goal-build 1)
  275.     (up-compare-goal flag-market-progress > 1)
  276. =>
  277.     (disable-timer timer-build)
  278.     (set-goal goal-build 0)
  279.     (set-goal goal-spacefromself 0)
  280.     (set-goal goal-buildresource -1)
  281.     (set-goal goal-buildgather -1)
  282.     (enable-timer timer-build 3)
  283. )
  284. (defrule
  285.     (goal goal-build -1)
  286.     ; (timer-triggered timer-build)
  287.     (up-pending-placement g: goal-queued)
  288. =>
  289.     ; (disable-timer timer-build)
  290.     (up-reset-placement g: goal-queued)
  291.     (set-goal goal-build -2)
  292.     ; (enable-timer timer-build 0)
  293.     ; (chat-local-to-self "Placement Was Pending, Removed")
  294. )
  295. (defrule
  296.     (goal goal-build -1)
  297.     ; (timer-triggered timer-build)
  298.     (not (up-pending-placement g: goal-queued))
  299. =>
  300.     ; (disable-timer timer-build)
  301.     (set-goal goal-build -2)
  302.     ; (enable-timer timer-build 0)
  303.     ; (chat-local-to-self "No Pending Placements")
  304. )
  305.  
  306. ;---Attempt To Let AI Place
  307. (defrule
  308.     (goal goal-build -2)
  309.     (up-can-build 0 g: goal-queued)
  310. =>
  311.     (disable-timer timer-build)
  312.     (up-build place-normal 0 g: goal-queued)
  313.     (enable-timer timer-build 2)
  314. )
  315. (defrule
  316.     (goal goal-build -2)
  317.     (timer-triggered timer-build)
  318.     (not (up-pending-placement g: goal-queued))
  319. =>
  320.     (disable-timer timer-build)
  321.     (set-goal goal-build 0)
  322.     (set-goal goal-spacefromself 0)
  323.     (set-goal goal-buildresource -1)
  324.     (set-goal goal-buildgather -1)
  325.     (enable-timer timer-build 3)
  326.     (chat-local-to-self "AI Placement Success")
  327. )
  328. (defrule
  329.     (goal goal-build -2)
  330.     (timer-triggered timer-build)
  331.     (up-pending-placement g: goal-queued)
  332. =>
  333.     (up-reset-placement g: goal-queued)
  334.     (set-goal goal-build 3)
  335.     ; (chat-local-to-self "AI Placement Failed")
  336. )
  337.  
  338. ;---Check If Offset
  339. (defrule
  340.     (goal goal-build 3)
  341.     (goal goal-build-itteration-cur 0)
  342. =>
  343.     (set-goal goal-build 5)
  344. )
  345. (defrule
  346.     (goal goal-build 3)
  347.     (goal goal-build-itteration-cur 1)
  348. =>
  349.     ; (set-goal goal-build 6)
  350.     (set-goal goal-build 5)
  351. )
  352. (defrule
  353.     (goal goal-build 3)
  354.     (goal goal-build-itteration-cur 2)
  355. =>
  356.     (set-goal goal-build 5)
  357. )
  358. (defrule
  359.     (goal goal-build 3)
  360.     (goal goal-build-itteration-cur 3)
  361. =>
  362.     ; (set-goal goal-build 6)
  363.     (set-goal goal-build 5)
  364. )
  365.  
  366. ;---Build With Restriction Common---
  367. (defrule ;Check If Gather Close Enough
  368.     (goal goal-build 4)
  369.     (goal goal-buildrestriction 2)
  370.     ; (timer-triggered timer-build)
  371.     (up-compare-goal goal-buildobject c:>= 0)
  372. =>
  373.     (disable-timer timer-build)
  374.     (up-build-line point-build-x point-build-x g: goal-queued)
  375.     (set-goal goal-build 0)
  376.     (set-goal goal-spacefromself 0)
  377.     (set-goal goal-buildresource -1)
  378.     (set-goal goal-buildgather -1)
  379.     (enable-timer timer-build 2)
  380.     (chat-local-to-self "Build Set: Resource")
  381. )
  382. (defrule ;Check If Resource Too Far
  383.     (up-compare-goal goal-build c:>= 4)
  384.     (goal goal-buildrestriction 2)
  385.     ; (timer-triggered timer-build)
  386.     (up-compare-goal goal-buildobject c:< 0)
  387. =>
  388.     ; (disable-timer timer-build)
  389.     (set-goal goal-buildrestriction 1)
  390.     (set-goal goal-build 5)
  391.     ; (enable-timer timer-build 0)
  392.     ; (chat-local-to-self "Build Invalid: Restriction")
  393. )
  394.  
  395. ;---Build Check Restriction---
  396. (defrule ;Check If Can-Build @Resource
  397.     (goal goal-buildrestriction 0)
  398.     (up-compare-goal goal-build >= 5)
  399.     ; (timer-triggered timer-build)
  400.     (up-compare-goal goal-buildresource c:>= 0)
  401.     (up-compare-goal goal-buildgather c:< 0)
  402.     (up-can-build-line 0 point-build-x g: goal-queued)
  403. =>
  404.     ; (disable-timer timer-build)
  405.     (up-full-reset-search)
  406.     (up-set-target-point point-build-x)
  407.     (up-filter-distance c: 1 g: goal-spacefromresource)
  408.     (up-find-resource g: goal-buildresource c: 1)
  409.     (up-clean-search search-remote object-data-distance search-order-asc)
  410.     (up-set-target-object search-local c: 0)
  411.     (up-get-object-data object-data-id goal-buildobject)
  412.     (set-goal goal-buildrestriction 2)
  413.     (set-goal goal-build 4)
  414.     ; (enable-timer timer-build 0)
  415.     ; (chat-local-to-self "Build Requires Resource")
  416. )
  417. (defrule ;Check If Can-Build @Gather[0]
  418.     (goal goal-buildrestriction 0)
  419.     (up-compare-goal goal-build >= 5)
  420.     ; (timer-triggered timer-build)
  421.     (up-compare-goal goal-buildresource c:< 0)
  422.     (up-compare-goal goal-buildgather c:>= 0)
  423.     (up-can-build-line 0 point-build-x g: goal-queued)
  424. =>
  425.     ; (disable-timer timer-build)
  426.     (up-full-reset-search)
  427.     (up-set-target-point point-build-x)
  428.     (up-filter-distance c: 1 g: goal-spacefromgather)
  429.     (up-find-local c: town-center c: 1)
  430.     (up-clean-search search-local object-data-distance search-order-asc)
  431.     (up-set-target-object search-local c: 0)
  432.     (up-get-object-data object-data-id goal-buildobject)
  433.     (set-goal goal-buildrestriction 3)
  434.     ; (enable-timer timer-build 0)
  435.     ; (chat-local-to-self "Build Requires Gather [0] -> Gather [1]")
  436. )
  437. (defrule ;Check If Can-Build @Gather[1]
  438.     (goal goal-buildrestriction 3)
  439.     (up-compare-goal goal-build >= 5)
  440.     ; (timer-triggered timer-build)
  441.     (up-compare-goal goal-buildresource c:< 0)
  442.     (up-compare-goal goal-buildgather c:>= 0)
  443.     (up-compare-goal goal-buildobject c:>= 0)
  444.     (up-can-build-line 0 point-build-x g: goal-queued)
  445. =>
  446.     (disable-timer timer-build)
  447.     (up-build-line point-build-x point-build-x g: goal-queued)
  448.     (set-goal goal-build 0)
  449.     (set-goal goal-spacefromself 0)
  450.     (set-goal goal-buildresource -1)
  451.     (set-goal goal-buildgather -1)
  452.     (enable-timer timer-build 2)
  453.     (chat-local-to-self "Build Set: Restriction")
  454. )
  455. (defrule ;Gather[1] Failed
  456.     (goal goal-buildrestriction 3)
  457.     (up-compare-goal goal-build >= 5)
  458.     ; (timer-triggered timer-build)
  459.     (up-compare-goal goal-buildresource c:< 0)
  460.     (up-compare-goal goal-buildgather c:>= 0)
  461.     (up-compare-goal goal-buildobject c:< 0)
  462.     (up-can-build-line 0 point-build-x g: goal-queued)
  463. =>
  464.     ; (disable-timer timer-build)
  465.     (up-full-reset-search)
  466.     (up-set-target-point point-build-x)
  467.     (up-filter-distance c: 1 g: goal-spacefromgather)
  468.     (up-find-local g: goal-buildgather c: 1)
  469.     (up-clean-search search-local object-data-distance search-order-asc)
  470.     (up-set-target-object search-local c: 0)
  471.     (up-get-object-data object-data-id goal-buildobject)
  472.     (set-goal goal-buildrestriction 2)
  473.     (set-goal goal-build 4)
  474.     ; (enable-timer timer-build 0)
  475.     ; (chat-local-to-self "Build Requires Gather [1]: Build Check")
  476. )
  477. (defrule ;Check If Can-Build @[Resource] + Gather
  478.     (goal goal-buildrestriction 0)
  479.     (up-compare-goal goal-build >= 5)
  480.     ; (timer-triggered timer-build)
  481.     (up-compare-goal goal-buildresource c:>= 0)
  482.     (up-compare-goal goal-buildgather c:>= 0)
  483.     (up-can-build-line 0 point-build-x g: goal-queued)
  484. =>
  485.     ; (disable-timer timer-build)
  486.     (up-full-reset-search)
  487.     (up-set-target-point point-build-x)
  488.     (up-filter-distance c: 1 g: goal-spacefromresource)
  489.     (up-find-resource g: goal-buildresource c: 1)
  490.     (up-clean-search search-remote object-data-distance search-order-asc)
  491.     (up-set-target-object search-remote c: 0)
  492.     (up-get-object-data object-data-id goal-buildobject)
  493.     (set-goal goal-buildrestriction 2)
  494.     ; (enable-timer timer-build 0)
  495.     ; (chat-local-to-self "Build Requires Resource")
  496. )
  497. (defrule ;Check If Can-Build @Resource + [Gather]
  498.     (goal goal-buildrestriction 2)
  499.     (up-compare-goal goal-build >= 5)
  500.     ; (timer-triggered timer-build)
  501.     (up-compare-goal goal-buildresource c:>= 0)
  502.     (up-compare-goal goal-buildgather c:>= 0)
  503.     (up-compare-goal goal-buildobject c:>= 0)
  504.     (up-can-build-line 0 point-build-x g: goal-queued)
  505. =>
  506.     ; (disable-timer timer-build)
  507.     (up-full-reset-search)
  508.     (up-set-target-point point-build-x)
  509.     (up-filter-distance c: 1 g: goal-spacefromgather)
  510.     (up-find-local g: goal-buildgather c: 1)
  511.     (up-clean-search search-local object-data-distance search-order-asc)
  512.     (up-set-target-object search-local c: 0)
  513.     (up-get-object-data object-data-id goal-buildobject)
  514.     (set-goal goal-buildrestriction 3)
  515.     ; (enable-timer timer-build 0)
  516.     ; (chat-local-to-self "Build Requires Resource")
  517. )
  518.  
  519. (defrule ;Check If Can-Build Without Restriction
  520.     (up-compare-goal goal-build >= 5)
  521.     ; (timer-triggered timer-build)
  522.     (up-compare-goal goal-buildresource c:< 0)
  523.     (up-compare-goal goal-buildgather c:< 0)
  524.     (up-compare-goal point-build-y g:<= point-endbuild-y)
  525.     (up-compare-goal point-build-x g:<= point-endbuild-x)
  526.     (up-point-distance point-build-x point-self-x g:>= goal-spacefromself)
  527.     (up-can-build-line 0 point-build-x g: goal-queued)
  528. =>
  529.     (disable-timer timer-build)
  530.     (up-build-line point-build-x point-build-x g: goal-queued)
  531.     (set-goal goal-build 0)
  532.     (set-goal goal-spacefromself 0)
  533.     (set-goal goal-buildresource -1)
  534.     (set-goal goal-buildgather -1)
  535.     (enable-timer timer-build 2)
  536.     (chat-local-to-self "Build Set: No Restriction")
  537. )
  538.  
  539. ;---Build Point Invalid, Increment---
  540. (defrule ;Could Not Build, Increment Y
  541.     (up-compare-goal goal-build >= 5)
  542.     (up-compare-goal point-build-y g:<= point-endbuild-y)
  543.     (up-compare-goal point-build-x g:<= point-endbuild-x)
  544.     (or (goal goal-buildrestriction 1)
  545.     (or (not(up-can-build-line 0 point-build-x g: goal-queued))
  546.     (up-point-distance point-build-x point-self-x g:< goal-spacefromself)))
  547. =>
  548.     ; (up-modify-goal point-build-y c:+ 2)
  549.     (up-modify-goal point-build-y c:+ 1)
  550.     (set-goal goal-buildrestriction 0)
  551.     ; (chat-local-to-self "Inc. Y")
  552. )
  553. (defrule ;Could Not Build, Increment X Without Offset
  554.     (goal goal-build 5)
  555.     (up-compare-goal point-build-y g:> point-endbuild-y)
  556.     (up-compare-goal point-build-x g:<= point-endbuild-x)
  557.     (timer-triggered timer-build)
  558. =>
  559.     (up-modify-goal point-build-y g:= point-startbuild-y)
  560.     ; (up-modify-goal point-build-x c:+ 2)
  561.     (up-modify-goal point-build-x c:+ 1)
  562.     (set-goal goal-buildrestriction 0)
  563.     (set-goal goal-build 6)
  564.     ; (chat-local-to-self "Inc. X -Offset")
  565. )
  566. (defrule ;Could Not Build, Increment X With Offset
  567.     (goal goal-build 6)
  568.     (up-compare-goal point-build-y g:> point-endbuild-y)
  569.     (up-compare-goal point-build-x g:<= point-endbuild-x)
  570. =>
  571.     (up-modify-goal point-build-y g:= point-startbuild-y)
  572.     ; (up-modify-goal point-build-y c:+ 2)
  573.     (up-modify-goal point-build-y c:+ 1)
  574.     (up-modify-goal point-build-x c:+ 1)
  575.     (set-goal goal-buildrestriction 0)
  576.     (set-goal goal-build 5)
  577.     ; (chat-local-to-self "Inc. X +Offset")
  578. )
  579. (defrule ;Failed Itteration 0, Start Itteration 1
  580.     (goal goal-build-itteration-cur 0)
  581.     (up-compare-goal goal-build >= 5)
  582.     (up-compare-goal point-build-x g:> point-endbuild-x)
  583. =>
  584.     (up-modify-goal point-build-x g:= point-startbuild-x)
  585.     (up-modify-goal point-build-y g:= point-startbuild-y)
  586.     (up-modify-goal point-build-y c:+ 1)
  587.     (set-goal goal-build-itteration-cur 1)
  588.     ; (set-goal goal-build 6)
  589.     (set-goal goal-build 5)
  590.     ; (chat-local-to-self "Reset For Itteration 1")
  591. )
  592. (defrule ;Failed Itteration 1, Start Itteration 2
  593.     (goal goal-build-itteration-cur 1)
  594.     (up-compare-goal goal-build >= 5)
  595.     (up-compare-goal point-build-x g:> point-endbuild-x)
  596. =>
  597.     (up-modify-goal point-build-x g:= point-startbuild-x)
  598.     (up-modify-goal point-build-x c:+ 1)
  599.     (up-modify-goal point-build-y g:= point-startbuild-y)
  600.     (set-goal goal-build-itteration-cur 2)
  601.     (set-goal goal-build 5)
  602.     ; (chat-local-to-self "Reset For Itteration 2")
  603. )
  604. (defrule ;Failed Itteration 2, Start Itteration 3
  605.     (goal goal-build-itteration-cur 2)
  606.     (up-compare-goal goal-build >= 5)
  607.     (up-compare-goal point-build-x g:> point-endbuild-x)
  608. =>
  609.     (up-modify-goal point-build-x g:= point-startbuild-x)
  610.     (up-modify-goal point-build-x c:+ 1)
  611.     (up-modify-goal point-build-y g:= point-startbuild-y)
  612.     (up-modify-goal point-build-y c:+ 1)
  613.     (set-goal goal-build-itteration-cur 3)
  614.     ; (set-goal goal-build 6)
  615.     (set-goal goal-build 5)
  616.     ; (chat-local-to-self "Reset For Itteration 3")
  617. )
  618. (defrule ;Failed Itteration 3, Start Itteration 0
  619.     (goal goal-build-itteration-cur 3)
  620.     (up-compare-goal goal-build >= 5)
  621.     (up-compare-goal point-build-x g:> point-endbuild-x)
  622. =>
  623.     (up-modify-goal point-build-x g:= point-startbuild-x)
  624.     (up-modify-goal point-build-y g:= point-startbuild-y)
  625.     (set-goal goal-build-itteration-cur 0)
  626.     (set-goal goal-build 5)
  627.     ; (chat-local-to-self "Reset For Itteration 0")
  628. )
  629. (defrule ;OOB, Obviously No Space
  630.     ; (up-compare-goal goal-build-itteration-cur g:== goal-build-itteration-end)
  631.     (up-compare-goal goal-build >= 5)
  632.     (up-compare-goal point-build-x g:> point-endbuild-x)
  633. =>
  634.     (disable-timer timer-build)
  635.     (set-goal goal-build 0)
  636.     (set-goal goal-spacefromself 0)
  637.     (set-goal goal-buildresource -1)
  638.     (set-goal goal-buildgather -1)
  639.     (enable-timer timer-build 100)
  640.     (chat-local-to-self "No Space, Retry in 60s")
  641. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement