QCraft


This mod allows you to begin crafting items that are under your cursor, either as an entity placed in the world, a ghost entity, or an item in your quickbar:

Utilities
2 years ago
0.17 - 1.1
422

b soo, apparantly it happened again

2 years ago

394554.248 Error MainLoop.cpp:1285: Exception at tick 22883220: The mod QCraft (0.1.6) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event QCraft::craft-one-from-cursor (ID 180)
Entity is not ghost.
stack traceback:
[C]: in function 'index'
__QCraft
/control.lua:9: in function <QCraft/control.lua:6>
(...tail calls...)
QCraft/control.lua:31: in function <QCraft/control.lua:30>
394554.250 Error ServerMultiplayerManager.cpp:91: MultiplayerManager failed: "The mod QCraft (0.1.6) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event QCraft::craft-one-from-cursor (ID 180)
Entity is not ghost.
stack traceback:
[C]: in function 'index'
__QCraft
/control.lua:9: in function <QCraft/control.lua:6>
(...tail calls...)
QCraft/control.lua:31: in function <QCraft/control.lua:30>"
394554.253 Info ServerMultiplayerManager.cpp:787: updateTick(22883220) changing state from(InGame) to(Failed)
394554.263 Quitting: multiplayer error.

Ok, there is definitely something I am not understanding about how entity/ghost selection occurs on servers. I'll take another look soon. Sorry for this! If not thing else, I can at least make sure this does nothing, instead of crash, when something goes wrong.

2 years ago
(updated 2 years ago)

Your gitlab is not up to date.

I think your original error in 0.1.5, in

local function get_entitity_ghost_name(event)

was assuming that when you receive an event, game.players[index].selected will also exist. Maybe events can be sent/received asynchronously from game state?

Regardless, Craft Under Mouse https://mods.factorio.com/mod/craft-under-mouse performs a null check on player.selected before trying to access player.selected.ghost_entity, and an uncaught null was exactly the type of error indicated in the 0.1.5 crash log:

QCraft/control.lua:8: attempt to index field 'selected' (a nil value)

2 years ago
(updated 2 years ago)

Hey! Thanks for taking a look; I forgot to push the changes up for 0.1.6, but you can see it here now: https://gitlab.com/cmhulbert/qcraft/-/blob/master/control.lua#L8

That line in particular is what I changed, which as you suggested, I do a null check on player.selected now.
But looking at KryptoNiteX log, it seems the error is now on player.selected even AFTER I do the null check the line above, which as you say, I'm guessing is some synchronization issue?

I think all I could do is run it in a pcall just to ensure it doesn't crash, but just does nothing. Unless there is documentation about the server event synchronization that I can find.

2 years ago
(updated 2 years ago)

If it's a sync issue, you could get that error if the player has something selected according to the server, but that something is not a ghost at the time you access the selected entity. This is wild speculation on my part, though. It could just as easily be something stupid like an off-by-one error

2 years ago

Got the same issue today:

6395.530 Error MainLoop.cpp:1285: Exception at tick 10519186: The mod QCraft (0.1.6) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event QCraft::craft-one-from-cursor (ID 187)
Entity is not ghost.
stack traceback:
[C]: in function 'index'
__QCraft
/control.lua:9: in function <QCraft/control.lua:6>
(...tail calls...)
QCraft/control.lua:31: in function <QCraft/control.lua:30>
6395.531 Error ServerMultiplayerManager.cpp:91: MultiplayerManager failed: "The mod QCraft (0.1.6) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event QCraft::craft-one-from-cursor (ID 187)
Entity is not ghost.
stack traceback:
[C]: in function 'index'
__QCraft
/control.lua:9: in function <QCraft/control.lua:6>
(...tail calls...)
QCraft/control.lua:31: in function <QCraft/control.lua:30>"
6395.531 Info ServerMultiplayerManager.cpp:784: updateTick(10519186) changing state from(InGame) to(Failed)
6395.531 Quitting: multiplayer error.


If it helps :
I went out of SE's Satellite Link than hit ALT+Q on an entity ghost and booum.

New response