Swimming Horror attacks floaty boaty knights


YumoS
  • Can't Reproduce

I was chased by swimming horror and we encountered floaty boaty knights. They throwed cannon balls at me and hit the swimming horror. The next thing i see is that swimming horror attacks floaty boaty knights.2016-03-03_00002.thumb.jpg.f618e8251a189


Steps to Reproduce
Go insane on water. Let a cannon ball from floaty boaty knight hit swimming horror.


User Feedback


....

Can confirm. Interestingly, it happened to me upon exit from the volcano with very high sanity (I don't think they should have even been visible). I could not attack them but they swam over to the boaty knights, who did not retaliate. There was also a full moon if that plays into this.

Share this comment


Link to comment
Share on other sites
.... ....

I'm not sure why this is a no repro. knightboat_cannonshot.lua calls getattacked on everything with combat component that the cannon ball hits. Which seems to get to Onattacked event for all the targets. In shadowcreature_sea.lua on attacked makes the swimming horror immediately target the attacker. This code is common with other parabolic ranged attacks (palm treeguard, Wilbur poop throw), and should also affect the land shadow creatures.

GetAttacked should probably check canbeattacked, as that seems like the way that the shadow creatures were prevented from getting attacked before. But now, the ranged attacks in SW do not check for canbeattacked, but instead, directly call get attacked with area effect.

Share this comment


Link to comment
Share on other sites
....

I wasn't able to instigate an attack between the sea horror and the boat knight. Both of them seem to be targeting the player in every case I've looked at. I'll keep looking at this.

Share this comment


Link to comment
Share on other sites
....

from knightboat_cannonshot.lua, line 33:

if v.components.combat and v ~= inst then --For now I want knight boats to kill eachother                 
    v.components.combat:GetAttacked(thrower, TUNING.KNIGHTBOAT_DAMAGE)             
end

from combat.lua, line 902 (area attack):

	for i,ent in ipairs(ents) do
		if ent.components.combat 
			and ent ~= target 
			and ent ~= self.inst 
			and self:CanAreaHitTarget(ent) 
			and (not validfn or validfn(ent)) then
				self.inst:PushEvent("onareaattackother", {target = target, weapon = weapon, stimuli = stimuli})
				ent.components.combat:GetAttacked(self.inst, self:CalcDamage(ent, weapon, self.areahitdamagepercent), weapon, stimuli)
				hitcount = hitcount + 1
		end
	end

CanAreaHitTarget function has a bunch of checks, one of which is this:

    or (target:HasTag("shadow") and not self.inst.components.sanity)

This prevents anything without sanity component to attack any shadow creature. So the problem is that get attacked being called directly, as opposed to having it routed through the combat component to do the proper checks. This problem exists with most new delayed ranged attacks that do aoe damage, including palm treeguards, or Wilbur manure throw (basically any code that looks like the top code fragment), which may be easier to repro. the code I was talking about last time seems to have been removed, so I guess that wasn't the proper way.

Share this comment


Link to comment
Share on other sites