Jump to conversation
Unresolved conversations (0)
Nice work!

Nice work!

All of your conversations have been resolved.

Resolved conversations (61)
@grorp grorp Dec 20, 2023
```suggestion * Compatibility note: Clients prior to 5.9.0 only support absolute position and rotation. ```
Outdated
doc/lua_api.md
@sfan5 sfan5 Nov 18, 2023
then do `s/bone_pos/it/` too :)
Outdated
src/server/player_sao.cpp
appgurueu
@sfan5 sfan5 Nov 4, 2023
should be `const BoneOverride &`
Outdated
src/server/serveractiveobject.h
@sfan5 sfan5 Nov 4, 2023
nitpick: get rid of `bone_pos` if you want to keep the naming consistent
Outdated
src/server/luaentity_sao.cpp
appgurueu sfan5
@sfan5 sfan5 Nov 4, 2023
```suggestion auto push_prop = [L](const char *name, const auto &prop, v3f vec) { ```
Outdated
src/script/lua_api/l_object.cpp
@sfan5 sfan5 Nov 4, 2023
```suggestion static void push_bone_override(lua_State *L, const BoneOverride &props) ```
Outdated
src/script/lua_api/l_object.cpp
@sfan5 sfan5 Nov 4, 2023
is there a reason for this pattern? `props.position.vector` will be default initialized already
Outdated
src/script/lua_api/l_object.cpp
appgurueu
@sfan5 sfan5 Nov 4, 2023
if we're introducing a new api `nil` should probably not silently count for `""`, confusing imo
Outdated
src/script/lua_api/l_object.cpp
@sfan5 sfan5 Nov 4, 2023
log_deprecated missing here and below
src/script/lua_api/l_object.cpp
appgurueu
@sfan5 sfan5 Nov 4, 2023
rebase mistake (how?)
Outdated
src/network/networkprotocol.h
appgurueu
@sfan5 sfan5 Nov 4, 2023
```suggestion { ```
Outdated
src/activeobject.h
@sfan5 sfan5 Nov 4, 2023
dunno ```suggestion * `interpolation`: Old and new values are interpolated over this timeframe (in seconds) ```
Outdated
doc/lua_api.md
@sfan5 sfan5 Nov 4, 2023
nitpick: this note seems to encourage using this function, however it is deprecated that it supports old clients can also be deduced from below information
Outdated
doc/lua_api.md
appgurueu
@SmallJoker SmallJoker Oct 30, 2022
``` 2022-10-30 13:28:04: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'lab' in callback on_chat_message(): attempt to index a string value 2022-10-30 13:28:04: ERROR[Main]: stack traceback: 2022-10-30 13:28:04: ERROR[Main]: [C]: in function 'get_bone_override' 2022-10-30 13:28:04: ERROR[Main]: XX/mods/lab/init_126_bone_overrides_12388.lua:29: in function 'func' ``` ```lua local player = assert(minetest.get_player_by_name(name)) print(dump(player:get_bone_override("Head"))) ```
src/script/lua_api/l_object.cpp
@SmallJoker SmallJoker Oct 30, 2022
``` 2022-10-30 13:27:06: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'lab' in callback on_chat_message(): attempt to index a userdata value 2022-10-30 13:27:06: ERROR[Main]: stack traceback: 2022-10-30 13:27:06: ERROR[Main]: [C]: in function 'get_bone_overrides' 2022-10-30 13:27:06: ERROR[Main]: XXX/mods/lab/init_126_bone_overrides_12388.lua:29: in function 'func' ``` ```lua local player = assert(minetest.get_player_by_name(name)) print(dump(player:get_bone_overrides())) ```
src/script/lua_api/l_object.cpp
@SmallJoker SmallJoker Oct 30, 2022
Inconsistent with `"vec"` from the input. Perhaps using macros in this file would help to avoid such mismatches....
Outdated
src/script/lua_api/l_object.cpp
@SmallJoker SmallJoker Oct 30, 2022
Might it make sense to pass by reference? There's quite some data in this struct.
Outdated
src/server/unit_sao.cpp
appgurueu
@SmallJoker SmallJoker Oct 30, 2022
How about `BoneOverride &props = it.second;` instead of manual overwrites?
Outdated
src/client/content_cao.cpp
@sfan5 sfan5 Sep 16, 2022
also no need for pointers here
Outdated
src/server/unit_sao.h
@sfan5 sfan5 Sep 16, 2022
no clang-format
Outdated
src/server/unit_sao.cpp
sfan5 appgurueu
@sfan5 sfan5 Sep 16, 2022
static
Outdated
src/script/lua_api/l_object.cpp
@sfan5 sfan5 Sep 16, 2022
```suggestion ```
Outdated
src/network/networkprotocol.h
@sfan5 sfan5 Sep 16, 2022
it doesn't look necessary here to create a new object instead of reusing whats already there
Outdated
src/client/content_cao.cpp
@sfan5 sfan5 Sep 16, 2022
proper OOP _would_ be to have these implementations inside `BoneOverride` (not saying you have to)
Outdated
src/client/content_cao.cpp
@sfan5 sfan5 Sep 16, 2022
`interpolate_timer` would be more apt
src/activeobject.h
@sfan5 sfan5 Sep 16, 2022
no reason to use pointers here
Outdated
src/activeobject.h
@sfan5 sfan5 Sep 16, 2022
```suggestion * `x`, `y` and `z` are in same coordinate system as the model, and in degrees for rotation ```
Outdated
doc/lua_api.txt
@sfan5 sfan5 Sep 16, 2022
I think something like `interpolate_dur` or just `interpolate` would be better -- Also mixing tables too much is annoying. Any reason not to use `{ pos = {...}, interpolate = 0, absolute = false }`? Edit: This is double bad because the engine will return a vector with a metatable set and everything but also contains foreign fields. **Definitely needs changing**.
Outdated
doc/lua_api.txt
appgurueu
@sfan5 sfan5 Sep 16, 2022
```suggestion * `get_bone_overrides()`: returns all bone overrides as table `{[bonename] = override, ...}` ```
Outdated
doc/lua_api.txt
@sfan5 sfan5 Sep 16, 2022
```suggestion * `get_bone_position(bone)`: returns the previously set position and rotation of the bone ```
Outdated
doc/lua_api.txt
@SmallJoker SmallJoker Sep 10, 2022
```suggestion auto it = m_bone_override.find(bone); return it != m_bone_override.end() ? it->second : nullptr; ``` .. because indexing creates a new entry which then shows up in `player:get_bone_overrides()`.
Outdated
src/server/unit_sao.cpp
@SmallJoker SmallJoker Sep 10, 2022
When an error is thrown in one of the checks below (`check_v3f`), this pointer is not freed. Same issue for `l_set_bone_position` Suggestion: Use `std::unique_ptr` + `.release()`
Outdated
src/script/lua_api/l_object.cpp
appgurueu SmallJoker
@SmallJoker SmallJoker Sep 10, 2022
What's the idea behind this conversion? For documentation purposes?
src/server/unit_sao.cpp
appgurueu
@SmallJoker SmallJoker Sep 10, 2022
```suggestion if (prev_props != props) ``` For completeness' sake, if anyone ever wants to feed back a pointer obtained from `getBoneOverride`.
Outdated
src/server/unit_sao.cpp
@SmallJoker SmallJoker Sep 10, 2022
`props` should be freed here.
src/client/content_cao.cpp
@SmallJoker SmallJoker Sep 10, 2022
1. BoneOverride's ownership is passed to this function. It must be deleted. 2. `override`. Minor issue. The function is (to my knowledge) not called.
Outdated
src/server/serveractiveobject.h
@SmallJoker SmallJoker Sep 10, 2022
```suggestion * Compatibility note: Clients prior to 5.7.0 only support absolute position and rotation. All values are treated as absolute. ``` But more importantly: what if an old client receives relative values? They will be treated as absolute; totally messing up the visuals. However I cannot find an easy solution for this issue - there is no client-specific handling in `generateUpdateBonePositionCommand`.
Outdated
doc/lua_api.txt
appgurueu
@SmallJoker SmallJoker Sep 10, 2022
Missing indent
Outdated
doc/lua_api.txt
@SmallJoker SmallJoker Sep 10, 2022
I'd move this down, above the compatibility note. This looks like a nested field documentation.
Outdated
doc/lua_api.txt
@SmallJoker SmallJoker Sep 10, 2022
```suggestion const BoneOverrideMap &UnitSAO::getBoneOverrides() const ``` Or could be moved to the header because it's a one-liner.
Outdated
src/server/unit_sao.cpp
@SmallJoker SmallJoker Sep 10, 2022
Unfortunate variable naming again (keyword). I don't comment on all occurrences. It looks like this one was forgotten?
Outdated
src/server/unit_sao.cpp
@SmallJoker SmallJoker Sep 10, 2022
Tip: Put each section into its own scope for readability like this: ```C++ // Rotation { core::quaternion rotation; progress = props->dtime_passed / props->rotation.interpolation_duration; if (progress > 1.0f || props->rotation.interpolation_duration == 0.0f) progress = 1.0f; rotation.slerp(props->rotation.previous, props->rotation.next, progress); if (!props->rotation.absolute) { core::quaternion bone_rot(bone->getRotation() * core::DEGTORAD); rotation = rotation * bone_rot; // first rotate around bone rot, then rot } v3f rot_euler; rotation.toEuler(rot_euler); bone->setRotation(rot_euler * core::RADTODEG); } // Scale { ```
Outdated
src/client/content_cao.cpp
@SmallJoker SmallJoker Sep 10, 2022
> Putting the body of an if statement on the same line as the condition is strictly prohibited. https://dev.minetest.net/Code_style_guidelines#if_statements Same for the other occurrences you can find, e.g. in `GenericCAO::processMessage`, `UnitSAO::setBoneOverride`.
Outdated
src/client/content_cao.cpp
@sfan5 sfan5 Jul 29, 2022
It looks like you merged this incorrectly, the bone position comment is now gone
Outdated
src/network/networkprotocol.h
appgurueu
@SmallJoker SmallJoker Jun 11, 2022
Is `auto &prop` possible? If so, that would eliminate the assignments below. If not, it might be necessary to use struct inheritance in `BoneOverride` to have a defined object type in this Lambda.
Outdated
src/script/lua_api/l_object.cpp
@SmallJoker SmallJoker Jun 11, 2022
```suggestion const std::unordered_map<std::string, BoneOverride*> &getBoneOverrides() const; ```
Outdated
src/server/unit_sao.h
@SmallJoker SmallJoker Jun 11, 2022
```suggestion writeU8(os, (override->position.absolute & 1) << 0 | (override->rotation.absolute & 1) << 1 | (override->scale.absolute & 1) << 2); ``` In the same style as `PlayerControl`. This 1. ensures proper values and 2. Obvious bit positions.
Outdated
src/server/unit_sao.cpp
@SmallJoker SmallJoker Jun 11, 2022
Idea: Shorten this map type using a `typedef` somewhere in `activeobject.h`.
Outdated
src/server/serveractiveobject.h
@SmallJoker SmallJoker Jun 11, 2022
Suggestion: Move to a Lambda, like above. Also add new lines to separate each section (i.e. table).
Outdated
src/script/lua_api/l_object.cpp
@SmallJoker SmallJoker Jun 11, 2022
Invalid index here and for absolute. Suggestion: Replace the common `"absolute"` and `"interpolation_duration"` code with a Lambda to reduce redundancy and inconsistency.
Outdated
src/script/lua_api/l_object.cpp
@SmallJoker SmallJoker Jun 11, 2022
```suggestion if (lua_isnoneornil(L, 3)) { ``` More new lines to separate the sections would improve the code readability too.
Outdated
src/script/lua_api/l_object.cpp
@SmallJoker SmallJoker Jun 11, 2022
These could be specified as defaults in the `BoneOverride` struct directly.
Outdated
src/script/lua_api/l_object.cpp
appgurueu
@SmallJoker SmallJoker Jun 11, 2022
Unfortunate variable name here as well.
Outdated
src/script/lua_api/l_object.cpp
@SmallJoker SmallJoker Jun 11, 2022
Unnecessary include. This slows down the compile process. ```C++ class BoneOverride; ``` (a few lines below, though)
Outdated
src/client/content_cao.h
@SmallJoker SmallJoker Jun 11, 2022
This is dangerous. Map assignments and object freeing should happen in the same scope to avoid dangling pointers caused by logic errors. Generally, I would prefer to not use pointers in this case. A sequential memcpy on this struct is quick to execute during runtime.
Outdated
src/client/content_cao.cpp
appgurueu
@SmallJoker SmallJoker Jun 11, 2022
Please include a note for the current protocol version. Even though this does not need a bump, a rough timestamp for this legacy code would be helpful. Also needs an entry in `networkprotocol.h`.
Outdated
src/client/content_cao.cpp
@SmallJoker SmallJoker Jun 11, 2022
```suggestion const BoneOverride *spec = it.second; ``` 1. To avoid the `override` keyword for syntax highlighting reasons 2. Const to keep the code reasonable and more self-explanatory.
Outdated
src/client/content_cao.cpp
@SmallJoker SmallJoker Jun 11, 2022
Initializer list is not necessary for classes with default constructors, i.e. `v3*` and `core::quaternion`.
Outdated
src/activeobject.h
@SmallJoker SmallJoker Jun 11, 2022
+4 spaces for each indent, especially for the `absolute` part above to easier distinguish the sub-lists.
Outdated
doc/lua_api.txt
@SmallJoker SmallJoker Jun 11, 2022
```suggestion * Shorthand for `set_bone_override(bone, {position = ..., rotation = ...})` using absolute values. ```
Outdated
doc/lua_api.txt
@appgurueu appgurueu May 30, 2022
Is this a memleak - should I delete the previous override?
Outdated
src/server/unit_sao.cpp
JosiahWI