Initial turret implementation

This commit is contained in:
Snowram 2021-01-18 22:15:18 +01:00
parent 3cb6a5592d
commit 775224983b
12 changed files with 1641 additions and 7 deletions

View File

@ -0,0 +1,15 @@
BasicRanged(
energy_cost: 0,
buildup_duration: 500,
recover_duration: 300,
projectile: Arrow(
damage: 200.0,
knockback: 5.0,
energy_regen: 100,
),
projectile_body: Object(ArrowTurret),
projectile_light: None,
projectile_gravity: Some(Gravity(0.1)),
projectile_speed: 100.0,
can_continue: true,
)

View File

@ -132,6 +132,11 @@
secondary: "common.abilities.unique.theropodbird.triplestrike",
abilities: [],
),
Unique(Turret): (
primary: "common.abilities.unique.turret.basic",
secondary: "common.abilities.unique.turret.basic",
skills: [],
),
Debug: (
primary: "common.abilities.debug.forwardboost",
secondary: "common.abilities.debug.upboost",

View File

@ -0,0 +1,15 @@
ItemDef(
name: "Turret",
description: "Turret weapon",
kind: Tool(
(
kind: Unique(Turret),
stats: (
equip_time_millis: 10,
power: 1.00,
speed: 1.00,
),
)
),
quality: Low,
)

BIN
assets/voxygen/voxel/object/crossbow.vox (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -377,4 +377,16 @@
central: ("object.steak"),
)
),
Crossbow: (
bone0: (
offset: (-18.0, -15.5, 0.0),
central: ("object.crossbow"),
)
),
ArrowTurret: (
bone0: (
offset: (-1.5, -6.5, -1.5),
central: ("weapon.projectile.turret-arrow"),
)
),
})

BIN
assets/voxygen/voxel/weapon/projectile/turret-arrow.vox (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -70,6 +70,8 @@ make_case_elim!(
BoltNature = 60,
MeatDrop = 61,
Steak = 62,
Crossbow = 63,
ArrowTurret = 64,
}
);
@ -80,7 +82,7 @@ impl Body {
}
}
pub const ALL_OBJECTS: [Body; 63] = [
pub const ALL_OBJECTS: [Body; 65] = [
Body::Arrow,
Body::Bomb,
Body::Scarecrow,
@ -144,6 +146,8 @@ pub const ALL_OBJECTS: [Body; 63] = [
Body::BoltNature,
Body::MeatDrop,
Body::Steak,
Body::Crossbow,
Body::ArrowTurret,
];
impl From<Body> for super::Body {
@ -216,6 +220,8 @@ impl Body {
Body::BoltNature => "bolt_nature",
Body::MeatDrop => "meat_drop",
Body::Steak => "steak",
Body::Crossbow => "crossbow",
Body::ArrowTurret => "arrow_turret",
}
}
}

View File

@ -295,4 +295,5 @@ pub enum UniqueKind {
QuadSmallBasic,
TheropodBasic,
TheropodBird,
Turret,
}

View File

@ -5,7 +5,7 @@ use crate::comp::{
slot::{ArmorSlot, EquipSlot},
},
item::{Item, ItemKind},
quadruped_low, quadruped_medium, theropod, Body,
object, quadruped_low, quadruped_medium, theropod, Body,
};
use rand::Rng;
@ -227,6 +227,14 @@ impl LoadoutBuilder {
));
},
},
Body::Object(object) => match object {
object::Body::Crossbow => {
main_tool = Some(Item::new_from_asset_expect(
"common.items.npc_weapons.unique.turret",
));
},
_ => {},
},
_ => {},
};
}

View File

@ -66,7 +66,7 @@ impl Body {
Body::BirdSmall(_) => 75.0,
Body::FishSmall(_) => 60.0,
Body::BipedLarge(_) => 75.0,
Body::Object(_) => 40.0,
Body::Object(_) => 0.0,
Body::Golem(_) => 60.0,
Body::Theropod(_) => 135.0,
Body::QuadrupedLow(quadruped_low) => match quadruped_low.species {
@ -116,7 +116,7 @@ impl Body {
Body::BirdSmall(_) => 35.0,
Body::FishSmall(_) => 10.0,
Body::BipedLarge(_) => 12.0,
Body::Object(_) => 5.0,
Body::Object(_) => 0.0,
Body::Golem(_) => 8.0,
Body::Theropod(theropod) => match theropod.species {
theropod::Species::Archaeos => 2.5,

1566
common/sys/src/agent.rs Normal file

File diff suppressed because it is too large Load Diff

View File

@ -884,7 +884,7 @@ impl Settlement {
.with_body(match dynamic_rng.gen_range(0..5) {
_ if is_dummy => {
is_human = false;
object::Body::TrainingDummy.into()
object::Body::Crossbow.into()
},
0 => {
let species = match dynamic_rng.gen_range(0..3) {
@ -916,9 +916,9 @@ impl Settlement {
comp::Body::Humanoid(humanoid::Body::random())
},
})
.with_agency(!is_dummy)
.with_agency(true) // TEMPORARY
.with_alignment(if is_dummy {
comp::Alignment::Passive
comp::Alignment::Enemy // TEMPORARY
} else if is_human {
comp::Alignment::Npc
} else {