Scriptname zbfSexLabBaseEntry extends ReferenceAlias

; Name of the animation, just a simple human readable name
; 
; Examples:
; Skull Fuck
; Aggressive Missionary
; Aggressive Doggy Style
; 
String Property Name Auto

; Identifier for this animation, normally set to the same as BaseName
; 
; Used internally to dynamically build animations.
; 
String Property BaseId Auto

; Identifier for the any corresponding vanilla animation
; 
; Can be used to match an animation base back to its vanilla representation or to find out if a base
; corresponds to a vanilla registration.
; 
String Property VanillaBaseId Auto

; Base name of the animation
;
; These names are used to create the final animation names that are plugged into the 
; support functions in zbfSexLab.
; 
; A typical call to define, say SkullFuck01:
; [CODE]
; zbfSexLab zbfSL = .... ; fetch this variable somehow, probably zbfUtil.GetSL()
; zbfBondageShell zbf = .... ; again fetch through for instance zbfUtil.GetMain()
; zbfSexLabBaseEntry entry = .... ; This entry, you got this somehow, probably by filtering
; 
; sslBaseAnimation anim = Factory.Create(id) ; Fetches the animation we're writing to
; zbfSL.DefineSkullFuck01(anim, "MyModBlowjob", "ZapArmb" + entry.BaseName, entry.VanillaBaseName)
; anim.Save(-1)
; [/CODE]
; 
; The above code would define the animation skull fuck in the variable anim, allowing it to play
; through SexLab at a later time. Actor1 is set up to be bound with an armbinder, and Actor2 uses
; the default animation set up.
; 
; It would be equally possible to set up both actors to be bound by instead calling:
; zbfSL.DefineSkullFuck01(anim, "MyModBlowjob", "ZapArmb" + entry.BaseName, "ZapYoke" + entry.BaseName)
; 
; In the above code, Actor2 is bound with a yoke instead of an armbinder. Actor1 is still bound in the
; armbinder.
; 
; In practice, one would want to also define extra tags on the animation such as "DomSub" and "SubSub" in
; the first and second examples respectively.
; 
; Examples:
; SkullFuck01
; Missionary01
; 
String Property BaseName Auto

; Base name of the vanilla animation
; 
; See BaseName for a proper description. Used when setting up custom animations.
; 
String Property VanillaBaseName Auto

; Registered names of this animation.
; 
; Many (most) animations are registered more than once due to several combinations 
; of bound actors and actors in different bindings. Examples are Missionary01 which 
; has variants of Actor1 bound both with armbinder and with regular wrist restraints.
; 
; This property contains all the internal registrations called on zbfSexLab.
; 
String[] Property Registrations Auto

; List of MCM names for each Registration above
; 
; This is a list of $ZapBlahBlahBlah for it to be possible to translate.
; 
String[] Property RegNames Auto

; Global animation tags
; 
; List of tags used by this animation.
; 
; This is the regular (but slightly truncated) list of SexLab tags.
; 
; Some items are never included here, like ZaZ, bound, etc. These tags are present on all ZaZ 
; animations, so there is no reason to repeat them here.
;
; Tags not included:
; ZaZ
; Bound
; 
; Tags that are included (not limited to):
; Aggressive
; Foreplay
; Vaginal
; Oral
; Anal
; Lesbian
; 
; NOTE:
; The list of tags here does not 100% correspond to the list of tags on the final
; animation, as the final animation will have tags such as ZaZ, Bound, and so on specified.
; 
String[] Property Tags Auto

; Actor specific tags
; 
; Some actors support different animations than other actors. This set of tags also identifies
; used body parts on each actor. Filter these tags based on if the actor is restrained or similar.
; Chastity belt requires filtering out "vaginal" for that actor, and gags suggest filtering out
; "oral".
; 
; Actor1 typically has the most support.
; 
; Tags here include the animation support of each actor. Note that in the finished animation, 
; only a subset of these should be present.
; 
; Tags used:
; Armbinder - Actor can wear an armbinder
; Yoke - Actor can wear a yoke
; Wrists - Actor can be bound at the wrists
; Oral - Actor needs his/her mouth free for the animation to make sense.
; Vaginal - Actor needs his/her crotch free for the animation to make sense.
; Anal - ....
; Boobs - ....
; 
; Example:
; - For Lesbian01, Actor1 = Actor2 = ["Wrists", "Armbinder", "Oral", "Vaginal"]
; meaning that both actors can be bound with any combination of armbinder and wrists restraints, or not
; at all.
; Also it means that both actors need to have the mouth and vagina free for access.
; 
String[] Property Actor1 Auto
String[] Property Actor2 Auto
String[] Property Actor3 Auto
String[] Property Actor4 Auto

; Number of actors this animation is designed for.
; 
; Most animations are designed for two actors, so this is the default value if not explicitly forced to
; something else.
; 
Int Property NumActors Auto

; Initializes all values to default (empty) settings
; 
Function SetDefaults()
	String[] empty

	Name = ""
	BaseId = ""
	VanillaBaseId = ""
	BaseName = ""
	VanillaBaseName = ""

	Registrations = empty
	RegNames = empty

	Tags = empty

	Actor1 = empty
	Actor2 = empty
	Actor3 = empty
	Actor4 = empty

	NumActors = 2
EndFunction

; Returns true if the Entry is tagged with the keyword.
; 
Bool Function HasTag(String asTag)
	Return Tags.Find(asTag) >= 0
EndFunction

; Returns true if aiActor (1-4) is tagged with the keyword.
; 
; Used to filter out animations containing support for a certain type of binding. If
; actor is specified as #0, then the global list of tags is returned.
; 
Bool Function HasTagForActor(Int aiActor, String asTag)
	Return GetTags(aiActor).Find(asTag) >= 0
EndFunction

; Check actor tags against forbidden and required tags.
; 
; Return True only if all required tags were found and no forbidden tags were found.
; 
Bool Function IsValidTags(Int aiActor, String[] asRequired, String[] asForbidden)
	Int req
	String[] actorTags = GetTags(aiActor)
	
	;Debug.Trace("zbfSexLabBaseEntry: Scanning entry " + BaseId)
	;Debug.Trace("zbfSexLabBaseEntry: Required tags " + asRequired)
	;Debug.Trace("zbfSexLabBaseEntry: Blocked tags " + asForbidden)
	;Debug.Trace("zbfSexLabBaseEntry: Actual tags " + actorTags)

	req = asRequired.Length
	While (req > 0)
		req -= 1
		If (asRequired[req] != "") && (actorTags.Find(asRequired[req]) < 0)
			Return False
		EndIf
	EndWhile

	req = asForbidden.Length
	While (req > 0)
		req -= 1
		If (asForbidden[req] != "") && (actorTags.Find(asForbidden[req]) >= 0)
			Return False
		EndIf
	EndWhile

	Return True ; Passed all checks
EndFunction

; Returns the tags for the provided argument
; 
; aiActor specifies the actor to retrieve tags for (1-4), or 0 to fetch the global
; tags pool.
; 
String[] Function GetTags(Int aiActor)
	String[] foundTags
	If aiActor == 0
		foundTags = Tags
	ElseIf aiActor == 1
		foundTags = Actor1
	ElseIf aiActor == 2
		foundTags = Actor2
	ElseIf aiActor == 3
		foundTags = Actor3
	ElseIf aiActor == 4
		foundTags = Actor4
	EndIf
	Return foundTags
EndFunction
