Added pickaxe, asteroid rock and floors (#301)

This commit is contained in:
DamianX
2019-08-21 22:50:15 +02:00
committed by Pieter-Jan Briers
parent 4175f891fb
commit f0053f15bf
30 changed files with 190 additions and 4 deletions

View File

@@ -43,6 +43,7 @@ namespace Content.Client
var registerIgnore = new[] var registerIgnore = new[]
{ {
"Breakable", "Breakable",
"Pickaxe",
"Interactable", "Interactable",
"Destructible", "Destructible",
"Temperature", "Temperature",
@@ -95,7 +96,8 @@ namespace Content.Client
"PowerCell", "PowerCell",
"AiController", "AiController",
"PlayerInputMover", "PlayerInputMover",
"Computer" "Computer",
"AsteroidRock",
}; };
foreach (var ignoreName in registerIgnore) foreach (var ignoreName in registerIgnore)

View File

@@ -0,0 +1,46 @@
using System;
using System.Runtime.InteropServices;
using Content.Server.GameObjects.Components.Sound;
using Content.Server.GameObjects.Components.Weapon.Melee;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.GameObjects;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components.Renderable;
using Robust.Shared.Maths;
using Robust.Shared.Utility;
namespace Content.Server.GameObjects.Components.Mining
{
[RegisterComponent]
public class AsteroidRockComponent : Component, IAttackBy
{
public override string Name => "AsteroidRock";
private static readonly string[] SpriteStates = {"0", "1", "2", "3", "4"};
public override void Initialize()
{
base.Initialize();
var spriteComponent = Owner.GetComponent<SpriteComponent>();
var random = new Random(Owner.Uid.GetHashCode() ^ DateTime.Now.GetHashCode());
spriteComponent.LayerSetState(0, random.Pick(SpriteStates));
}
bool IAttackBy.AttackBy(AttackByEventArgs eventArgs)
{
var item = eventArgs.AttackWith;
if (!item.TryGetComponent(out MeleeWeaponComponent meleeWeaponComponent)) return false;
Owner.GetComponent<DamageableComponent>().TakeDamage(DamageType.Brute, meleeWeaponComponent.Damage);
if (!item.TryGetComponent(out PickaxeComponent pickaxeComponent)) return true;
if (!string.IsNullOrWhiteSpace(pickaxeComponent.MiningSound) &&
item.TryGetComponent<SoundComponent>(out var soundComponent))
{
soundComponent.Play(pickaxeComponent.MiningSound, AudioParams.Default);
}
return true;
}
}
}

View File

@@ -0,0 +1,22 @@
using System;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
namespace Content.Server.GameObjects.Components.Mining
{
[RegisterComponent]
public class PickaxeComponent : Component
{
public override string Name => "Pickaxe";
public string MiningSound;
public float MiningSpeedMultiplier;
public override void ExposeData(ObjectSerializer serializer)
{
base.ExposeData(serializer);
serializer.DataField(ref MiningSound, "miningSound", "/Audio/items/mining/pickaxe.ogg");
serializer.DataField(ref MiningSpeedMultiplier, "miningSpeedMultiplier", 1f);
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,25 @@
- type: entity
id: asteroid_rock
name: Asteroid Rock
components:
- type: AsteroidRock
- type: Clickable
- type: Sprite
sprite: Buildings/Walls/asteroid_rock.rsi
state: 0
- type: Icon
sprite: Buildings/Walls/asteroid_rock.rsi
state: 0
- type: BoundingBox
- type: Collidable
- type: Damageable
- type: Destructible
thresholdvalue: 100
- type: Occluder
sizeX: 32
sizeY: 32
- type: SnapGrid
offset: Center
placement:
snap:
- Wall

View File

@@ -0,0 +1,20 @@
- type: entity
name: Pickaxe
parent: BaseItem
id: Pickaxe
components:
- type: Sprite
sprite: Objects/items/pickaxe.rsi
state: pickaxe
- type: Icon
sprite: Objects/items/pickaxe.rsi
state: pickaxe
- type: Pickaxe
- type: MeleeWeapon
damage: 25
- type: Item
Size: 24
sprite: Objects/items/pickaxe.rsi
prefix: inhand
- type: Sound

View File

@@ -63,3 +63,12 @@
files: files:
- /Audio/effects/footsteps/suitstep1.ogg - /Audio/effects/footsteps/suitstep1.ogg
- /Audio/effects/footsteps/suitstep2.ogg - /Audio/effects/footsteps/suitstep2.ogg
- type: sound_collection
id: footstep_asteroid
files:
- /Audio/effects/footsteps/asteroid1.ogg
- /Audio/effects/footsteps/asteroid2.ogg
- /Audio/effects/footsteps/asteroid3.ogg
- /Audio/effects/footsteps/asteroid4.ogg
- /Audio/effects/footsteps/asteroid5.ogg

View File

@@ -147,3 +147,63 @@
footstep_sounds: footstep_floor footstep_sounds: footstep_floor
friction: 0.1 friction: 0.1
subfloor: underplating subfloor: underplating
- type: tile
name: floor_asteroid_sand
display_name: Asteroid Floor
texture: asteroid_sand
is_subfloor: false
can_crowbar: false
footstep_sounds: footstep_asteroid
friction: 0.35
subfloor: space
- type: tile
name: floor_asteroid_tile
display_name: Asteroid Tile
texture: asteroid_tile
is_subfloor: false
can_crowbar: false
footstep_sounds: footstep_asteroid
friction: 0.35
subfloor: space
- type: tile
name: floor_asteroid_coarse_sand0
display_name: Asteroid Coarse Sand 0
texture: asteroid_coarse_sand0
is_subfloor: false
can_crowbar: false
footstep_sounds: footstep_asteroid
friction: 0.35
subfloor: space
- type: tile
name: floor_asteroid_coarse_sand1
display_name: Asteroid Coarse Sand 1
texture: asteroid_coarse_sand1
is_subfloor: false
can_crowbar: false
footstep_sounds: footstep_asteroid
friction: 0.35
subfloor: space
- type: tile
name: floor_asteroid_coarse_sand2
display_name: Asteroid Coarse Sand 2
texture: asteroid_coarse_sand2
is_subfloor: false
can_crowbar: false
footstep_sounds: footstep_asteroid
friction: 0.35
subfloor: space
- type: tile
name: floor_asteroid_coarse_sand_dug
display_name: Asteroid Dug Coarse Sand
texture: asteroid_coarse_sand_dug
is_subfloor: false
can_crowbar: false
footstep_sounds: footstep_asteroid
friction: 0.35
subfloor: space

Binary file not shown.

After

Width:  |  Height:  |  Size: 947 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 941 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 899 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 941 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 923 B

View File

@@ -0,0 +1 @@
{"version": 1, "size": {"x": 32, "y": 32}, "states": [{"name": "0", "directions": 1, "delays": [[1.0]]}, {"name": "1", "directions": 1, "delays": [[1.0]]}, {"name": "2", "directions": 1, "delays": [[1.0]]}, {"name": "3", "directions": 1, "delays": [[1.0]]}, {"name": "4", "directions": 1, "delays": [[1.0]]}]}

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 375 B

View File

@@ -0,0 +1 @@
{"version": 1, "size": {"x": 32, "y": 32}, "states": [{"name": "inhand-left", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}, {"name": "inhand-right", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}, {"name": "pickaxe", "directions": 1, "delays": [[1.0]]}]}

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 B

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB