3 # script that creates an "assault circuit"
8 my @objectives = @ARGV;
13 Assault Circuit Board Creator
20 perl $0 breakables1[,buttons1] breakables2[,buttons2] breakables3[,buttons3] ... \\
24 ofs_z=1024 perl $0 1 1 3,2 1 > assault.map
29 my $bp = $ENV{brushprimit};
30 my @ofs = ($ENV{ofs_x} || 0, $ENV{ofs_y} || 0, $ENV{ofs_z} || 0);
32 my $BRUSHDEF_START = $bp ? "{\nbrushDef\n{" : "{";
33 my $BRUSHDEF_END = $bp ? "}\n}" : "}";
34 my $BRUSHDEF_PRE = $bp ? "( ( 0.03125 0 -0 ) ( -0 0.03125 0 ) ) " : "";
35 my $BRUSHDEF_POST = $bp ? " 0 0 0" : " 0 0 0 0.500000 0.500000 0 0 0";
37 sub BrushRectangle($@@)
39 my ($shader, $x0, $y0, $z0, $x1, $y1, $z1) = @_;
42 ( $x1 $y1 $z1 ) ( $x1 $y0 $z1 ) ( $x0 $y1 $z1 ) $BRUSHDEF_PRE$shader$BRUSHDEF_POST
43 ( $x1 $y1 $z1 ) ( $x0 $y1 $z1 ) ( $x1 $y1 $z0 ) $BRUSHDEF_PRE$shader$BRUSHDEF_POST
44 ( $x1 $y1 $z1 ) ( $x1 $y1 $z0 ) ( $x1 $y0 $z1 ) $BRUSHDEF_PRE$shader$BRUSHDEF_POST
45 ( $x0 $y0 $z0 ) ( $x1 $y0 $z0 ) ( $x0 $y1 $z0 ) $BRUSHDEF_PRE$shader$BRUSHDEF_POST
46 ( $x0 $y0 $z0 ) ( $x0 $y0 $z1 ) ( $x1 $y0 $z0 ) $BRUSHDEF_PRE$shader$BRUSHDEF_POST
47 ( $x0 $y0 $z0 ) ( $x0 $y1 $z0 ) ( $x0 $y0 $z1 ) $BRUSHDEF_PRE$shader$BRUSHDEF_POST
56 if(ref $h{model} eq 'ARRAY')
58 @brushes = @{$h{model}};
61 return join "", ("{\n", (map { qq{"$_" "$h{$_}"\n} } keys %h), @brushes, "}\n");
72 $dmg = (1 + int(10 / $cnt)) * 10;
74 if $dmg * ($cnt - 1) < 100;
77 $dmg = (1 + int(20 / $cnt)) * 5;
79 if $dmg * ($cnt - 1) < 100;
82 $dmg = (1 + int(50 / $cnt)) * 2;
84 if $dmg * ($cnt - 1) < 100;
87 $dmg = (1 + int(100 / $cnt));
89 if $dmg * ($cnt - 1) < 100;
92 return (100 / $cnt + 100 / ($cnt + 1)) / 2;
95 sub ObjectiveSpawns($@)
97 my ($target, $x, $y, $z) = @_;
106 my $yy = $y + ($_ - 3.5) * 64;
108 classname => "info_player_attacker",
110 origin => "$xx $yy $z";
114 classname => "info_player_defender",
116 origin => "$xx $yy $z";
122 my @assault_entities = ();
124 my $obj_prev = undef;
125 my $des_prev = undef;
127 my @prevorigin = (-256, 0, 0);
129 for my $i(0..@objectives - 1)
138 my $count = $objectives[$i];
139 $count =~ /^(\d+)(?:,(\d+))?$/s
140 or die "Invalid count spec: must be number or number,number";
141 my $count_destroy = $1;
142 my $count_push = $2 || 0;
143 $count = $count_destroy + $count_push;
146 my $des = "obj$i\_destructible";
147 my $dec = "obj$i\_decrease";
151 push @assault_entities, Entity
152 classname => "target_assault_roundstart",
155 origin => "@prevorigin";
159 push @assault_entities, Entity
160 classname => "target_objective",
161 targetname => $obj_prev,
164 origin => "@prevorigin";
166 push @assault_entities, ObjectiveSpawns $obj_prev, @prevorigin;
168 push @assault_entities, Entity
169 classname => "func_assault_wall",
174 $origin[0] - 128 - 16,
177 $origin[0] - 128 + 16,
183 @prevorigin = @origin;
187 my $dmg = FindDamage($count);
189 push @assault_entities, Entity
190 classname => "target_objective_decrease",
198 for(1..$count_destroy)
200 push @assault_entities, Entity
201 classname => "func_assault_destructible",
205 mdl => "rocket_explode",
207 noise => "weapons/rocket_impact.wav",
228 push @assault_entities, Entity
229 classname => "func_button",
250 my $obj = "roundend";
253 $ofs[0] + @objectives * 256,
258 push @assault_entities, Entity
259 classname => "target_objective",
260 targetname => $obj_prev,
262 origin => "@prevorigin";
264 push @assault_entities, ObjectiveSpawns $obj_prev, @prevorigin;
266 push @assault_entities, Entity
267 classname => "target_assault_roundend",
273 Entity(classname => "worldspawn"),