-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathT2Scripts.h
1648 lines (1498 loc) · 50.7 KB
/
T2Scripts.h
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
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/******************************************************************************
* T2Scripts.h
*
* This file is part of Public Scripts
* Copyright (C) 2005-2011 Tom N Harris <telliamed@whoopdedo.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*****************************************************************************/
#ifndef T2SCRIPTS_H
#define T2SCRIPTS_H
#if (_DARKGAME == 2)
#ifndef SCR_GENSCRIPTS
#include <lg/config.h>
#include <lg/objstd.h>
#include <lg/scrservices.h>
#include <lg/links.h>
#include "BaseScript.h"
#include "BaseTrap.h"
#include "CommonScripts.h"
#include "scriptvars.h"
#endif // SCR_GENSCRIPTS
/**
* Script: Burplauncher
* Inherits: BaseScript
* Links: Firer
* Messages: Slain
*
* Destroys emitted objects when this one is slain.
*
* This script is used for burricks' burp projectile. Each projectile continually
* emits a cloud of gas. When the projectile is slain, the entire gas cloud
* should be destroyed with it.
*/
#if !SCR_GENSCRIPTS
class cScr_SlayFirer : public cBaseScript
{
public:
cScr_SlayFirer(const char* pszName, int iHostObjId)
: cBaseScript(pszName, iHostObjId)
{ }
private:
static int LinkIter(ILinkSrv*, ILinkQuery*, IScript*, void*);
protected:
virtual long OnSlain(sSlayMsg*, cMultiParm&);
};
#else // SCR_GENSCRIPTS
GEN_FACTORY("Burplauncher","BaseScript",cScr_SlayFirer)
#endif // SCR_GENSCRIPTS
/**
* Script: CollapseFloor
* Inherits: BasePPlateScript
* Messages: PressurePlateActive
* Links: Corpse, Flinderize
*
* A collapsing floor is a pressure plate that will disappear when depressed.
* Use a ``Corpse`` or ``Flinderize`` links to have a solid object be created
* in its place that will fall to the ground.
*/
#if !SCR_GENSCRIPTS
class cScr_CollapseFloor : public cBasePPlateScript
{
public:
cScr_CollapseFloor(const char* pszName, int iHostObjId)
: cBasePPlateScript(pszName, iHostObjId)
{ }
protected:
virtual long OnPressurePlateActive(sScrMsg*, cMultiParm&);
virtual long OnMessage(sScrMsg*,cMultiParm&);
};
#else // SCR_GENSCRIPTS
GEN_FACTORY("CollapseFloor","BaseScript",cScr_CollapseFloor)
#endif // SCR_GENSCRIPTS
/**
* Script: Elemental
* Inherits: BaseAIScript
* Messages: Damage, Slain, Die
* Links: ParticleAttachement
* Properties: Shape\Scale, Tweq\Scale, Game\Damage Model\Hit Points
* Parameters: curve(integer) - Adjust the rate of change relative to health. See ``TrapPhantom``.
*
* An elemental AI grows and shrinks based on its health. When it is ``Slain``,
* a ``Tweq\Scale`` is activated so it shrinks before being destroyed.
*
* To get the complete __Thief 1__ behavior, use ``SlayHaltSpeech`` as well.
*/
#if !SCR_GENSCRIPTS
class cScr_Elemental : public cBaseAIScript
{
public:
cScr_Elemental(const char* pszName, int iHostObjId)
: cBaseAIScript(pszName, iHostObjId)
{ }
protected:
void UpdateScale();
void NotifyParticles(const char* pszMsg);
protected:
virtual long OnSim(sSimMsg*, cMultiParm&);
virtual long OnSlain(sSlayMsg*, cMultiParm&);
virtual long OnDamage(sDamageScrMsg*, cMultiParm&);
virtual long OnTweqComplete(sTweqMsg*, cMultiParm&);
};
#else // SCR_GENSCRIPTS
GEN_FACTORY("Elemental","BaseAIScript",cScr_Elemental)
#endif // SCR_GENSCRIPTS
/**
* Script: FireElement
* Inherits: Elemental
* Messages: Damage, Alertness, Mood0, Mood1, Mood2, Mood3
* Properties: Renderer\Dynamic Light, Renderer\Extra Light, Renderer\Transparency
* Metaproperties: BigHeatSource
*
* Changes color and transparency based on alertness level. A ''Mood'' message
* is sent to ``ParticleAttachement`` links that matches the level. On high alert,
* the metaproperty ``BigHeatSource`` is added to the object.
*/
#if !SCR_GENSCRIPTS
class cScr_FireElement : public cScr_Elemental
{
public:
cScr_FireElement(const char* pszName, int iHostObjId)
: cScr_Elemental(pszName, iHostObjId)
{ }
protected:
virtual long OnAlertness(sAIAlertnessMsg*, cMultiParm&);
virtual long OnDamage(sDamageScrMsg*, cMultiParm&);
};
#else // SCR_GENSCRIPTS
GEN_FACTORY("FireElement","Elemental",cScr_FireElement)
#endif // SCR_GENSCRIPTS
/**
* Script: FireElemSparx
* Inherits: BaseScript
* Messages: TurnOn, TurnOff, Mood0, Mood1, Mood2, Mood3, Die
*
* Controls particle SFX. The ''Mood'' messages change the color of
* the particles. The object is destroyed when ``Die`` is received.
*/
#if !SCR_GENSCRIPTS
class cScr_FireSparx : public cBaseScript
{
public:
cScr_FireSparx(const char* pszName, int iHostObjId)
: cBaseScript(pszName, iHostObjId)
{ }
private:
void SetColor(int iColor);
protected:
virtual long OnMessage(sScrMsg*, cMultiParm&);
virtual long OnTurnOn(sScrMsg*, cMultiParm&);
virtual long OnTurnOff(sScrMsg*, cMultiParm&);
};
#else // SCR_GENSCRIPTS
GEN_FACTORY("FireElemSparx","BaseScript",cScr_FireSparx)
#endif // SCR_GENSCRIPTS
/**
* Script: HotPlate
* Inherits: BaseScript
* Messages: PhysContactCreate, PhysContactDestroy, HotPlateHeat
* Properties: Renderer\Extra Light, Script\Timing
* Metaproperties: HotPlateHeat, HotPlateCool
* Stims: WaterStim
* SeeAlso: HotPlateControl
*
* Initiate stimulus contact with object that touch this one.
* When it gets the message ``HotPlateHeat``, the ``Renderer\Extra Light``
* property will be set according to the first message argument. If it is
* greater than 0, the metaproperty ``HotPlateHeat`` is added.
*
* If the object is hit with a ``WaterStim``, it will force the object to be
* turned off for a period of time. You should create a receptron for
* ``WaterStim`` set to the appropriate sensitivity and the reaction
* ''Send to Scripts''. To turn off the object, a clone of the controller is
* created with the tweq configured to send diminishing ``HotPlateHeat``
* messages. Messages that would increase the value of ``Renderer\Extra Light``
* are ignored. The object will be disabled until it receives a ``TurnOff``
* message followed by a ``TurnOn``. If you set the ``Script\Timing``
* property, it will count that many ``TurnOff`` messages before activating
* again.
*/
#if !SCR_GENSCRIPTS
class cScr_HotPlate : public cBaseScript
{
public:
cScr_HotPlate(const char* pszName, int iHostObjId);
protected:
virtual long OnBeginScript(sScrMsg*, cMultiParm&);
virtual long OnEndScript(sScrMsg*, cMultiParm&);
virtual long OnPhysContactCreate(sPhysMsg*, cMultiParm&);
virtual long OnPhysContactDestroy(sPhysMsg*, cMultiParm&);
virtual long OnHotPlateHeat(sScrMsg*, cMultiParm&);
virtual long OnWaterStimStimulus(sStimMsg*, cMultiParm&);
virtual long OnTurnOn(sScrMsg*, cMultiParm&);
virtual long OnTurnOff(sScrMsg*, cMultiParm&);
private:
static long HandleHotPlateHeat(cScript*, sScrMsg*, sMultiParm*);
static long HandleWaterStimStimulus(cScript*, sScrMsg*, sMultiParm*);
};
#else // SCR_GENSCRIPTS
GEN_FACTORY("HotPlate","BaseScript",cScr_HotPlate)
#endif // SCR_GENSCRIPTS
/**
* Script: HotPlateControl
* Inherits: BaseScript
* Messages: TweqComplete, HotPlateHeat, Heat?
* Links: ControlDevice
* Properties: Tweq\Flicker, Tweq\Joints, Shape\Joint Positions
* SeeAlso: HotPlate
*
* A flicker tweq periodically checks the position of the first joint on this object.
* Each linked object will get the message ``HotPlateHeat`` with the joint position
* in the first message argument. When the direction of the joint changes from
* reverse to forward or forward to reverse then the message ``TurnOn`` or
* ``TurnOff`` will be sent.
*/
#if !SCR_GENSCRIPTS
class cScr_HotPlateCtrl : public cBaseScript
{
public:
cScr_HotPlateCtrl(const char* pszName, int iHostObjId)
: cBaseScript(pszName, iHostObjId)
{ }
protected:
virtual long OnTweqComplete(sTweqMsg*, cMultiParm&);
virtual long OnMessage(sScrMsg*, cMultiParm&);
};
#else // SCR_GENSCRIPTS
GEN_FACTORY("HotPlateControl","BaseScript",cScr_HotPlateCtrl)
#endif // SCR_GENSCRIPTS
/**
* Script: ModelByCount
* Inherits: BaseScript
* Messages: Contained, Create
* Properties: Engine Features\Stack Count, Tweq\Models
*
* Changes the shape of the object based on the stack count. This
* makes a combining object look different when more pieces are
* picked up. But it does not change the shape when it is dropped
* or used. So it should only be used for objects that cannot be dropped
* or frobbed in inventory.
*/
#if !SCR_GENSCRIPTS
class cScr_ModelByCount : public cBaseScript
{
public:
cScr_ModelByCount(const char* pszName, int iHostObjId)
: cBaseScript(pszName, iHostObjId),
bUpdating(false)
{ }
private:
void UpdateModel(void);
bool bUpdating;
protected:
virtual long OnSim(sSimMsg*, cMultiParm&);
virtual long OnContained(sContainedScrMsg*, cMultiParm&);
//virtual long OnCombine(sCombineScrMsg*, cMultiParm&);
virtual long OnCreate(sScrMsg*, cMultiParm&);
};
#else // SCR_GENSCRIPTS
GEN_FACTORY("ModelByCount","BaseScript",cScr_ModelByCount)
#endif // SCR_GENSCRIPTS
/**
* Script: SecureDoor
* Inherits: BaseDoorScript
* Messages: DoorOpening, DoorClose
* Links: AIWatchObj
* Objects: Human
* Parameter: watcher(object) - Archetype of objects that will be linked to the door. Default is ``Human``.
*
* Creates ``AIWatchObj`` links when a door is opened or closed. If the door
* starts closed the links are added when the door is opened, and vice-versa.
*/
#if !SCR_GENSCRIPTS
class cScr_SecureDoor : public cBaseDoorScript
{
public:
cScr_SecureDoor(const char* pszName, int iHostObjId)
: cBaseDoorScript(pszName, iHostObjId)
{ }
private:
eDoorState GetDoorState(void);
cAnsiStr GetWatchers(void);
protected:
virtual long OnSim(sSimMsg*, cMultiParm&);
virtual long OnTimer(sScrTimerMsg*, cMultiParm&);
virtual long OnDoorOpening(sDoorMsg*, cMultiParm&);
virtual long OnDoorClose(sDoorMsg*, cMultiParm&);
};
#else // SCR_GENSCRIPTS
GEN_FACTORY("SecureDoor","BaseDoorScript",cScr_SecureDoor)
#endif // SCR_GENSCRIPTS
/**
* Script: StickyVines
* Inherits: BaseScript
* Messages: PhysCollision
* Objects: JunkEarthWebs
*
* When the object collides with the ``Player``, a ``JunkEarthWebs`` object
* is created and added to his inventory.
*/
#if !SCR_GENSCRIPTS
class cScr_VineShot : public cBaseScript
{
public:
cScr_VineShot(const char* pszName, int iHostObjId)
: cBaseScript(pszName, iHostObjId)
{ }
protected:
virtual long OnBeginScript(sScrMsg*, cMultiParm&);
virtual long OnEndScript(sScrMsg*, cMultiParm&);
virtual long OnPhysCollision(sPhysMsg*, cMultiParm&);
};
#else // SCR_GENSCRIPTS
GEN_FACTORY("StickyVines","BaseScript",cScr_VineShot)
#endif // SCR_GENSCRIPTS
/**
* Script: JunkVines
* Inherits: BaseScript
* Messages: Contained
*
* Initiates stimulus contact when it is in the ``Player``'s inventory.
*/
#if !SCR_GENSCRIPTS
class cScr_JunkVines : public cBaseScript
{
public:
cScr_JunkVines(const char* pszName, int iHostObjId)
: cBaseScript(pszName, iHostObjId)
{ }
protected:
virtual long OnContained(sContainedScrMsg*, cMultiParm&);
};
#else // SCR_GENSCRIPTS
GEN_FACTORY("JunkVines","BaseScript",cScr_JunkVines)
#endif // SCR_GENSCRIPTS
/**
* Script: TrapCreate
* Inherits: BaseTrap
* Links: Contains
*
* When turned on, contained objects are teleported here then the
* links are destroyed.
*/
#if !SCR_GENSCRIPTS
class cScr_CreateTrap : public cBaseTrap
{
public:
cScr_CreateTrap(const char* pszName, int iHostObjId)
: cBaseTrap(pszName, iHostObjId)
{ }
private:
static int LinkIter(ILinkSrv*, ILinkQuery*, IScript*, void*);
protected:
virtual long OnSwitch(bool, sScrMsg*, cMultiParm&);
};
#else // SCR_GENSCRIPTS
GEN_FACTORY("TrapCreate","BaseTrap",cScr_CreateTrap)
#endif // SCR_GENSCRIPTS
/**
* Script: WatchMe
* Inherits: BaseScript
* Messages: BeginScript
* Links: AIWatchObj
* Parameter: watcher(object) - Archetype of objects that will be linked to this one. Default is ``Human``.
*
* Creates ``AIWatchObj`` links when the object is created.
*/
#if !SCR_GENSCRIPTS
class cScr_WatchMe : public cBaseScript
{
public:
cScr_WatchMe(const char* pszName, int iHostObjId)
: cBaseScript(pszName, iHostObjId)
{ }
protected:
virtual long OnBeginScript(sScrMsg*, cMultiParm&);
};
#else // SCR_GENSCRIPTS
GEN_FACTORY("WatchMe","BaseScript",cScr_WatchMe)
#endif // SCR_GENSCRIPTS
/**
* Script: WindowShade
* Inherits: BaseTrap
* Messages: Toggle, Slain
* Links: ControlDevice, ParticleAttachement
* Properties: Renderer\Anim Light, Script\TerrReplaceOn, Script\TerrReplaceOff, Script\TerrReplaceDestroy
*
* A breakable animated light for windows. Textures on nearby terrain are changed to
* match the light state. When the light is slain, a broken texture will permanently
* replace the on and off textures. Linked objects and SFX are also triggered when
* the light changes.
*/
#if !SCR_GENSCRIPTS
class cScr_WindowShade : public cBaseTrap
{
public:
cScr_WindowShade(const char* pszName, int iHostObjId)
: cBaseTrap(pszName, iHostObjId),
SCRIPT_VAROBJ(cScr_WindowShade,m_iOnMode,iHostObjId),
SCRIPT_VAROBJ(cScr_WindowShade,m_iOffMode,iHostObjId),
SCRIPT_VAROBJ(cScr_WindowShade,m_bBroken,iHostObjId)
{ }
private:
script_int m_iOnMode;
script_int m_iOffMode;
script_int m_bBroken;
protected:
void InitModes(void);
void TurnLightOn(void);
void TurnLightOff(void);
bool IsLightOn(void);
void Trigger(bool bTurnOn);
protected:
virtual long OnBeginScript(sScrMsg*, cMultiParm&);
virtual long OnSim(sSimMsg*, cMultiParm&);
virtual long OnSlain(sSlayMsg*, cMultiParm&);
virtual long OnMessage(sScrMsg*, cMultiParm&);
virtual long OnSwitch(bool, sScrMsg*, cMultiParm&);
};
#else // SCR_GENSCRIPTS
GEN_FACTORY("WindowShade","BaseTrap",cScr_WindowShade)
#endif // SCR_GENSCRIPTS
/**
* Script: ControlWindowShade
* Inherits: WindowShade
* Properties: Script\Timing
* Parameters: auto_time_max(time), auto_time_min(time)
*
* Window light that automatically toggles at random intervals. Periodically,
* the script turns the light on or off. The ``Script\Timing`` property is
* the probability that the light will be turned on. The time period until
* the next change is randomly chosen from 5 to 15 seconds. The range of
* time can be configured with the $$auto_time_max$$ and $$auto_time_min$$
* parameters.
*/
#if !SCR_GENSCRIPTS
class cScr_WindowShadeRandom : public cScr_WindowShade
{
public:
cScr_WindowShadeRandom(const char* pszName, int iHostObjId)
: cScr_WindowShade(pszName, iHostObjId),
SCRIPT_VAROBJ(cScr_WindowShadeRandom,m_hTimer,iHostObjId)
{ }
private:
script_handle<tScrTimer> m_hTimer;
protected:
void SetAutoTimer(bool);
protected:
virtual long OnBeginScript(sScrMsg*, cMultiParm&);
virtual long OnSim(sSimMsg*, cMultiParm&);
virtual long OnSlain(sSlayMsg*, cMultiParm&);
virtual long OnTimer(sScrTimerMsg*, cMultiParm&);
virtual long OnSwitch(bool, sScrMsg*, cMultiParm&);
};
#else // SCR_GENSCRIPTS
GEN_FACTORY("ControlWindowShade","WindowShade",cScr_WindowShadeRandom)
#endif // SCR_GENSCRIPTS
/**
* Script: TrapSlayer
* Inherits: BaseTrap
* Links: ControlDevice
* Properties: Game\Damage Model\Hit Points
* Stims: BashStim
* Parameter: damage(object) - Type of damage stimulus.
*
* Slay linked objects by damaging them with a ``BashStim``.
*/
#if !SCR_GENSCRIPTS
class cScr_SlayTrap : public cBaseTrap
{
public:
cScr_SlayTrap(const char* pszName, int iHostObjId)
: cBaseTrap(pszName, iHostObjId)
{ }
private:
static int LinkIter(ILinkSrv*, ILinkQuery*, IScript*, void*);
protected:
virtual long OnSwitch(bool, sScrMsg*, cMultiParm&);
};
#else // SCR_GENSCRIPTS
GEN_FACTORY("TrapSlayer","BaseTrap",cScr_SlayTrap)
#endif // SCR_GENSCRIPTS
/**
* Script: TrapTerminator
* Inherits: BaseTrap
* Links: ControlDevice
*
* Simply destroys linked objects. Doesn't use ``Slain``.
* Don't use this for doors or pressure plates that have the ''Blocks vision''
* flag set.
*/
#if !SCR_GENSCRIPTS
class cScr_ReallyDestroy : public cBaseTrap
{
public:
cScr_ReallyDestroy(const char* pszName, int iHostObjId)
: cBaseTrap(pszName, iHostObjId)
{ }
private:
static int LinkIter(ILinkSrv*, ILinkQuery*, IScript*, void*);
protected:
virtual long OnSwitch(bool, sScrMsg*, cMultiParm&);
};
#else // SCR_GENSCRIPTS
GEN_FACTORY("TrapTerminator","BaseTrap",cScr_ReallyDestroy)
#endif // SCR_GENSCRIPTS
/**
* Script: CorpseFrobFixed
* Inherits: BaseAIScript
* Messages: AIModeChange, Slain, FrobWorldEnd
* Metaproperties: FrobInert
*
* Makes AI frobbable when they are disabled. This script corrects a bug
* in ``CorpseFrobHack`` when searching a corpse. Objects contained
* by the AI that can't be picked up will be ignored.
*/
#if !SCR_GENSCRIPTS
class cScr_NewCorpseFrob : public cBaseAIScript
{
public:
cScr_NewCorpseFrob(const char* pszName, int iHostObjId)
: cBaseAIScript(pszName, iHostObjId)
{ }
protected:
virtual long OnBeginScript(sScrMsg*, cMultiParm&);
virtual long OnSlain(sSlayMsg*, cMultiParm&);
virtual long OnAIModeChange(sAIModeChangeMsg*, cMultiParm&);
virtual long OnFrobWorldEnd(sFrobMsg*, cMultiParm&);
};
#else // SCR_GENSCRIPTS
GEN_FACTORY("CorpseFrobFixed","BaseAIScript",cScr_NewCorpseFrob)
#endif // SCR_GENSCRIPTS
/**
* Script: FireShadowEcology
* Inherits: BaseScript
* Messages: TweqComplete
* Links: ControlDevice, Firer
* Properties: Tweq\Flicker
* Schemas: (Event Activate)
*
* Respawn a creature after it dies. A ``Tweq\Flicker`` fires to test if the
* creature needs to be spawned. The tweq flags can be set to only fire when
* the player is not looking at the spawn point. That way the creature will
* only appear offscreen. The creature archetype to spawn is linked to with
* ``ControlDevice``. When spawned, a ``Firer`` link is set from the creature
* to the spawn point. A new creature is spawned only when there is no ``Firer``
* link to this object. Sends ``TurnOn`` when a new creature is created.
*/
#if !SCR_GENSCRIPTS
class cScr_SpawnEcology : public cBaseScript
{
public:
cScr_SpawnEcology(const char* pszName, int iHostObjId)
: cBaseScript(pszName, iHostObjId)
{ }
private:
void MakeFirer(object iSpawnObj);
void AttemptSpawn(void);
protected:
virtual long OnTimer(sScrTimerMsg*, cMultiParm&);
virtual long OnTweqComplete(sTweqMsg*, cMultiParm&);
};
#else // SCR_GENSCRIPTS
GEN_FACTORY("FireShadowEcology","BaseScript",cScr_SpawnEcology)
#endif // SCR_GENSCRIPTS
/**
* Script: FireShadowFlee
* Inherits: BaseScript
* Messages: Slain
* Links: CorpsePart
* Properties: Creature\TimeWarp
* Metaproperties: M-FireShadowFlee
*
* A creature that flees when killed. On ``Slain``, the creature drops its
* ``CorpsePart`` linked objects and gets the ``M-FireShadowFlee`` metaproperty.
* The creature speed is accelerated until it disappears from the player's
* view, or after 15 seconds. Then it is destroyed.
*/
#if !SCR_GENSCRIPTS
class cScr_CorpseFlee : public cBaseScript
{
public:
cScr_CorpseFlee(const char* pszName, int iHostObjId)
: cBaseScript(pszName, iHostObjId)
{ }
protected:
virtual long OnTimer(sScrTimerMsg*, cMultiParm&);
virtual long OnSlain(sSlayMsg*, cMultiParm&);
};
#else // SCR_GENSCRIPTS
GEN_FACTORY("FireShadowFlee","BaseScript",cScr_CorpseFlee)
#endif // SCR_GENSCRIPTS
/*** miss03 ***/
/**
* Script: ReallyLocked
* Inherits: BaseScript
* Messages: NowLocked, NowUnlocked
* Metaproperties: FrobInert
*
* Makes an object unfrobbable while it is locked.
*/
#if !SCR_GENSCRIPTS
class cScr_LockFrobInert : public cBaseScript
{
public:
cScr_LockFrobInert(const char* pszName, int iHostObjId)
: cBaseScript(pszName, iHostObjId)
{ }
protected:
virtual long OnSim(sSimMsg*, cMultiParm&);
virtual long OnNowLocked(sScrMsg*, cMultiParm&);
virtual long OnNowUnlocked(sScrMsg*, cMultiParm&);
};
#else // SCR_GENSCRIPTS
GEN_FACTORY("ReallyLocked","BaseScript",cScr_LockFrobInert)
#endif // SCR_GENSCRIPTS
/**
* Script: FactoryBase
* Inherits: BaseScript
* Messages: TweqComplete, TurnOn, TurnOff, SynchUp, Target?, Report
* Links: ControlDevice, FrobProxy, Owns
* Properties: Tweq\Joints, Tweq\JointState
* Schemas: (Event StateChange, DirectionState ??direction??)
* SeeAlso: FactoryLever, FactoryMold, FactoryCauldron, FactoryGauge, FactoryWorker
*
* A factory is a group of levers, molds, cauldrons, and gauges that
* can be used to manufacture new objects. This script controls the
* joint tweqs on the objects. If the object has a ``FrobProxy`` link
* then the joint tweq on the proxy object is kept in synch with this one.
*
* Most factory objects will send ``TurnOn`` to ``ControlDevice`` links
* when the tweq moves forward, and ``TurnOff`` when moving backward.
* After an action completes the ``Report`` is sent to objects that link to
* this one with ``Owns``. The ``FactoryWorker`` script uses this to
* automate actions.
*/
#if !SCR_GENSCRIPTS
class cScr_Factory : public cBaseScript
{
public:
cScr_Factory(const char* pszName, int iHostObjId);
protected:
// Compatible with StdLever TargState, I hope?
enum eLeverDirection
{
kLeverDirectionBackward = 0,
kLeverDirectionForward = 1
};
virtual void BeginGoForward(void)
{ }
virtual void EndGoForward(void)
{ }
virtual void BeginGoBackward(void)
{ }
virtual void EndGoBackward(void)
{ }
virtual eLeverDirection NextDirection(void);
virtual void DoReport(void);
virtual char const * ReportType(void);
bool IsLocked(void);
void DoTrigger(bool bTurnOn);
void DoTrigger(bool bTurnOn, bool bReverse, const char* pszParam);
void DoTrigger(const char* pszMsg, bool bReverse, const char* pszParam);
void DoGoForward(void);
void DoGoBackward(void);
void DoSetState(eLeverDirection dir);
private:
static long HandleReport(cScript* pScript, sScrMsg* pMsg, sMultiParm* pReply);
static long HandleSynchUp(cScript* pScript, sScrMsg* pMsg, sMultiParm* pReply);
static long HandleTarget(cScript* pScript, sScrMsg* pMsg, sMultiParm* pReply);
static int TriggerIter(ILinkSrv*, ILinkQuery*, IScript*, void*);
protected:
virtual long OnTweqComplete(sTweqMsg*, cMultiParm&);
virtual long OnTurnOn(sScrMsg*, cMultiParm&);
virtual long OnTurnOff(sScrMsg*, cMultiParm&);
virtual long OnReport(sScrMsg*, cMultiParm&);
virtual long OnSynchUp(sScrMsg*, cMultiParm&);
virtual long OnTarget(sScrMsg*, cMultiParm&);
};
#else // SCR_GENSCRIPTS
GEN_FACTORY("FactoryBase","BaseScript",cScr_Factory)
#endif // SCR_GENSCRIPTS
/**
* Script: FactoryLever
* Inherits: FactoryBase
* Alias: FactoryCauldronLever, FactoryMoldLever
* Messages: FrobWorldEnd
* Links: ScriptParams(LockMe), ScriptParams(ErrorOutput), Lock
* SeeAlso: ReallyLocked
*
* Levers in a factory can be frobbed. Using a lever sends ``TurnOn`` to $$LockMe$$
* links. Trying to frob a locked lever will send ``TurnOn`` to $$ErrorOutput$$ links.
*
* === How to Use ===
* One lever should control the cauldron, and another controls the mold. Each
* lever has a ``FnordLock`` associated with it. The cauldron lever links to the
* lock for the mold lever with a $$LockMe$$ link. The mold lever locks the
* cauldron lever's lock. The mold also has a $$LockMe$$ link to the cauldron
* lever's lock. Both levers link to an ``alarmlite`` with $$ErrorOutput$$.
*/
#if !SCR_GENSCRIPTS
class cScr_FactoryLever : public cScr_Factory
{
public:
cScr_FactoryLever(const char* pszName, int iHostObjId)
: cScr_Factory(pszName, iHostObjId)
{ }
protected:
virtual void BeginGoForward(void);
virtual void EndGoForward(void);
virtual void EndGoBackward(void);
virtual char const * ReportType(void);
protected:
virtual long OnBeginScript(sScrMsg*, cMultiParm&);
virtual long OnFrobWorldEnd(sFrobMsg*, cMultiParm&);
};
#else // SCR_GENSCRIPTS
GEN_FACTORY("FactoryLever","FactoryBase",cScr_FactoryLever)
GEN_ALIAS("FactoryCauldronLever","FactoryBase",cScr_FactoryLever,Cauldron)
GEN_ALIAS("FactoryMoldLever","FactoryBase",cScr_FactoryLever,Mold)
#endif // SCR_GENSCRIPTS
/**
* Script: FactoryMold
* Inherits: FactoryLever
* Messages: FrobToolEnd, Contained, SocketMe, UnsocketMe, Full, Full?
* Links: ScriptParams(Mold), Owns, Contains
* Properties: Physics\Model\Attributes
* SeeAlso: MoldSocket
*
* A mold can be moved onto a socket where it will create an object. Using the
* mold as a tool will send ``SocketMe`` to the socket. ``UnsocketMe`` is
* sent when the mold is picked up.
*
* On a socket the mold will activate $$LockMe$$ links when it is open. The
* mold needs to have been filled by receiving the message ``Full``. A new object
* will be created and teleported to the $$COG Offset$$ of the mold. The object
* to create is found from a ``Contains`` link that can be on an archetype of
* the mold.
*
* === How to Use ===
* The mold is controlled by a mold lever. Link to the archetype of a product
* with ``Contains``. Set the $$COG Offset$$ field of ``Physics\Model\Attributes``
* to where the product should appear. If it is a movable mold, the ``Engine Features\FrobInfo``
* property should have a $$WorldAction$$ of ''Move,Script'' and $$InvAction$$ of ''Script''.
* An unmovable mold has only a $$WorldAction$$ of ''Script''.
*
* When the mold is in-place, it is controlled by the mold lever. A ``Lock`` link goes
* to the ``FnordLock`` that also locks the mold lever. There is a $$LockMe$$ link
* to the cauldron lock. The mold can link with ``ControlDevice`` to a ``SteamPuffSpout``.
* If there is a socket, the mold links to it with ``Owns``.
*/
#if !SCR_GENSCRIPTS
class cScr_FactoryMold : public cScr_FactoryLever
{
public:
cScr_FactoryMold(const char* pszName, int iHostObjId)
: cScr_FactoryLever(pszName, iHostObjId),
SCRIPT_VAROBJ(cScr_FactoryGauge,m_iState,iHostObjId)
{ }
protected:
virtual void BeginGoForward(void);
virtual void EndGoForward(void);
virtual void BeginGoBackward(void);
virtual void EndGoBackward(void);
virtual char const * ReportType(void);
private:
script_int m_iState;
static int ProductOwnerIter(ILinkSrv*, ILinkQuery*, IScript*, void*);
protected:
virtual long OnBeginScript(sScrMsg*, cMultiParm&);
virtual long OnFrobToolEnd(sFrobMsg*, cMultiParm&);
virtual long OnFrobWorldEnd(sFrobMsg*, cMultiParm&);
virtual long OnFrobWorldBegin(sFrobMsg*, cMultiParm&);
virtual long OnContained(sContainedScrMsg*, cMultiParm&);
virtual long OnMessage(sScrMsg*, cMultiParm&);
};
#else // SCR_GENSCRIPTS
GEN_FACTORY("FactoryMold","FactoryLever",cScr_FactoryMold)
#endif // SCR_GENSCRIPTS
/**
* Script: MoldSocket
* Inherits: BaseScript
* Messages: SocketMe, UnsocketMe
* Links: ScriptParams, Owns
* Properties: Physics\Model\Attributes, Engine Features\KeySrc, Engine Features\KeyDst
*
* Movable molds are placed on a socket before they can be used. The socket holds
* template links that are transfered to the mold when it is placed on the socket. These
* links are ``ScriptParams`` with the data set to the flavor of the real link. The template
* for a ``ScriptParams`` link can be named ''SP:??data??'' (or ''~SP:??data??'') and the link
* data will also be set on the new link.
*
* When a mold is frobbed on a socket, the ``SocketMe`` message is sent to try using
* the mold. If the ``Engine Features\KeyDst`` property is set on the socket, then the
* mold must have a matching ``Engine Features\KeySrc`` property. Otherwise any mold
* can be used. The mold will be teleported to the location of the socket plus the
* $$COG Offset$$ from the ``Physics\Model\Attributes`` property. An ``Owns`` link
* is created from the mold to the socket.
*
* === How to Use ===
* The mold socket has ``ScriptParams`` links to all the objects that a mold would
* link to. The link data is the type of link. For the mold lever, set the data to $$~ControlDevice$$.
* To the ``FnordLock`` that also locks the mold lever, the data is $$Lock$$. to the
* ``FnordLock`` for the cauldron lever, $$SP:LockMe$$. Link to the gauge with the
* data $$~SP:Mold$$.
*/
#if !SCR_GENSCRIPTS
class cScr_MoldSocket : public cBaseScript
{
public:
cScr_MoldSocket(const char* pszName, int iHostObjId)
: cBaseScript(pszName, iHostObjId)
{ }
protected:
virtual long OnMessage(sScrMsg*, cMultiParm&);
};
#else // SCR_GENSCRIPTS
GEN_FACTORY("MoldSocket","BaseScript",cScr_MoldSocket)
#endif // SCR_GENSCRIPTS
/**
* Script: FactoryCauldron
* Inherits: FactoryBase
* Messages: GoForward, GoReverse, Halt
* Links: ScriptParams(Synch), ScriptParams(Sparks)
* Properties: Tweq\Models, Renderer\AnimLight
* Schemas: cauldron_lp, lava_pour, cauldron_pivot
*
* A cauldron manipulates the model tweq and light as well as the joints of the
* object. Another tweqable object can be linked to with $$Synch$$ and it will
* receive ``GoForward`` and ``GoReverse`` messages when the cauldron
* is moving. An object linked with $$Sparks$$ will be turned on when the
* cauldron is activated.
*
* Schemas with the names ``cauldron_lp``, ``cauldron_pivot``, and ``lava_pour``
* are played when the cauldron is inactive, moving, and activated respectively.
*
* === How to Use ===
* The cauldron is controlled by a cauldron lever. It links with ``ControlDevice``
* to a gauge. There can be a $$Synch$$ link to a ``MovingGear`` and a $$Sparks$$
* link to a ``SparkShower``.
*/
#if !SCR_GENSCRIPTS
class cScr_FactoryCauldron : public cScr_Factory
{
public:
cScr_FactoryCauldron(const char* pszName, int iHostObjId)
: cScr_Factory(pszName, iHostObjId)
{ }
protected:
virtual void BeginGoForward(void);
virtual void EndGoForward(void);
virtual void BeginGoBackward(void);
virtual void EndGoBackward(void);
virtual char const * ReportType(void);
protected:
virtual long OnSim(sSimMsg*, cMultiParm&);
};
#else // SCR_GENSCRIPTS
GEN_FACTORY("FactoryCauldron","FactoryBase",cScr_FactoryCauldron)
#endif // SCR_GENSCRIPTS
/**
* Script: FactoryGauge
* Inherits: FactoryBase
* Messages: Halt, Full
* Links: ScriptParams(Mold)
* Properties: Tweq\Joints
* Parameters: rates(vector), overflow(number)
*
* A guage has two stages. When activated, it moves to the end of the first stage,
* then sends ``Full`` to the $$Mold$$ link. The guage will stop moving when it
* gets the ``Halt`` message and turning it on again will resume from that position.
* The tweq continues past the end of the first stage until the second stage ends.
* Then it automatically reverses and sends ``TurnOn`` along ``ControlDevice``
* links.
*
* The speed and positions of the first stage are set in the ``Tweq\Joints`` property.
* For the second stage, the value of the $$overflow$$ parameter is added to the
* end of the first stage. The default overflow is ''20''. The speed of the tweq is
* different for each stage, and also when moving backward. The $$rates$$
* parameter is three numbers for the first, second, and reverse speeds. The default
* speeds are ''1.75,0.5,30''.
*
* === How to Use ===
* Set the joint tweq to the normal speed and the maximum position where the
* mold will be filled. The gauge is controlled by the cauldron. It links to an
* ``alarmlite`` with ``ControlDevice``. Use an ``Inverter`` trap to link to the
* cauldron lever. When a mold is in-place, there is a $$Mold$$ link to the mold.
*/
#if !SCR_GENSCRIPTS
class cScr_FactoryGauge : public cScr_Factory
{
public:
cScr_FactoryGauge(const char* pszName, int iHostObjId)
: cScr_Factory(pszName, iHostObjId),
SCRIPT_VAROBJ(cScr_FactoryGauge,m_iState,iHostObjId),
SCRIPT_VAROBJ(cScr_FactoryGauge,m_fMidJoint,iHostObjId)
{ }
protected:
virtual void BeginGoForward(void);
virtual void EndGoForward(void);