Есть такой луа код мода на кортекс комманд, который управляет перегревом оружия:

function Create(self)
	---------- Animation stuff--------------
	--self.Frame = 0
	self.animTimer = Timer()
	self.canAnim = true
	self.fullyEmpty = false

	self.animDelay = 35

	--------------------------

	self.toJam = false
	self.jamEffects = false --Affects animation and that's about it
	self.jammed = false --Actual jam stuff.

	self.canSmash = false
	self.jamSmashInitial = true

	self.reloadUnjam = false --Stuff for reloading when jammed
	self.reloadUnjamPenalty = false
	self.reloadingWhenJammedSet = false
	self.origReloadTime = self.BaseReloadTime
	self.roundsInMag = 0

	self.reloadAngleSize = 0.25 --Change this if you feel the gun rotates a bit too much or too litle
	self.reloadNum = 0

	---- Fine tune -----

	self.jamAngleSize = 0.45 --How much the gun rotates when jammed
	self.jamNum = 0

	self.reloadWhenJamMultiplier = 1.10

	self.jamProbability = 0 --The 2 next numbers control the "Jam zone" of the gun, meaning that the gun has a chance to jam once the probability enters the zone.
	self.jamProbabilitySafe = 25 --The amount of shots the gun can take before it enters the jam zone
	self.jamProbabilitySmoke = 4 --The ammount of shots before light smoke starts coming out, for indication
	self.jamProbabilityPercentaje = 12 --The overall percentaje of the jam probability (100 = each shot increases by 1%)
	self.jamProbabilityDecrease = 1 --Left for customization sake.

	self.jamSmashTop = 5 --	How much you have to smasto unajm
	self.jamSmashCount = 0
	self.jamSmash = 1 --How much you add to the counter each smash

	------------- Timers, the lot of them --------------------

	self.jamProbabilityDecreaseTimer = Timer() ---Timer between each decrease
	self.jamProbabilityDecreaseDelayNormal = 300
	self.jamProbabilityDecreaseDelaySmoking = 400
	self.jamProbabilityDecreaseDelay = self.jamProbabilityDecreaseDelayNormal

	self.jamAftermath = false -- Small delay after unjaming so you don't start firing inmediatly
	self.jamAftermathTimer = Timer()
	self.jamAftermathDelay = 500

	self.initialJamTimer = Timer() --How long before you can start smashing
	self.initialJamDelay = 250
	self.initialJamSet = false

	self.jamSmashTimer = Timer() --Forces player to smash.
	self.jamSmashDelay = 30

	self.jamAITimer = Timer() -- AI can unjam their guns too!
	self.jamAIDelay = (math.random(15, 35) * 10)

	self.jamSmokeTimer = Timer() --Small smoke for when the gun is in THE ZONE
	self.jamSmokeLightDelay = 250
	self.jamSmokeDarkDelay = 150

	self.parent = nil
end

function Update(self)
	if self.Magazine then
		if self.jamEffects == true then
			self.Frame = 7
		elseif self.FiredFrame and self.Magazine.RoundCount > 0 then
			--self.Frame = 0 --Fired then change frame
			if self.canAnim == true then
				self.animTimer:Reset() --Timer delay to change back to original frame
				self.canAnim = false
			end
		elseif self.Magazine.RoundCount == 0 then --Fully empty frame change
			--self.Frame = 0
		end

		if self.animTimer:IsPastSimMS(self.animDelay) and self.jamEffects == false then
			self.canAnim = true
			self.Frame = 0
		end

		if self.Magazine.RoundCount < 1 then
			self.fullyEmpty = true
		else
			self.fullyEmpty = false
		end
	--else
		--self.animTimer:Reset()
		--if self.fullyEmpty == true then --Making sure we are completley empry
		--	self.Frame = 0
		--else
		--	self.Frame = 0
		--end
	end

	----------------------------------------------------------------------

	if self:IsAttached() == true then --I think this is more performance friendly as it doesn't check the parent every frame, rather just when the gun is first taken.
		if self.parent == nil then
			if IsAHuman(self:GetRootParent()) then
				self.parent = ToAHuman(self:GetRootParent())
			end
		end
	else
		self.parent = nil
	end

	----------------- Jam Probability --------------------

	if self.Magazine then
		if self.FiredFrame then
			self.jamProbabilityDecreaseTimer:Reset()

			if self.jamProbability < self.jamProbabilitySafe then
				self.jamProbability = self.jamProbability + 1
			elseif self.Magazine.RoundCount > 1 then --jam
				local chance = math.random(1, 100)
				if chance <= self.jamProbabilityPercentaje then
					self.toJam = true
					self.jamProbability = 0
				end
			end
		end
	end

	------------------ Jamm and reload stuff ----------------

	if self.jammed == true then --Cmon and jam, and welcome to the smash. Deactive when jammed
		self:Deactivate()
	end

	--Stuff to unjam the gun when reloading and proplerly apply the uunjam

	if self.Magazine == nil and self.jamEffects == true then
		if self.reloadUnjamSet == false then
			self.reloadUnjam = true
			self.reloadUnjamSet = true
		end
		self.reloadingWhenJammed = true
	elseif self.Magazine and self.jamEffects == false then
		self.reloadingWhenJammed = false
		self.reloadUnjamSet = false
	end

	--------------- Jam Aftermath Delay --------------------

	if self.jamAftermath == true then
		self.jamEffects = false
		self.canSmash = false
		if self.jamAftermathTimer:IsPastSimMS(self.jamAftermathDelay) then
			self.jammed = false
			self.jamAftermath = false
		end
	end

	if self.parent then
		if self.jamEffects == true then
			if self.jamNum < 1 then
				self.jamNum = self.jamNum + 1.5 / self.Mass
			elseif self.jamNum > 1 then
				self.jamNum = 1
			end
		elseif self.jamEffects == false then
			if self.jamNum > 0 then
				self.jamNum = self.jamNum - 1.5 / self.Mass
			elseif self.jamNum < 0 then
				self.jamNum = 0
			end
		end

		self.InheritedRotAngleOffset = self.jamNum * self.jamAngleSize

		if self.jamEffects == true then
			self.parent:GetController():SetState(Controller.AIM_SHARP, false)

			if self.Magazine then
				self.roundsInMag = self.Magazine.RoundCount
			end

			if
				self.parent:IsPlayerControlled() == true
				and not (self.parent.Jetpack and self.parent.Jetpack:IsEmitting())
			then
				local ctrl = self.parent:GetController()
				local screen = ctrl.Player
				local yPos = ctrl:IsState(Controller.PIE_MENU_ACTIVE) and 16 or 7 -- align ammo counter properly
				local digits = math.max(math.floor(math.log10(math.abs(self.roundsInMag))), 0) + 1
				local itemBG = self.parent.EquippedBGItem
				local chainBG = false
				if itemBG and IsHDFirearm(itemBG) then --I'm sorry for this
					itemBG = ToHDFirearm(itemBG)
					digits = 3
					if itemBG.ID == self.ID then
						yPos = ctrl:IsState(Controller.PIE_MENU_ACTIVE) and 24 or 16
						chainBG = true
					else
						yPos = ctrl:IsState(Controller.PIE_MENU_ACTIVE) and 32 or 24
					end
				end

				PrimitiveMan:DrawTextPrimitive(
					screen,
					self.parent.AboveHUDPos + Vector(digits * 6, yPos),
					"JAMMED!",
					true,
					0
				)

				local jamIconFrame = self.jamSmashCount / (self.jamSmashTop / 4)
				local jamIcon = CreateMOSRotating("Militia Jam Chain", "bf.rte")
				local jamPos
				if chainBG == false then
					jamPos = self.parent.Pos + Vector(32, -42) --self.Pos + Vector(28, -43)
				else
					jamPos = self.parent.Pos + Vector(32, -32) --self.Pos + Vector(28, -43)
				end
				PrimitiveMan:DrawBitmapPrimitive(ctrl.Player, jamPos, jamIcon, 3.14, jamIconFrame, true, true)
			end
		end

		if self.toJam == true and self.FiredFrame == false then
			if self.parent:GetController():IsState(Controller.WEAPON_FIRE) then
				self.jamEffects = true
				self.jammed = true
				self.initialJamSet = true
				self.toJam = false
			end
		end

		--------------- Jam stuff --------------------

		if self.jammed == true then --Gun's jammed
			self.jamPos = self.Pos + Vector(-2 * self.FlipFactor, -2)

			if self.initialJamSet == true then
				self.initialJamTimer:Reset()
				self.jamSmashInitial = true
				self.initialJamSet = false

				local jamEffect = CreateAEmitter("Militia Jam", "bf.rte")
				jamEffect.Pos = self.jamPos
				MovableMan:AddParticle(jamEffect)
			end

			if self.initialJamTimer:IsPastSimMS(self.initialJamDelay) then --Delay for jamming surpased, beggin the smash has
				if self.jamSmashInitial == true then
					self.jamSmashTimer:Reset()
					self.jamSmashInitial = false
				end

				if self.canSmash == true then --We smashing
					self.canSmash = false
					self.jamSmashCount = self.jamSmashCount + self.jamSmash

					local jamEffect = CreateAEmitter("Militia Jam Smash", "bf.rte")
					jamEffect.Pos = self.jamPos
					MovableMan:AddParticle(jamEffect)

					local glow = CreateMOPixel("Militia Rifle Glow A", "bf.rte")
					glow.Pos = self.jamPos
					MovableMan:AddParticle(glow)
				end

				if self.parent:IsPlayerControlled() then
					if
						self.parent:GetController():IsState(Controller.WEAPON_FIRE)
						and self.jamSmashTimer:IsPastSimMS(self.jamSmashDelay)
					then
						self.canSmash = true
						self.jamSmashTimer:Reset()
					elseif self.parent:GetController():IsState(Controller.WEAPON_FIRE) then --Gotta smash, no holding
						self.jamSmashTimer:Reset()
						self.canSmash = false
					end
				else
					if self.jamAITimer:IsPastSimMS(self.jamAIDelay) then --AI Smashes too
						self.parent:GetController():SetState(Controller.WEAPON_FIRE, true)
						self.jamAIDelay = (math.random(6, 18) * 10)
						self.jamAITimer:Reset()
						self.canSmash = true
					end
				end
			end

			if self.jamSmashCount >= self.jamSmashTop or self.reloadUnjam == true then --We reached top, we unjaming
				self.jamAftermathTimer:Reset()
				self.jamAftermath = true

				self.jamAIDelay = (math.random(15, 35) * 10) --More delay for initial jam so they dont become op

				self.reloadUnjam = false

				local jamEffect = CreateAEmitter("Militia Jam", "bf.rte")
				jamEffect.Pos = self.jamPos
				MovableMan:AddParticle(jamEffect)

				self.jamSmashCount = 0
			end
		end
	else
		self.jamNum = 0
		self.reloadNum = 0
	end

	if self.jamProbability > self.jamProbabilitySafe then
		self.jamProbabilityDecreaseDelay = self.jamProbabilityDecreaseDelaySmoking
	else
		self.jamProbabilityDecreaseDelay = self.jamProbabilityDecreaseDelayNormal
	end

	if self.jamProbability > 0 then
		self.jamPos = self.Pos + Vector(2 * self.FlipFactor, -2)

		if self.jamProbabilityDecreaseTimer:IsPastSimMS(self.jamProbabilityDecreaseDelay) then
			self.jamProbability = self.jamProbability - self.jamProbabilityDecrease
			self.jamProbabilityDecreaseTimer:Reset()
			if self.jamProbability < 0 then
				self.jamProbability = 0
			end
		end

		if self.jamProbability == self.jamProbabilitySafe then
			if self.jamSmokeTimer:IsPastSimMS(self.jamSmokeDarkDelay) then
				local smokeEffect = CreateMOSParticle("Tiny Dark Smoke Ball 1", "bf.rte")
				smokeEffect.Pos = self.jamPos
				smokeEffect.Vel = self.Vel + Vector(0, -2):RadRotate(self.RotAngle)
				MovableMan:AddParticle(smokeEffect)

				self.jamSmokeTimer:Reset()
			end
		elseif self.jamProbability >= self.jamProbabilitySmoke then
			if self.jamSmokeTimer:IsPastSimMS(self.jamSmokeLightDelay) then
				local smokeEffect = CreateMOSParticle("Tiny Grey Smoke Ball 1", "bf.rte")
				smokeEffect.Pos = self.jamPos
				smokeEffect.Vel = self.Vel + Vector(0, -2):RadRotate(self.RotAngle)
				MovableMan:AddParticle(smokeEffect)

				self.jamSmokeTimer:Reset()
			end
		end
	else
		self.jamProbabilityDecreaseTimer:Reset()
	end
end

Но нужно переделать его так, чтобы вероятность клина оружия определялась не перегревом, а тем насколько быстро оно перемещается и наклоняется (планируется навесть этот скрипт на пулемёт с лентой, у которого лента клинит именно при таких условиях). Поможешь переписать код в соответствии с такой нуждой?