No-Schedule MineDisc Detection

This commit is contained in:
ChocoTaco1 2020-09-12 00:31:06 -04:00
parent f077a873f3
commit 7e134b8d2d

View file

@ -2800,27 +2800,23 @@ function Armor::damageObject(%data, %targetObject, %sourceObject, %position, %am
%flash = 0.75;
// Teratos: Originally from Eolk? Mine+Disc tracking/death message support.
// client.mineDisc = [true|false]
// client.mineDiscCheck [0-None|1-Disc Damage|2-Mine Damage]
// Teratos: Don't understand why "%client = %targetClient;" -- possibly to avoid carrying .minediscCheck field?
// Teratos: A little more redundant code and less readable for a few less comparisons.
// No Schedules by DarkTiger
%targetClient.mineDisc = false;
if(%damageType == $DamageType::Disc) {
%client = %targetClient; // Oops
if(%client.minediscCheck == 0) { // No Mine or Disc damage recently
%client.minediscCheck = 1;
schedule(300, 0, "resetMineDiscCheck", %client);
} else if(%client.minediscCheck == 2) { // Recent Mine damage
%client.mineDisc = true;
}
} else if (%damageType == $DamageType::Mine) {
%client = %targetClient; // Oops
if(%client.minediscCheck == 0) { // No Mine or Disc damage recently
%client.minediscCheck = 2;
schedule(300, 0, "resetMineDiscCheck", %client);
} else if(%client.minediscCheck == 1) { // Recent Disc damage
%client.mineDisc = true;
}
switch$(%damageType)
{
case $DamageType::Disc:
if(%targetClient.mdc == 1 && (getSimTime() - %targetClient.mdcTime1) < 256)
%targetClient.mineDisc = true;
%targetClient.mdc = 2;
%targetClient.mdcTime2 = getSimTime();
case $DamageType::Mine:
if(%targetClient.mdc == 2 && (getSimTime() - %targetClient.mdcTime2) < 256)
%targetClient.mineDisc = true;
%targetClient.mdc = 1;
%targetClient.mdcTime1 = getSimTime();
}
// -- End Mine+Disc insert.