add variable system + fix bugs here and there.

This commit is contained in:
2023-01-13 01:19:34 +01:00
parent 88036cfcae
commit 842f96d8e3
22 changed files with 368 additions and 43 deletions
+2
View File
@@ -28,6 +28,7 @@ func (p *Pointer) AddAlias(alias string) (added *string, removed *string) {
if strings.HasPrefix(alias, "lucifer:name:") {
for i, alias2 := range p.Aliases {
if strings.HasPrefix(alias2, "lucifer:name:") {
p.Aliases = append(p.Aliases[:0:0], p.Aliases...)
p.Aliases = append(p.Aliases[:i], p.Aliases[i+1:]...)
removed = gentools.ShallowCopy(&alias2)
break
@@ -48,6 +49,7 @@ func (p *Pointer) RemoveAlias(alias string) bool {
for i, alias2 := range p.Aliases {
if alias2 == alias {
p.Aliases = append(p.Aliases[:0:0], p.Aliases...)
p.Aliases = append(p.Aliases[:i], p.Aliases[i+1:]...)
return true
}
+10 -4
View File
@@ -70,10 +70,16 @@ func (s State) Interpolate(s2 State, f float64) State {
}
if s.Power != nil && s2.Power != nil {
if f < 0.5 {
newState.Power = gentools.ShallowCopy(s.Power)
} else {
newState.Power = gentools.ShallowCopy(s2.Power)
if *s.Power == *s2.Power {
newState.Power = s.Power
}
// With power, interpolate strongly in the direction of power
if *s.Power {
newState.Power = gentools.Ptr(f < 0.95)
}
if *s2.Power {
newState.Power = gentools.Ptr(f > 0.05)
}
} else if s.Power != nil {
newState.Power = gentools.ShallowCopy(s.Power)