mt-mods / technic

Technic mod for Minetest
18 stars 25 forks source link

Log every inventory action #360

Closed Emojigit closed 5 months ago

Emojigit commented 7 months ago

This PR adds logging functions to every inventory action. The existing logging functions for chests are also improved. This PR is ready for review.

S-S-X commented 7 months ago
Error → spec/api_spec.lua @ 6
CNC API
api.lua:386: attempt to index global 'technic' (a nil value)

Just use technic_cnc.use_technic to check if technic namespace is usable with CNC. Technic is optional dependency for CNC, it also works without technic mod. Both cases are tested: with and without technic mod.

OgelGames commented 7 months ago

The technic.machine_on_inventory_* functions don't need to return functions, you can use minetest.get_node(pos).name to get the node name.

Emojigit commented 5 months ago

For some reason, pipeworks is requiring fakelib... That's why mtt failed.

BuckarooBanzay commented 5 months ago

For some reason, pipeworks is requiring fakelib... That's why mtt failed.

Yeah, you can ignore that, i'll create another PR to add that dependency :+1:

EDIT: https://github.com/mt-mods/technic/pull/365 (or add the line here, i don't mind either way :shrug:)

OgelGames commented 5 months ago

Do you think it would be a good idea to handle non-player actions like default does? With all the extra logging, there's going to be a lot of spam from pipeworks moving items.

https://github.com/minetest/minetest_game/blob/511619253facd524df75ae44537d7b2c4e30a8db/mods/default/functions.lua#L729-L745

OgelGames commented 5 months ago

I've created a new issue about my suggestion, so I'm merging this.