Unintentional mole behaviour (and possible fix)

  • Pending

Hey, I've been browsing a game code, trying to make a mod and I believe I found a bug that causes the moles to glitch out.

I tried to revert moles to how they were in RoG, which is: make them come out of dug molehill instead of simply dissapearing. I checked the molehill.lua and sure enough in a local function dig_up(inst), it checks if the molehill has children and tries to realease them, but for some reason it fails to do so. 

Eventually I figured that because we are calling  inst.components.spawner:SetQueueSpawning in local function stopspawning(inst) we are setting tags on self.queue_spawn and self.retryperiod. This however causes the function Spawner:ReleaseChild() to call itself again after self.retryperiod before releasing the mole, however at that point the molehill has already been dug up and thus it can't realease the mole.

I'm calling this a bug since the local function dig_up(inst) tries to Release the mole but fails as an indirect consequence of setting those tags.

Easy fix I found to this is to change line 35 in molehill.lua ( in a local function stopspawning(inst) ) to inst.components.spawner:CancelSpawning(), which causes the tags to never be set and moles to release properly (and is also how it orignally was in RoG). Since the molehole only contains 1 child there shouldnt be a problem with having no queue, but that is up to you to decide. However if this is not a bug and it's how it was intended to be, then sorry for bothering you :) 

Steps to Reproduce
Dig up the molehole during the day and no moles will spawn

Status: Pending

This issue has not been confirmed by a developer yet.

  Report Bug

User Feedback

There are no comments to display.

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