@@ -301,9 +301,9 @@ void() Test_Perks_Random_ResetDoesNotTeleport =
301301 // Activate perk_random
302302 Perk_RandomDecide();
303303
304- // Call GameRestart_ResetPerkaColas , Deadshot Daiquiri should not
304+ // Call Soft_Restart , Deadshot Daiquiri should not
305305 // be reset to world origin..
306- GameRestart_ResetPerkaColas ();
306+ Soft_Restart ();
307307
308308 Test_Assert((deadshot. origin != '0 0 0' ), "Deadshot Daiquiri was moved to world origin!" );
309309
@@ -327,4 +327,46 @@ void() Test_Perks_Drink_WorkOnReset =
327327 self. isBuying = true;
328328 Soft_Restart();
329329 Test_Assert((self. isBuying == false), "isBuying state not reset!" );
330+ };
331+
332+ //
333+ // Test_Perks_Random_AnglesAreCorrect()
334+ // Asserts that if GameRestart_ResetPerkaColas() is called,
335+ // machine angles are not set incorrectly.
336+ // (https://github.com/nzp-team/nzportable/issues/1193)
337+ //
338+ void () Test_Perks_Random_AnglesAreCorrect =
339+ {
340+ entity flopper, random;
341+ entity old_self = self;
342+
343+ // Spawn PHD Flopper at some origin
344+ flopper = spawn();
345+ self = flopper;
346+ perk_flopper();
347+ setorigin(self, '20 20 20' );
348+
349+ // Spawn a perk_random at client's origin
350+ random = spawn();
351+ self = random;
352+ self. spawnflags = SPAWNFLAG_PERKRANDOM_PHDFLOPPER; // Put PHD Flopper here!
353+ // Change angles slightly to detect changes after Soft_Restart
354+ self. angles_x += 20 ;
355+ perk_random();
356+ setorigin(random, old_self. origin);
357+
358+ // Activate perk_random
359+ Perk_RandomDecide();
360+ // Call Soft_Restart, PHD Flopper should have
361+ // the correct angles
362+ Soft_Restart();
363+
364+ entity machine = find(world, classname, "perk_flopper" );
365+
366+ Test_Assert((random. angles == machine. angles), "Random Perk machine angles are incorrect!" );
367+
368+ self = old_self;
369+
370+ remove(flopper);
371+ remove(random);
330372};
0 commit comments