1 #include "door_rotating.qh"
3 /*QUAKED spawnfunc_func_door_rotating (0 .5 .8) ? START_OPEN BIDIR DOOR_DONT_LINK BIDIR_IN_DOWN x TOGGLE X_AXIS Y_AXIS
4 if two doors touch, they are assumed to be connected and operate as a unit.
6 TOGGLE causes the door to wait in both the start and end states for a trigger event.
8 BIDIR makes the door work bidirectional, so that the opening direction is always away from the requestor.
9 The usage of bidirectional doors requires two manually instantiated triggers (trigger_multiple), the one to open it in the other direction
10 must have set trigger_reverse to 1.
11 BIDIR_IN_DOWN will the door prevent from reopening while closing if it is triggered from the other side.
13 START_OPEN causes the door to move to its destination when spawned, and operate in reverse. It is used to temporarily or permanently close off an area when triggered (not usefull for touch or takedamage doors).
15 "message" is printed when the door is touched if it is a trigger door and it hasn't been fired yet
16 "angle" determines the destination angle for opening. negative values reverse the direction.
17 "targetname" if set, no touch field will be spawned and a remote button or trigger field activates the door.
18 "health" if set, door must be shot open
19 "speed" movement speed (100 default)
20 "wait" wait before returning (3 default, -1 = never return)
21 "dmg" damage to inflict when blocked (2 default)
28 FIXME: only one sound set available at the time being
31 void door_rotating_reset(entity this)
33 this.angles = this.pos1;
34 this.avelocity = '0 0 0';
35 this.state = STATE_BOTTOM;
36 setthink(this, func_null);
40 void door_rotating_init_startopen(entity this)
42 this.angles = this.movedir;
44 this.pos1 = this.movedir;
48 spawnfunc(func_door_rotating)
51 //if (!this.deathtype) // map makers can override this
52 // this.deathtype = " got in the way";
54 // I abuse "movedir" for denoting the axis for now
55 if (this.spawnflags & 64) // X (untested)
56 this.movedir = '0 0 1';
57 else if (this.spawnflags & 128) // Y (untested)
58 this.movedir = '1 0 0';
60 this.movedir = '0 1 0';
62 if (this.angles_y==0) this.angles_y = 90;
64 this.movedir = this.movedir * this.angles_y;
65 this.angles = '0 0 0';
67 this.max_health = this.health;
68 this.avelocity = this.movedir;
69 if (!InitMovingBrushTrigger(this))
71 this.velocity = '0 0 0';
72 //this.effects |= EF_LOWPRECISION;
73 this.classname = "door_rotating";
75 setblocked(this, door_blocked);
78 if(this.spawnflags & 8)
81 if(this.dmg && (this.message == ""))
82 this.message = "was squished";
83 if(this.dmg && (this.message2 == ""))
84 this.message2 = "was squished by";
88 precache_sound ("plats/medplat1.wav");
89 precache_sound ("plats/medplat2.wav");
90 this.noise2 = "plats/medplat1.wav";
91 this.noise1 = "plats/medplat2.wav";
98 this.lip = 0; // this.lip is used to remember reverse opening direction for door_rotating
101 this.pos2 = this.movedir;
103 // DOOR_START_OPEN is to allow an entity to be lighted in the closed position
104 // but spawn in the open position
105 if (this.spawnflags & DOOR_START_OPEN)
106 InitializeEntity(this, door_rotating_init_startopen, INITPRIO_SETLOCATION);
108 this.state = STATE_BOTTOM;
112 this.takedamage = DAMAGE_YES;
113 this.event_damage = door_damage;
119 settouch(this, door_touch);
121 // LinkDoors can't be done until all of the doors have been spawned, so
122 // the sizes can be detected properly.
123 InitializeEntity(this, LinkDoors, INITPRIO_LINKDOORS);
125 this.reset = door_rotating_reset;