Skip to content

Commit

Permalink
Override triggers for doors and plats
Browse files Browse the repository at this point in the history
  • Loading branch information
4LT committed Nov 19, 2023
1 parent b6c0822 commit 84cfcdc
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 8 deletions.
2 changes: 2 additions & 0 deletions conduit.fgd
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@
message(string) : "Message if touched"
health(integer) : "Health (shootable)" : 0
squad(string) : "Explicitly link doors" : ""
trig_override(target_source) : "Override trigger"
spawnflags(flags) =
[
1 : "Starts Open" : 0
Expand Down Expand Up @@ -488,6 +489,7 @@
]
speed(integer) : "Speed" : 150
height(integer) : "Travel altitude (can be negative)" : 0
trig_override(target_source) : "Override trigger"
sounds(choices) : "Sound" : 1 =
[
0: "None"
Expand Down
2 changes: 2 additions & 0 deletions defs.qc
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,8 @@ float AS_MISSILE = 4;
.vector pos1, pos2; // top and bottom positions
.float height;

.string trig_override;

//
// sounds
//
Expand Down
23 changes: 19 additions & 4 deletions doors.qc
Original file line number Diff line number Diff line change
Expand Up @@ -344,15 +344,26 @@ entity(vector fmins, vector fmaxs) spawn_field =
entity trigger;
vector t1, t2;

trigger = spawn();
if (self.trig_override != "") {
trigger = find(world, targetname, self.trig_override);
if (!trigger) {
objerror("Invalid override trigger");
}
} else {
trigger = spawn();
}

trigger.movetype = MOVETYPE_NONE;
trigger.solid = SOLID_TRIGGER;
trigger.owner = self;
trigger.touch = door_trigger_touch;

t1 = fmins;
t2 = fmaxs;
setsize(trigger, t1 - '60 60 8', t2 + '60 60 8');
if (self.trig_override == "") {
t1 = fmins;
t2 = fmaxs;
setsize(trigger, t1 - '60 60 8', t2 + '60 60 8');
}

return(trigger);
};

Expand Down Expand Up @@ -404,6 +415,10 @@ void() LinkDoors =
{
self.owner = starte; // master door

if (self.trig_override != "") {
self.owner.trig_override = self.trig_override;
}

if (self.health)
starte.health = self.health;
if (self.targetname)
Expand Down
17 changes: 15 additions & 2 deletions plats.qc
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,24 @@ void() plat_spawn_inside_trigger =
//
// middle trigger
//
trigger = spawn();
if (self.trig_override != "") {
trigger = find(world, targetname, self.trig_override);
if (!trigger) {
objerror("Invalid override trigger");
}
} else {
trigger = spawn();
}

trigger.touch = plat_center_touch;
trigger.movetype = MOVETYPE_NONE;
trigger.solid = SOLID_TRIGGER;
trigger.enemy = self;

if (self.trig_override != "") {
return;
}

tmin = self.mins + '25 25 0';
tmax = self.maxs - '25 25 -8';
tmin_z = tmax_z - (self.pos1_z - self.pos2_z + 8);
Expand Down Expand Up @@ -214,7 +226,8 @@ void() func_plat =

self.use = plat_trigger_use;

plat_spawn_inside_trigger(); // the "start moving" trigger
self.think = plat_spawn_inside_trigger; // the "start moving" trigger
self.nextthink = self.ltime + 0.1;

if (self.targetname)
{
Expand Down
3 changes: 1 addition & 2 deletions todo
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
* override triggers
* explobox2
* useless voreball code
* Fix func_train override
* Fix func_train crash-to-console

0 comments on commit 84cfcdc

Please sign in to comment.