refactor variable system to be the responsibility of effect enforcer.

This commit is contained in:
2023-01-15 22:56:37 +01:00
parent 4ec8918308
commit d2b2244e2f
11 changed files with 126 additions and 219 deletions
+13
View File
@@ -3,7 +3,9 @@ package events
import (
"fmt"
lucifer3 "git.aiterp.net/lucifer3/server"
"git.aiterp.net/lucifer3/server/internal/gentools"
"github.com/google/uuid"
"strings"
)
type AssignmentCreated struct {
@@ -32,3 +34,14 @@ type DeviceAssigned struct {
func (e DeviceAssigned) EventDescription() string {
return fmt.Sprintf("DeviceAssigned(device=%s, %s)", e.DeviceID, e.AssignmentID)
}
type AssignmentVariables struct {
ID uuid.UUID
Map map[string]float64
}
func (e AssignmentVariables) EventDescription() string {
return fmt.Sprintf("AssignmentVariables(id=%s, keys=[%s])",
e.ID, strings.Join(gentools.MapKeys(e.Map), ","),
)
}