rules

package
v0.24.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2024 License: BSD-3-Clause Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddEventFilters

func AddEventFilters(filters []rt.BoolEval) (ret []rt.BoolEval)

filter to the innermost target.

func AddKindFilter

func AddKindFilter(kind string, filters []rt.BoolEval) (ret []rt.BoolEval)

func AddNounFilter

func AddNounFilter(noun string, filters []rt.BoolEval) (ret []rt.BoolEval)

func AddPlayerFilter

func AddPlayerFilter(filters []rt.BoolEval) (ret []rt.BoolEval)

ensure that the target of an action is the player ( jess apples this filter to actor actions unless specifically asked not to )

func CanFilterActor

func CanFilterActor(k *rt.Kind) (ret bool)

func DoesTerminate

func DoesTerminate(exe []rt.Execute) bool

tdb: could this? be processed at load time (storyImport)

func DoesUpdate

func DoesUpdate(exe []rt.Execute) (okay bool)

Check to see if there are counters that might need updating on the regular. tdb: could this be processed at load time (storyImport)

func FilterHasCounter

func FilterHasCounter(filter rt.BoolEval) (okay bool)

func FindNamedResponse

func FindNamedResponse(exe []rt.Execute) (ret string)

return the first response definition in the block

Types

type Prefix

type Prefix int

words preceding a rule name control the grouping, sorting, and interaction of similar rules. ex. "instead of taking" sorts after "before taking" within the "before" grouping. "when" is the default

const (
	Before  Prefix = iota // before
	Instead               // instead of
	When                  // when
	After                 // after
	Report                // report
	//
	NumPrefixes = iota
)

func (Prefix) String

func (i Prefix) String() string

type RuleInfo

type RuleInfo struct {
	Name           string // name of the pattern / kind
	Label          string // friendly name of the rule itself
	Rank           int    // smaller ranked rules run first
	Stop           bool
	Jump           rt.Jump
	ExcludesPlayer bool // true if the rule should apply to all actors
}

func (RuleInfo) WeaveRule

func (rule RuleInfo) WeaveRule(w weaver.Weaves, filters []rt.BoolEval, exe []rt.Execute) error

fix: move to jess or break into parts, some in rule

type RuleName

type RuleName struct {
	Path           []string // path of the pattern targeted by this rule
	Label          string   // friendly name of the rule itself
	Prefix         Prefix
	Suffix         Suffix
	ExcludesPlayer bool // true if the rule should apply to all actors
}

results of reading author specified pairs of pattern name and rule name. for example ("before someone jumping", "people jump for joy")

func ReadPhrase

func ReadPhrase(ks rt.Kinds, patternSpec, ruleSpec string) (ret RuleName, err error)

pattern name as specified optional rule name as specified ex. Define rule:named:do: ["activating", "the standard activating action" ]

func (RuleName) EventName

func (n RuleName) EventName() (ret string)

instead and report are grouped with before and after respectively fix: can this move to rule info?

func (RuleName) GetRuleInfo

func (n RuleName) GetRuleInfo() (ret RuleInfo, err error)

match an author specified pattern reference to various naming conventions and pattern definitions to determine the intended pattern name, rank, and termination behavior. for example: "instead of x", "before x", "after x", "report x".

func (RuleName) IsEvent

func (n RuleName) IsEvent() bool

type Suffix

type Suffix int

words that can follow a rule name ex. "taking then continue"

const (
	UnspecfiedSuffix Suffix = iota
	Continues               // then continue
	Stops                   // then stop
	Skips                   // then skip phase
	//
	NumSuffixes = iota
)

func (Suffix) String

func (i Suffix) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL