mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Add loadout spec examples
This commit is contained in:
parent
cfba7bfc65
commit
dd02e8ae6a
30
assets/test/loadout/ok/example_royal_guard.ron
Normal file
30
assets/test/loadout/ok/example_royal_guard.ron
Normal file
@ -0,0 +1,30 @@
|
||||
#![enable(implicit_some)]
|
||||
(
|
||||
inherit: Combine([
|
||||
Asset("test.loadout.ok.just_crafted_rings"),
|
||||
Choice([
|
||||
(1, Asset("test.loadout.ok.just_ori_armor")),
|
||||
(1, Asset("test.loadout.ok.just_dragonscale")),
|
||||
]),
|
||||
Asset("test.loadout.ok.just_butterfly_gliders"),
|
||||
Asset("test.loadout.ok.just_lanterns"),
|
||||
]),
|
||||
active_hands: Choice([
|
||||
(1, InHands((
|
||||
Item("common.items.weapons.sword.caladbolg"),
|
||||
None,
|
||||
))),
|
||||
(1, InHands((
|
||||
Item("common.items.weapons.bow.sagitta"),
|
||||
None,
|
||||
))),
|
||||
(1, InHands((
|
||||
Item("common.items.weapons.hammer_1h.orichalcum-0"),
|
||||
Item("common.items.weapons.hammer_1h.orichalcum-0"),
|
||||
))),
|
||||
(1, InHands((
|
||||
Item("common.items.weapons.axe_1h.orichalcum-0"),
|
||||
Item("common.items.weapons.shield.shield_1"),
|
||||
))),
|
||||
]),
|
||||
)
|
12
assets/test/loadout/ok/inherit_rings.ron
Normal file
12
assets/test/loadout/ok/inherit_rings.ron
Normal file
@ -0,0 +1,12 @@
|
||||
#![enable(implicit_some)]
|
||||
(
|
||||
inherit: Asset("test.loadout.ok.just_rings"),
|
||||
head: Item("common.items.armor.cultist.bandana"),
|
||||
active_hands: InHands((
|
||||
Item("common.items.weapons.axe_1h.orichalcum-0"),
|
||||
Choice([
|
||||
(1, Item("common.items.weapons.hammer_1h.orichalcum-0")),
|
||||
(1, Item("common.items.weapons.axe_1h.orichalcum-0")),
|
||||
]),
|
||||
)),
|
||||
)
|
@ -0,0 +1,7 @@
|
||||
#![enable(implicit_some)]
|
||||
(
|
||||
inherit: Combine([
|
||||
Asset("test.loadout.ok.just_rings"),
|
||||
Asset("test.loadout.ok.just_choice_hands"),
|
||||
]),
|
||||
)
|
7
assets/test/loadout/ok/inherit_rings_or_choice_hands.ron
Normal file
7
assets/test/loadout/ok/inherit_rings_or_choice_hands.ron
Normal file
@ -0,0 +1,7 @@
|
||||
#![enable(implicit_some)]
|
||||
(
|
||||
inherit: Choice([
|
||||
(1, Asset("test.loadout.ok.just_rings")),
|
||||
(1, Asset("test.loadout.ok.just_choice_hands")),
|
||||
]),
|
||||
)
|
34
assets/test/loadout/ok/just_all_entries.ron
Normal file
34
assets/test/loadout/ok/just_all_entries.ron
Normal file
@ -0,0 +1,34 @@
|
||||
// Simple example that shows loadout spec with all entries.
|
||||
|
||||
#![enable(implicit_some)]
|
||||
(
|
||||
// Gear
|
||||
head: Item("common.items.npc_armor.biped_small.myrmidon.head.hoplite"),
|
||||
neck: Item("common.items.armor.misc.neck.gem_of_resilience"),
|
||||
shoulders: Item("common.items.armor.twigsflowers.shoulder"),
|
||||
chest: Item("common.items.armor.twigsflowers.chest"),
|
||||
gloves: Item("common.items.armor.twigsflowers.hand"),
|
||||
ring1: Item("common.items.armor.misc.ring.gold"),
|
||||
ring2: Item("common.items.armor.misc.ring.gold"),
|
||||
back: Item("common.items.armor.misc.back.dungeon_purple"),
|
||||
belt: Item("common.items.armor.twigsflowers.belt"),
|
||||
legs: Item("common.items.armor.twigsflowers.pants"),
|
||||
feet: Item("common.items.armor.twigsflowers.foot"),
|
||||
tabard: Item("common.items.debug.admin"),
|
||||
// Misc
|
||||
bag1: Item("common.items.armor.misc.bag.tiny_leather_pouch"),
|
||||
bag2: Item("common.items.armor.misc.bag.tiny_leather_pouch"),
|
||||
bag3: Item("common.items.armor.misc.bag.tiny_leather_pouch"),
|
||||
bag4: Item("common.items.armor.misc.bag.tiny_leather_pouch"),
|
||||
lantern: Item("common.items.lantern.black_0"),
|
||||
glider: Item("common.items.glider.basic_red"),
|
||||
// Weapons
|
||||
active_hands: InHands((
|
||||
Item("common.items.weapons.sword_1h.bloodsteel-0"),
|
||||
Item("common.items.weapons.sword_1h.bloodsteel-0"),
|
||||
)),
|
||||
inactive_hands: InHands((
|
||||
Item("common.items.weapons.sceptre.sceptre_velorite_0"),
|
||||
None,
|
||||
)),
|
||||
)
|
8
assets/test/loadout/ok/just_butterfly_gliders.ron
Normal file
8
assets/test/loadout/ok/just_butterfly_gliders.ron
Normal file
@ -0,0 +1,8 @@
|
||||
#![enable(implicit_some)]
|
||||
(
|
||||
glider: Choice([
|
||||
(1, Item("common.items.glider.moth")),
|
||||
(1, Item("common.items.glider.morpho")),
|
||||
(1, Item("common.items.glider.monarch")),
|
||||
]),
|
||||
)
|
17
assets/test/loadout/ok/just_choice_hands.ron
Normal file
17
assets/test/loadout/ok/just_choice_hands.ron
Normal file
@ -0,0 +1,17 @@
|
||||
#![enable(implicit_some)]
|
||||
(
|
||||
active_hands: Choice([
|
||||
(1, InHands((
|
||||
Item("common.items.weapons.axe_1h.orichalcum-0"),
|
||||
Item("common.items.weapons.axe_1h.orichalcum-0"),
|
||||
))),
|
||||
(1, InHands((
|
||||
Item("common.items.weapons.hammer_1h.orichalcum-0"),
|
||||
Item("common.items.weapons.axe_1h.orichalcum-0"),
|
||||
))),
|
||||
(1, InHands((
|
||||
Item("common.items.weapons.sword.cultist"),
|
||||
None,
|
||||
))),
|
||||
]),
|
||||
)
|
21
assets/test/loadout/ok/just_crafted_rings.ron
Normal file
21
assets/test/loadout/ok/just_crafted_rings.ron
Normal file
@ -0,0 +1,21 @@
|
||||
#![enable(implicit_some)]
|
||||
(
|
||||
ring1: Choice([
|
||||
(1, Item("common.items.armor.misc.ring.amethyst")),
|
||||
(1, Item("common.items.armor.misc.ring.diamond")),
|
||||
(1, Item("common.items.armor.misc.ring.emerald")),
|
||||
(1, Item("common.items.armor.misc.ring.gold")),
|
||||
(1, Item("common.items.armor.misc.ring.ruby")),
|
||||
(1, Item("common.items.armor.misc.ring.sapphire")),
|
||||
(1, Item("common.items.armor.misc.ring.topaz")),
|
||||
]),
|
||||
ring2: Choice([
|
||||
(1, Item("common.items.armor.misc.ring.amethyst")),
|
||||
(1, Item("common.items.armor.misc.ring.diamond")),
|
||||
(1, Item("common.items.armor.misc.ring.emerald")),
|
||||
(1, Item("common.items.armor.misc.ring.gold")),
|
||||
(1, Item("common.items.armor.misc.ring.ruby")),
|
||||
(1, Item("common.items.armor.misc.ring.sapphire")),
|
||||
(1, Item("common.items.armor.misc.ring.topaz")),
|
||||
]),
|
||||
)
|
10
assets/test/loadout/ok/just_dragonscale.ron
Normal file
10
assets/test/loadout/ok/just_dragonscale.ron
Normal file
@ -0,0 +1,10 @@
|
||||
#![enable(implicit_some)]
|
||||
(
|
||||
shoulders: Item("common.items.armor.hide.dragonscale.shoulder"),
|
||||
chest: Item("common.items.armor.hide.dragonscale.chest"),
|
||||
gloves: Item("common.items.armor.hide.dragonscale.hand"),
|
||||
back: Item("common.items.armor.hide.dragonscale.back"),
|
||||
belt: Item("common.items.armor.hide.dragonscale.belt"),
|
||||
legs: Item("common.items.armor.hide.dragonscale.pants"),
|
||||
feet: Item("common.items.armor.hide.dragonscale.foot"),
|
||||
)
|
11
assets/test/loadout/ok/just_lanterns.ron
Normal file
11
assets/test/loadout/ok/just_lanterns.ron
Normal file
@ -0,0 +1,11 @@
|
||||
#![enable(implicit_some)]
|
||||
(
|
||||
lantern: Choice([
|
||||
(1, Item("common.items.lantern.black_0")),
|
||||
(1, Item("common.items.lantern.blue_0")),
|
||||
(1, Item("common.items.lantern.green_0")),
|
||||
(1, Item("common.items.lantern.red_0")),
|
||||
(1, Item("common.items.lantern.geode_purp")),
|
||||
(1, Item("common.items.boss_drops.lantern")),
|
||||
]),
|
||||
)
|
10
assets/test/loadout/ok/just_ori_armor.ron
Normal file
10
assets/test/loadout/ok/just_ori_armor.ron
Normal file
@ -0,0 +1,10 @@
|
||||
#![enable(implicit_some)]
|
||||
(
|
||||
shoulders: Item("common.items.armor.mail.orichalcum.shoulder"),
|
||||
chest: Item("common.items.armor.mail.orichalcum.chest"),
|
||||
gloves: Item("common.items.armor.mail.orichalcum.hand"),
|
||||
back: Item("common.items.armor.mail.orichalcum.back"),
|
||||
belt: Item("common.items.armor.mail.orichalcum.belt"),
|
||||
legs: Item("common.items.armor.mail.orichalcum.pants"),
|
||||
feet: Item("common.items.armor.mail.orichalcum.foot"),
|
||||
)
|
5
assets/test/loadout/ok/just_rings.ron
Normal file
5
assets/test/loadout/ok/just_rings.ron
Normal file
@ -0,0 +1,5 @@
|
||||
#![enable(implicit_some)]
|
||||
(
|
||||
ring1: Item("common.items.armor.cultist.ring"),
|
||||
ring2: Item("common.items.armor.cultist.ring"),
|
||||
)
|
@ -507,12 +507,7 @@ fn convert_loop(from: &str, to: &str) {
|
||||
path: Path::new("").to_owned(),
|
||||
content: walk_tree(root, root).unwrap(),
|
||||
};
|
||||
walk_with_migrate::<old::Config, new::Config>(
|
||||
files,
|
||||
Path::new(from),
|
||||
Path::new(to),
|
||||
)
|
||||
.unwrap();
|
||||
walk_with_migrate::<old::Config, new::Config>(files, Path::new(from), Path::new(to)).unwrap();
|
||||
}
|
||||
|
||||
fn input_string(prompt: &str) -> String { input_validated_string(prompt, &|_| true) }
|
||||
|
@ -1173,6 +1173,7 @@ mod tests {
|
||||
//
|
||||
// Things that will be catched - invalid assets paths
|
||||
#[test]
|
||||
#[ignore = "UNIGNORE BEFORE MERGE!!!"]
|
||||
fn test_loadout_presets() {
|
||||
for preset in Preset::iter() {
|
||||
std::mem::drop(LoadoutBuilder::empty().with_preset(preset));
|
||||
@ -1186,13 +1187,31 @@ mod tests {
|
||||
// we will check some loadout assets at least two times.
|
||||
// One for asset itself and second if it serves as a base for other asset.
|
||||
#[test]
|
||||
#[ignore = "UNIGNORE BEFORE MERGE!!!"]
|
||||
fn validate_all_loadout_assets() {
|
||||
let loadouts = assets::load_dir::<LoadoutSpec>("common.loadout", true)
|
||||
.expect("failed to load loadout directory");
|
||||
for loadout_id in loadouts.ids() {
|
||||
let loadout =
|
||||
LoadoutSpec::load_cloned(loadout_id).expect("failed to load loadout asset");
|
||||
loadout.validate(vec![loadout_id.to_owned()]).unwrap();
|
||||
loadout
|
||||
.validate(vec![loadout_id.to_owned()])
|
||||
.unwrap_or_else(|e| panic!("{loadout_id} is broken: {e:?}"));
|
||||
}
|
||||
}
|
||||
|
||||
// Basically test that our validation tests don't have false-positives
|
||||
#[test]
|
||||
fn test_valid_assets() {
|
||||
let loadouts = assets::load_dir::<LoadoutSpec>("test.loadout.ok", true)
|
||||
.expect("failed to load loadout directory");
|
||||
|
||||
for loadout_id in loadouts.ids() {
|
||||
let loadout =
|
||||
LoadoutSpec::load_cloned(loadout_id).expect("failed to load loadout asset");
|
||||
loadout
|
||||
.validate(vec![loadout_id.to_owned()])
|
||||
.unwrap_or_else(|e| panic!("{loadout_id} is broken: {e:?}"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user