Power Weapon Deactivating on getting stunned (con't) with Lua Source examination & Fix, changes from v1.4 to 1.5.0 and 1.5.10

Issue Type (Required):

Weapons (Powered)

Issue Description (Required):

TLDR: keep_active_on_stun = true is missing from power weapons templates.

keep_active_on_stun set on chain and force swords, it’s set now in v1.5.10 for those, but wasn’t in 1.5.0.
force 1.5.0 set the keep_active_on_sprint needed by the new code:

weapon_template.weapon_special_tweak_data = {
	active_duration = 3,
	keep_active_on_sprint = true,
}

force 1.5.10, ~1.5 Months later:

weapon_template.weapon_special_tweak_data = {
	active_duration = 3,
	keep_active_on_sprint = true,
	keep_active_on_stun = true,
}

Seems all the special bugs that were “fixed” after 1.5.0 left out the power weapons in this regard.

powersword_p1_m2:

weapon_template.weapon_special_tweak_data = {
	active_duration = 3,
	allow_reactivation_while_active = true,
	keep_active_on_sprint = true,
	num_activations = 1,
}

Note the absence, the missing keep_active_on_stun = true . It’s also not inherited/merged from a base/parent, this is evident in-game (and grinder); it seems to be explicitly set (to true) per individual weapon template on the explicitly set table.

Power Weapon Deactivating on getting stunned bug was introduced on v1.5.0. If I’m reading this correctly, the bug is due to a lot of internal reworks and flags not being set (to true), then set only for some weapons later.

Previously in 1.4, the Interrupt.action function would look at the weapon template to see if the weapon_template.allow_sprinting_with_special flag was set (true) and did not disable the powered weapons, it wouldn’t call WeaponSpecial.disable which is now gone in v1.5+ as set_wielded_weapon_weapon_special_active() took over that functionality.
So in v1.4 an enemy hits you, it reaches this code but skips over it.


	if weapon_template and not weapon_template.allow_sprinting_with_special then
		WeaponSpecial.disable(unit)
	end

A lot of this code was changed in 1.5+ and the new flag is not even present anymore on the weapon templates as there were structural changes. >1.5.0 added the new flag for some.
The responsibility now resides in the new function PlayerUnitWeaponExtension.set_wielded_weapon_weapon_special_active(t, false, reason) which Interrupt.action v1.5+ now calls.

	weapon_extension:set_wielded_weapon_weapon_special_active(t, false, reason)
elseif optional_reason == "stunned" then
			if not tweak_data_or_nil or not tweak_data_or_nil.keep_active_on_stun then
				inventory_slot_component.special_active = false
				inventory_slot_component.num_special_charges = 0
				did_deactivate = true
			end

The flag is now part of the weapon_template.weapon_special_tweak_data table (~struct) with more granularity for other conditions, but the keep_active_on_stun is not set (to true) for power weapons and thus the deactivation when stunned from any source, like trash mob hit.

This is bigly buggy behavior and is a huge hit to power weapons, rendering them quasi-useless. Power weapons weren’t fixed after the initial buggy state debuted in 1.5.0 or when some others were in subsequent 1.5.* updates.

FIX:

Set keep_active_on_stun = true in power weapons templates, it’s there (now) for chain axes and force swords.

P.S. Note: It’s quite possible I made mistakes so feel free to confirm.
P.P.S. "ledge_vaulting/keep_active_on_vault " is interesting too, not currently set on anything.

17 Likes

Doing the Emperor’s work.

4 Likes

Now that we know, can we https://m.youtube.com/watch?v=xhy7dXWjpAA&pp=ygURZnJ5IGZpeCBpdCBmaXggaXQ%3D

?

I want to use the power sword again

2 Likes

Bless you man.

2 Likes

LOL https://youtu.be/yo3uxqwTxk0?si=SdSgRTjTwGLlUVNm

PS is just miserable currently, ~2 months now, not counting the other special activation bug that was subsequently fixed.

P.S. I find it hilarious that “buffed” thunderhammer not only dropped at the same time as DS, but also got not one but two (the current one persisting) powered special activation bugs.

3 Likes