From 1d71faf5dd66b38dad93e17aba9242a9b228a220 Mon Sep 17 00:00:00 2001 From: Scott Schiller Date: Thu, 19 May 2022 18:56:20 -0700 Subject: [PATCH] =?UTF-8?q?New=20smart=20missile=20feature:=20Initially=20?= =?UTF-8?q?(almost)=20harmless,=201=20hit=20point=20until=20"armed"=20(15?= =?UTF-8?q?=20frames,=200.5=20seconds).=20Obligatory=20=E2=80=9CHunt=20For?= =?UTF-8?q?=20Red=20October=E2=80=9D=20reference=20included.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/munitions/SmartMissile.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/script/munitions/SmartMissile.js b/script/munitions/SmartMissile.js index 0d2bd5d9..10faea8f 100644 --- a/script/munitions/SmartMissile.js +++ b/script/munitions/SmartMissile.js @@ -280,7 +280,7 @@ const SmartMissile = options => { if (target) { - common.hit(target, data.damagePoints, exports); + common.hit(target, (data.armed ? data.damagePoints : 1), exports); // "embed", so this object moves relative to the target it hit common.attachToTarget(exports, target); @@ -496,6 +496,12 @@ const SmartMissile = options => { data.frameCount++; + if (!data.armed && data.frameCount >= data.ramiusFrameCount) { + // become dangerous at this point. + // obligatory: https://www.youtube.com/watch?v=CgTc3cYaLdo&t=112s + data.armed = true; + } + if (data.frameCount >= data.dieFrameCount) { die(); // but don't fall too fast? @@ -624,11 +630,13 @@ const SmartMissile = options => { parentType: options.parentType || null, energy: 1, energyMax: 1, + armed: false, expired: false, hostile: false, // when expiring/falling, this object is dangerous to both friendly and enemy units. nearExpiry: false, nearExpiryThreshold: 0.88, frameCount: 0, + ramiusFrameCount: 15, // https://www.youtube.com/watch?v=CgTc3cYaLdo&t=112s expireFrameCount: options.expireFrameCount || 256, dieFrameCount: options.dieFrameCount || 640, // 640 frames ought to be enough for anybody. width: (options.isRubberChicken ? 24 : 14),