Jump to content

Rooks can destroy obstacles on collision even if not running


hoxi
  • Fixed

They have a velocity check when they collide with things and and that's it, but it's possible for them to be pushed to reach that velocity threshold.

Wouldn't it make sense to check if they're in a running state (I don't know if their walking state would be intended to allow destruction either).

 

Could check on the physics collision callback with something like this:

inst.sg:HasStateTag("running")

And then check for velocity.

 

You could potentially even check for the state tag before anything else in the physics collision callback, kinda like this:

local function oncollide(inst, other)
	if not (inst.sg ~= nil and inst.sg:HasStateTag("running")) then
		return
	end

	if other and not other.isplayer and other:IsValid() and
		other.components.workable and
		other.components.workable:CanBeWorked() and
		other.components.workable:GetWorkAction() ~= ACTIONS.NET and
		inst:IsValid()
	then
		local t = GetTime()
		if (inst.recentlycharged[other] or -math.huge) + 3 <= t then
			local vx, _, vz = inst.Physics:GetVelocity()
			if vx * vx + vz * vz >= 42 then
				if inst._shaketask == nil then
					inst._shaketask = inst:DoTaskInTime(0, DoCollideShake)
				end
				inst:DoTaskInTime(2 * FRAMES, onothercollide, other)
				inst.recentlycharged[other] = t + 2 * FRAMES
			end
		end
	end
end

Could even make the collision callback only be set when entering the running states, and set to nil otherwise, but I don't know if it'd be wise or even safe.

Just some suggestions though.


Steps to Reproduce
  • Have multiple Rooks or other entities with enough mass push Rooks around. You can try spawning a bunch of them in an area enclosed by walls.
  • Notice how they can collide and destroy obstacles when pushed this way, even if idling.
  • Like 3



User Feedback


A developer has marked this issue as fixed. This means that the issue has been addressed in the current development build and will likely be in the next update.

There a popular strategy is to use Slowdown Item like Wicker's spider book or Icker to counter Rooks, it's very creative and interesting.

I hope to retain the Speed detection feature coexisting with the State detection, so that this strategy can continue to exist.

Edited by Cassielu

Share this comment


Link to comment
Share on other sites

On 2/14/2026 at 6:19 AM, Cassielu said:

There a popular strategy is to use Slowdown Item like Wicker's spider book or Icker to counter Rooks, it's very creative and interesting.

I hope to retain the Speed detection feature coexisting with the State detection, so that this strategy can continue to exist.

Oh yeah of course, I wasn't suggesting to remove the velocity check, you can see it in the code block suggestion still.

I was more suggesting sanitizing the obstacle destruction to not happen outside of the running state (i.e. Rook is pushed or gains increased movement speed in some way and destroys things when walking, etc). You'd be still able to prevent it with the things you mentioned if slowed down enough.

Share this comment


Link to comment
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...