forked from AvanWolf/G.O.D
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ModuleTarget.xml
381 lines (353 loc) · 12.8 KB
/
ModuleTarget.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
<?xml version="1.0" ?>
<TranscendenceModule>
<Globals>
(block (module)
(setq module (list
'((weight 6)
(title "Target")
; (subtitle "Do various things to your current target")
(hide (not (objGetTarget gPlayerShip)))
(on-select (block nil
(dsf/add-action 'select '('Select 'S) (lambda nil
(god/target-screen)
))
(dsf/set-default-action 'select)
))
)
))
(setq god/modules (if (iserror god/modules)
module
(append god/modules module)
))
(setq god/target-screen (lambda nil (block nil
(dsf/new-screen 'target-screen "Target Actions")
(dsf/add-list-entries (list
'((title "Restore Target")
(subtitle "Completely restore target")
(on-select (block (target)
(if (setq target (objGetTarget gPlayerShip)) (block nil
(dsf/add-action 'select '("Select" 'S) (lambda nil (block nil
(god/restore-target target)
(dsf/notify "Restored target")
)))
(dsf/set-default-action 'select)
(dsf/set-no-save 'select)
))
))
)
'((title "Inspect Target")
(subtitle "Inspect what your target is equipped with and has in it's cargo hold")
(on-select (block (target)
(if (setq target (objGetTarget gPlayerShip)) (block nil
(dsf/add-action 'select '('Select 'S) (lambda nil (block nil
(dsf/new-screen 'target-inspector "Object Inspector")
(god/object-inspector target)
(dsf/show-screen)
)))
(dsf/set-default-action 'select)
))
))
)
;'((title "Install Device")
; (subtitle "...")
; (on-select (block (target)
; (if (setq target (objGetTarget gPlayerShip)) (block nil
; ))
; ))
;)
;'((title "Remove Device")
; (subtitle "...")
; (on-select (block (target)
; (if (setq target (objGetTarget gPlayerShip)) (block nil
; ))
; ))
;)
;'((title "Repair or Replace Armor")
; (subtitle "...")
; (on-select (block (target)
; (if (setq target (objGetTarget gPlayerShip)) (block nil
; ))
; ))
;)
;'((title "Duplicate")
; (subtitle "Create more of the same")
; (on-select (block (target)
; (if (setq target (objGetTarget gPlayerShip)) (block nil
; (god/duplicate-target target)
; ))
; ))
;)
'((title "Set as Wingman")
(subtitle "Make your target work for you")
(on-select (block (target)
(if (setq target (objGetTarget gPlayerShip)) (block nil
(dsf/add-action 'select '("Select" 'S) (lambda nil (block nil
(shpCancelOrders target)
(objSetSovereign target &svIndependent;)
(objSetEventHandler target &baStdWingmanBase;)
(objFireEvent target "OrderJoinPlayer")
(dsf/notify "Ordered ship to join as Wingman")
)))
(dsf/set-default-action 'select)
))
))
(hide (not (objIsShip (objGetTarget gPlayerShip))))
)
'((title "Change Orders")
(subtitle "Change the mision of your target")
(on-select (block (target)
(if (setq target (objGetTarget gPlayerShip)) (block nil
(dsf/add-action 'select '("Select" 'S) (lambda nil
(god/target-orders target)
))
(dsf/set-default-action 'select)
))
))
(hide (not (objIsShip (objGetTarget gPlayerShip))))
)
;'((title "Change Sovereign")
; (subtitle "...")
; (on-select (block (target)
; (if (setq target (objGetTarget gPlayerShip)) (block nil
; ))
; ))
;)
;'((title "Change Name")
; (subtitle "...")
; (on-select (block (target)
; (if (setq target (objGetTarget gPlayerShip)) (block nil
; ))
; ))
;)
'((title "Destroy")
(subtitle "Just get rid of it")
(on-select (block (target)
(if (setq target (objGetTarget gPlayerShip)) (block nil
(dsf/add-action 'select '("Select" 'S) (lambda nil (block nil
(objDestroy target)
(dsf/screen-delete 'initial-item)
(dsf/back)
(dsf/notify "Destroyed target. You have to target a new ship before you can return to the menu.")
)))
(dsf/set-default-action 'select)
(dsf/set-no-save 'select)
))
))
)
))
(dsf/filter-screen)
(dsf/set-type 'custompicker-small)
(dsf/show-screen)
)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; HELPERS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; TODO: add posibility of making an order queue
(setq god/target-orders (lambda (obj)
(block nil
(dsf/new-screen 'target-orders "Target Orders")
(dsf/set-description (lambda (desc) (block (order target)
(setq order (shpGetOrder obj))
(setq desc (shpGetOrderDesc obj))
(setq target (shpGetOrderTarget obj))
(cat "Current Order: \"" order "\"\n"
(if target (cat "Target: \"" (objGetName target) "\"\n") "")
(if (and desc (not (or (eq desc "Nil") (eq desc "")))) desc "")
)
)))
(dsf/add-list-entries (list
'((title "Attack")
(subtitle "Order ship to attack a target you designate")
(run (block nil
(dsf/new-screen 'target-order-attack "Order Attack")
(dsf/screen-set 'filter-source (objGetTarget gPlayerShip))
(dsf/screen-set 'default-filter-term "/sTE")
(dsf/object-browser)
;; add a list filter to show distance and order by distance
(dsf/add-list-filter (lambda (entries)
(block nil
(enum entries entry (block (dist)
(setq dist (objGetDistance gPlayerShip (fn/get entry 'obj)))
(fn/set entry 'dist dist)
(fn/set entry 'subtitle (cat "Distance: " dist " ls"))
))
(fn/sort entries a b (ls (fn/get a 'dist) (fn/get b 'dist)))
)
))
(dsf/set-description (lambda (desc)
(cat desc ", ordered by distance.")
))
(dsf/add-action 'attack '("Attack" 'A) (lambda nil
(block (t)
(setq t (objGetTarget gPlayerShip))
(shpCancelOrders t)
(shpOrder t 'attack (dsf/get-list-entry 'obj))
(dsf/notify "Ordered Attack")
(dsf/show-screen 'target-orders)
)
))
(dsf/set-default-action 'attack)
(dsf/show-screen)
))
)
'((title "Cancel")
(subtitle "Cancel ships current orders")
(run (block nil
(shpCancelOrders (objGetTarget gPlayerShip))
(dsf/notify "Cancelled Orders")
(dsf/show-screen)
))
)
;'((title "Orbit")
; (subtitle "Order ship to orbit a target you designate at a certain distace")
; (run (block nil
; (dsf/screen 'tmp "Order Orbit")
; ))
;)
;'((title "Escort")
; (subtitle "Order ship to escort a target you designate")
; (run (block nil
; (dsf/screen 'tmp "Order Escort")
; ))
;)
;'((title "Follow")
; (subtitle "Order ship to follow a target you designate")
; (run (block nil
; (dsf/screen 'tmp "Order Follow")
; ))
;)
;'((title "Gate")
; (subtitle "Order ship to gate")
; (run (block nil
; (dsf/screen 'tmp "Order Gate")
; ))
;)
;'((title "Goto")
; (subtitle "Order ships to go to a position you designate")
; (run (block nil
; (dsf/screen 'tmp "Order Goto")
; ))
;)
;'((title "Guard")
; (subtitle "Order ship to guard a target you designate")
; (run (block nil
; (dsf/screen 'tmp "Order Guard")
; ))
;)
;'((title "Hold")
; (subtitle "Order ship to hold position, optionally for a specified amount of time")
; (run (block nil
; (dsf/screen 'tmp "Order Hold")
; ))
;)
;'((title "Dock")
; (subtitle "Order ship to dock with a target you designate")
; (run (block nil
; (dsf/screen 'tmp "Order Dock")
; ))
;)
;'((title "Loot")
; (subtitle "Order ship to loot a target you designate")
; (run (block nil
; (dsf/screen 'tmp "Order Loot")
; ))
;)
;'((title "Patrol")
; (subtitle "Order ship to patrol a target you designate")
; (run (block nil
; (dsf/screen 'tmp "Order Patrol")
; ))
;)
;'((title "Wait")
; (subtitle "Order ship to wait for a specified amount of time")
; (run (block nil
; (dsf/screen 'tmp "Order Wait")
; ))
;)
))
(dsf/add-action 'select '("Select" 'S) (lambda nil
(block nil
(dsf/eval (dsf/get-list-entry 'run))
)
))
(dsf/set-default-action 'select)
(dsf/set-disable-action 'select (lambda nil (not (objGetTarget gPlayerShip))))
(dsf/set-no-save 'select)
;(dsf/screen 'order-target "Set Order Target" 'custompicker)
;(dsf/screen 'order-time "Set Order Time")
;(dsf/pane 'counter)
;(dsf/screen 'order-distance "Set Order Distance")
;(dsf/pane 'counter)
(dsf/filter-screen)
(dsf/set-type 'custompicker-small)
(dsf/show-screen 'target-orders)
)
))
(setq god/object-inspector (lambda (obj)
(block (get-criteria)
(dsf/set-data-from obj)
(dsf/set-type 'itempicker)
(dsf/on-run-action (lambda nil (block (itm)
(if (setq itm (dsf/item))
(dsf/screen-set 'initial-item itm)
(dsf/screen-delete 'initial-item)
)
)))
(dsf/on-initial-item (lambda nil (block (itm)
(if (setq itm (dsf/screen-get 'initial-item))
(eq (dsf/get-item) itm)
True
)
)))
(dsf/add-action 'install '("Install Device" 'I) (lambda nil
(block nil
(dsf/new-screen 'install-device "Install Device")
(dsf/item-browser (map (itmGetTypes "d") itm (itmCreate itm 1)))
(dsf/add-action 'select '("Install" 'I) (lambda nil
(block (itm result)
(setq itm (dsf/get-item))
;; if it is not identified, then do so now
(if (not (itmIsKnown itm))
(itmSetKnown itm)
)
(setq result (god/install-item itm nil nil obj))
(dsf/notify (item result 1))
)
))
(dsf/set-no-save 'select)
(dsf/show-screen)
)
))
(dsf/add-action 'additem '("Add to Cargo Hold" 'A) (lambda nil
(block nil
(dsf/new-screen 'add-to-cargo-hold "Add to Cargo Hold")
(dsf/item-browser (map (itmGetTypes "*") itm (itmCreate itm 1)))
(god/add-to-cargo-action 'add-to-cargo obj)
(dsf/show-screen)
)
))
(dsf/add-action 'remove (lambda nil
(block nil
)
))
(dsf/set-action-handle 'remove (lambda nil
(block (itm)
(setq itm (dsf/get-item))
(switch
(and (itmMatches itm "d") (itmIsInstalled itm))
'("Remove Device" 'R)
(and (itmMatches itm "a") (itmIsInstalled itm))
'("Replace Armor" 'R)
'("Remove Item" 'R)
)
)
))
(dsf/set-no-save 'remove)
)
))
)
</Globals>
</TranscendenceModule>
<!--
vim:ts=2:sw=2:sts=2:ft=tlisp:
-->