Volte6 / GoMud

Public repository for GoMud, a Go based Mud server.
49 stars 8 forks source link

Rewrite command function signatures #113

Closed Volte6 closed 1 month ago

Volte6 commented 1 month ago

Motivation

The command function definition has changed over time as we gain experience in how we actually use it vs. the original ideation. This is another step in simplicity.

Commands accept an argument (userId int or mobInstanceId int) which defines who is invoking the command. As a result every command function must do a lookup of the userId or mobInstanceId as well as validate it (make sure it's not null), which is a lot of redundant code. Originally it was thought that not all commands would need access to the user object. This is true, but not true very often. So, to simplify we will just pass the user/mob object pointer to the function instead of their identifier.

Additionally updated to pass a pointer to the Room object to the command for the same reasons.

Changes