Open razvand opened 10 years ago
Actually, points are configured when player first logs in; after logging in for the first time, the player gets 420 points (the configured value for "start-points" formula). Is this the expected behavior?
Yes, start-points are given when the user first login, since the majority of users are created at first login (because we're using ldap as the authentication provider).
If you justify the need, we can change the behaviour, and give start points on user creation.
I don't have a clear picture of what should be the expected behavior. But I incline to see the user having all required resources at creation time. Even in the case of LDAP, it's still creation time; it just happens that login time and creation time are identical.
It makes sense.
I see this implemented as a signal handler in the game core (the signal being emitted on Player.save, django already does that).
But, whenever a player is created, couldn't the implementation simply retrieve the formula and the value of the "start-points" variable and configure starting points for the player?
Yes. I was just emphasising the need to keep the code decoupled: user creation happens in core.models (and also django.contrib.auth.models), start-points giving should happen in core.game or core.game.god.
The recommended solution is to use signals.
Right, that makes sense.
When creating a new user through the Control Panel interface (the "Players" link), that player gets 0 points. The "start-points" formula in the "Formulas" link is by default configured to 420. However, it isn't taken into account when creating the new user.