Grumlydude
Newbie
- Mar 15, 2023
- 23
- 23
- 54
This is because Pyhton has no restriction of visibility for properties/fields of an object. All properties are "public" like in Javascript for example.Sluttiness is handled a bit differently in the code compared to love and obedience (idk why). It can be referenced two ways, but only one of them can actually be changed in .rpy scripts (see spoiler 1).
As a workaround, devs use a commonly accepted syntax to describe a property that should only be used inside of an object ("private"). Those "private" properties are beginning with one or two underscore. For those two reasons you can see the internal value using
._sluttinessIn our case, when you want to show a calculated value based on the inner value, you define a method to show what you want. This is why you also have access to this value using
.sluttiness syntax. But you cannot modify it because it's a "getter" method and not a real property.
Python:
@property
def sluttiness(self) -> int:
return max(min(self._sluttiness + sum(amount for (amount, _) in self.situational_sluttiness.values()), 100), 0)
Last edited: