multitheftauto / mtasa-blue

Multi Theft Auto is a game engine that incorporates an extendable network play element into a proprietary commercial single-player game.
https://multitheftauto.com
GNU General Public License v3.0
1.42k stars 437 forks source link

stopResource does not change resource state #2255

Closed CrosRoad95 closed 3 years ago

CrosRoad95 commented 3 years ago

Describe the bug "stopResource" does not change resource state to "stopping"

To reproduce use "getResourceState" directly after "stopResource"

stopResource(otherResource)
assert(getResourceState(otherResource) == "stopping") -- will fail, "state" state is still "running"

Expected behaviour state of resource should change to "stopping"

Screenshots /

Version server: v1.5.8-release-20865

Additional context /

Lpsd commented 3 years ago

this is a non-issue, the resource is added to a queue before being processed for stopping - it doesn't get stopped straight away.

https://github.com/multitheftauto/mtasa-blue/blob/c58c3678f263d810f61eb5aecba48e6c4b4dce0c/Server/mods/deathmatch/logic/luadefs/CLuaResourceDefs.cpp#L578 https://github.com/multitheftauto/mtasa-blue/blob/c58c3678f263d810f61eb5aecba48e6c4b4dce0c/Server/mods/deathmatch/logic/CResourceManager.cpp#L729

use onResourceStop, which should tell you the resource state is stopping

CrosRoad95 commented 3 years ago

yea, but if i use "onResourceStop" event, i assume some resource is stopping, in other events i get false information that resource will not stop soon even if has been added to stop queue and next frame will no longer availiable

Lpsd commented 3 years ago

this is exactly why you are asked to provide steps to reproduce your issue in the template. please provide an example resource to better explain what you mean.