Liking cljdoc? Tell your friends :D

lambdaisland.witchcraft.citizens


create-npcclj

(create-npc entity-type npc-name)
source

despawnclj

(despawn the-npc)
source

destroyclj

(destroy the-npc)
source

has-trait?clj

(has-trait? npc trait)
source

HasCreateNPCcljprotocol

-create-npcclj

(-create-npc _ e s)
source

HasNavigatorcljprotocol

-navigatorclj

(-navigator _)
source

HasNPCcljprotocol

-npcclj

(-npc _)
source

HasTraitscljprotocol

-get-or-add-traitclj

(-get-or-add-trait _ c)

-get-traitsclj

(-get-traits _)

-remove-traitclj

(-remove-trait _ c)
source

make-traitclj

(make-trait name callbacks)

Create a subclass of npcs.citizensapi.trait.Trait, name is a simple lowercase identifier of the trait like "sneak" or "aggressive". callbacks is a map from keyword to function (or var, IFn). Callbacks receive this (the trait) as first arg. :load and :save also receive a DataKey.

Callbacks: :load, :save, :on-attach, :on-copy, :on-despawn, :on-pre-spawn, :run, :save.

Can be called multiple times, subsequent calls will only replace the callbacks. Returns the trait subclass java.lang.Class.

Note that adding a :run callback for a Trait that is already attached to an NPC will not cause it to be called. Remove the Trait from the NPC and add it back.

To give your trait state, provide an :init key (map or function that returns a map), this will provide your trait's initial state. You can use the trait instance itself as an atom, e.g. call @this or (swap! this ...) to get/set values. Any state set this way will automatically be persisted by the default :load/:save implementations, unless the value has a :no-persist metadata.

To initialize the Trait instance after instantiation, use :post-init.

Create a subclass of npcs.citizensapi.trait.Trait, `name` is a simple lowercase
identifier of the trait like `"sneak"` or `"aggressive"`. `callbacks` is a
map from keyword to function (or var, IFn). Callbacks receive `this` (the
trait) as first arg. `:load` and `:save` also receive a `DataKey`.

Callbacks: `:load`, `:save`, `:on-attach`, `:on-copy`, `:on-despawn`,
`:on-pre-spawn`, `:run`, `:save`.

Can be called multiple times, subsequent calls will only replace the
callbacks. Returns the trait subclass `java.lang.Class`.

Note that adding a `:run` callback for a Trait that is already attached to an
NPC will not cause it to be called. Remove the Trait from the NPC and add it
back.

To give your trait state, provide an `:init` key (map or function that returns
a map), this will provide your trait's initial state. You can use the trait
instance itself as an atom, e.g. call `@this` or `(swap! this ...)` to get/set
values. Any state set this way will automatically be persisted by the default
`:load`/`:save` implementations, unless the value has a `:no-persist`
metadata.

To initialize the Trait instance after instantiation, use `:post-init`.
sourceraw docstring

(navigate-to npc loc)
source

(navigator o)
source

npcclj

(npc o)
source

npc-by-idclj

(npc-by-id id)
source

npc-registryclj

(npc-registry)
source

npc-traitclj

(npc-trait npc trait-name)

Get the trait with the given name for the given NPC, adds it if it hasn't been added to the NPC already, and returns the Trait instance.

Get the trait with the given name for the given NPC, adds it if it hasn't been
added to the NPC already, and returns the Trait instance.
sourceraw docstring

remove-traitclj

(remove-trait npc trait)
source

spawned?clj

(spawned? the-npc)
source

stop-navigatingclj

(stop-navigating npc)
source

trait-classclj

(trait-class trait-name)
source

trait-factoryclj

(trait-factory)
source

trait-namesclj

(trait-names npc)
source

traitsclj

(traits npc)
source

update-traitsclj

(update-traits npc traits)
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close