Added pickaxe, asteroid rock and floors (#301)
@@ -43,6 +43,7 @@ namespace Content.Client
|
||||
var registerIgnore = new[]
|
||||
{
|
||||
"Breakable",
|
||||
"Pickaxe",
|
||||
"Interactable",
|
||||
"Destructible",
|
||||
"Temperature",
|
||||
@@ -95,7 +96,8 @@ namespace Content.Client
|
||||
"PowerCell",
|
||||
"AiController",
|
||||
"PlayerInputMover",
|
||||
"Computer"
|
||||
"Computer",
|
||||
"AsteroidRock",
|
||||
};
|
||||
|
||||
foreach (var ignoreName in registerIgnore)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
Resources/Audio/effects/footsteps/asteroid1.ogg
Normal file
BIN
Resources/Audio/effects/footsteps/asteroid2.ogg
Normal file
BIN
Resources/Audio/effects/footsteps/asteroid3.ogg
Normal file
BIN
Resources/Audio/effects/footsteps/asteroid4.ogg
Normal file
BIN
Resources/Audio/effects/footsteps/asteroid5.ogg
Normal file
BIN
Resources/Audio/items/mining/pickaxe.ogg
Normal file
25
Resources/Prototypes/Entities/buildings/asteroid.yml
Normal 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
|
||||
20
Resources/Prototypes/Entities/items/weapons/mining.yml
Normal 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
|
||||
@@ -63,3 +63,12 @@
|
||||
files:
|
||||
- /Audio/effects/footsteps/suitstep1.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
|
||||
@@ -147,3 +147,63 @@
|
||||
footstep_sounds: footstep_floor
|
||||
friction: 0.1
|
||||
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
|
||||
|
||||
BIN
Resources/Textures/Buildings/Walls/asteroid_rock.rsi/0.png
Normal file
|
After Width: | Height: | Size: 947 B |
BIN
Resources/Textures/Buildings/Walls/asteroid_rock.rsi/1.png
Normal file
|
After Width: | Height: | Size: 941 B |
BIN
Resources/Textures/Buildings/Walls/asteroid_rock.rsi/2.png
Normal file
|
After Width: | Height: | Size: 899 B |
BIN
Resources/Textures/Buildings/Walls/asteroid_rock.rsi/3.png
Normal file
|
After Width: | Height: | Size: 941 B |
BIN
Resources/Textures/Buildings/Walls/asteroid_rock.rsi/4.png
Normal file
|
After Width: | Height: | Size: 923 B |
@@ -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]]}]}
|
||||
BIN
Resources/Textures/Objects/items/pickaxe.rsi/inhand-left.png
Normal file
|
After Width: | Height: | Size: 378 B |
BIN
Resources/Textures/Objects/items/pickaxe.rsi/inhand-right.png
Normal file
|
After Width: | Height: | Size: 375 B |
1
Resources/Textures/Objects/items/pickaxe.rsi/meta.json
Normal 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]]}]}
|
||||
BIN
Resources/Textures/Objects/items/pickaxe.rsi/pickaxe.png
Normal file
|
After Width: | Height: | Size: 285 B |
BIN
Resources/Textures/Tiles/asteroid_coarse_sand0.png
Normal file
|
After Width: | Height: | Size: 221 B |
BIN
Resources/Textures/Tiles/asteroid_coarse_sand1.png
Normal file
|
After Width: | Height: | Size: 229 B |
BIN
Resources/Textures/Tiles/asteroid_coarse_sand2.png
Normal file
|
After Width: | Height: | Size: 228 B |
BIN
Resources/Textures/Tiles/asteroid_coarse_sand_dug.png
Normal file
|
After Width: | Height: | Size: 267 B |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |