2021-06-06 15:55:04 +00:00
|
|
|
EntityConfig (
|
2021-06-04 23:10:15 +00:00
|
|
|
/// Name of Entity
|
|
|
|
name: Some("Paddy"),
|
|
|
|
|
|
|
|
/// Body
|
|
|
|
/// Can be Exact (Body with all fields e.g BodyType, Species, Hair color and such)
|
|
|
|
/// or Random (will use random if available for this Body)
|
|
|
|
/// or RandomWith (will use random_with if available for this Body)
|
Split LodoutBuilder::build_loadout
LoadoutBuilder::build_loadout is a function which has four parameters
and 3 of them are Option<>, and although fourth (body) isn't Option<>,
it's optional too because it is used only in some combinations of
another arguments.
Because these combinations produces quirky code flow, it will be better
to split it to different methods.
So we did following changes to remove it and rewrite code that was using it
to use better methods.
* Introduce LoadoutPreset as new LoadoutConfig, currently it's only used
in Summon ability, because SummonInfo uses Copy and we can't specify
String for specifying asset path for loadout.
Everything else is rewritten to use asset path to create loadouts.
* More builder methods for LoadoutBuilder.
Namely:
- from_default which is used in server/src/cmd.rs in "/spawn" command.
- with_default_equipment, with_default_maintool to use default
loadout for specific body
- with_preset to use LoadoutPreset
* Add new make_loadout field with `fn (loadout_builder, trading_info) -> loadout_builder`
to EntityInfo which allows to lazily construct loadout without
modifying LoadoutBuilder code
* Fix Merchants not having trade site
We had heuristic that if something has Merchant LoadoutConfig - it's
merchant, which can be false, especially if we create Merchant loadout
lazily
As side note, we do same check for Guards and it fails too.
Too fix it, we introduce new agent::Mark, which explicitly specifies
kind of agent for entity
* `LoadoutBuilder::build_loadout` was written in a such way that depending
on main_tool you will have different loadout. Turns out it was this
way only for Adlets though and this behaviour is reproduced by specifying
different loadouts directly in world code.
2021-06-05 18:05:31 +00:00
|
|
|
// body: Humanoid(Random),
|
2021-06-04 23:10:15 +00:00
|
|
|
|
|
|
|
/// Main and second tools
|
|
|
|
/// Can be Option<Item> (with asset_specifier for item)
|
|
|
|
/// or Choice
|
|
|
|
/// (array of pairs with weight of choosing some item and Option<Item>)
|
|
|
|
main_tool: Some(Item("common.items.weapons.axe_1h.orichalcum-0")),
|
|
|
|
second_tool: None,
|
|
|
|
|
2021-06-06 15:55:04 +00:00
|
|
|
/// Loadout Config (with asset_specifier for loadout)
|
2021-06-07 21:58:05 +00:00
|
|
|
loadout_asset: Some("common.loadout.village.merchant"),
|
2021-06-04 23:10:15 +00:00
|
|
|
|
2021-06-07 21:58:05 +00:00
|
|
|
/// Skillset Config (with asset_specifier for skillset)
|
|
|
|
skillset_asset: Some("common.skillset.village.merchant"),
|
2021-06-04 23:10:15 +00:00
|
|
|
|
2021-06-06 15:55:04 +00:00
|
|
|
/// Loot
|
|
|
|
/// Can be Item (with asset_specifier for item)
|
|
|
|
/// or LootTable (with asset_specifier for loot table)
|
|
|
|
// loot: LootTable("common.loot_tables.humanoids"),
|
|
|
|
|
2021-06-04 23:10:15 +00:00
|
|
|
/// Meta Info (level, alignment, agency, etc)
|
Split LodoutBuilder::build_loadout
LoadoutBuilder::build_loadout is a function which has four parameters
and 3 of them are Option<>, and although fourth (body) isn't Option<>,
it's optional too because it is used only in some combinations of
another arguments.
Because these combinations produces quirky code flow, it will be better
to split it to different methods.
So we did following changes to remove it and rewrite code that was using it
to use better methods.
* Introduce LoadoutPreset as new LoadoutConfig, currently it's only used
in Summon ability, because SummonInfo uses Copy and we can't specify
String for specifying asset path for loadout.
Everything else is rewritten to use asset path to create loadouts.
* More builder methods for LoadoutBuilder.
Namely:
- from_default which is used in server/src/cmd.rs in "/spawn" command.
- with_default_equipment, with_default_maintool to use default
loadout for specific body
- with_preset to use LoadoutPreset
* Add new make_loadout field with `fn (loadout_builder, trading_info) -> loadout_builder`
to EntityInfo which allows to lazily construct loadout without
modifying LoadoutBuilder code
* Fix Merchants not having trade site
We had heuristic that if something has Merchant LoadoutConfig - it's
merchant, which can be false, especially if we create Merchant loadout
lazily
As side note, we do same check for Guards and it fails too.
Too fix it, we introduce new agent::Mark, which explicitly specifies
kind of agent for entity
* `LoadoutBuilder::build_loadout` was written in a such way that depending
on main_tool you will have different loadout. Turns out it was this
way only for Adlets though and this behaviour is reproduced by specifying
different loadouts directly in world code.
2021-06-05 18:05:31 +00:00
|
|
|
// meta: {},
|
2021-06-06 15:55:04 +00:00
|
|
|
)
|