Skip to content

Commit

Permalink
Add hovertaxibot (#1852)
Browse files Browse the repository at this point in the history
  • Loading branch information
whatston3 authored Aug 12, 2024
1 parent 5b74a8c commit 8102c6b
Show file tree
Hide file tree
Showing 13 changed files with 217 additions and 5 deletions.
36 changes: 34 additions & 2 deletions Content.Shared/Vehicle/SharedVehicleSystem.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System.Numerics;
using Content.Shared._NF.Vehicle.Components;
using Content.Shared.Access.Components;
using Content.Shared.Actions;
using Content.Shared.Audio;
using Content.Shared.Buckle;
using Content.Shared.Buckle.Components;
using Content.Shared.Hands;
using Content.Shared.Inventory.VirtualItem;
using Content.Shared.Item;
using Content.Shared.Light.Components;
Expand All @@ -13,7 +13,6 @@
using Content.Shared.Popups;
using Content.Shared.Tag;
using Content.Shared.Vehicle.Components;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Containers;
using Robust.Shared.Network;
Expand Down Expand Up @@ -64,6 +63,10 @@ public override void Initialize()
SubscribeLocalEvent<VehicleComponent, GetAdditionalAccessEvent>(OnGetAdditionalAccess);

SubscribeLocalEvent<InVehicleComponent, GettingPickedUpAttemptEvent>(OnGettingPickedUpAttempt);

SubscribeLocalEvent<VehicleHornComponent, ComponentInit>(OnVehicleHornInit);
SubscribeLocalEvent<VehicleHornComponent, ComponentShutdown>(OnVehicleHornShutdown);
SubscribeLocalEvent<VehicleHornComponent, HonkActionEvent>(OnHornHonkAction); // Frontier: for vehicles with innate horns (e.g. taxibot)
}

/// <summary>
Expand Down Expand Up @@ -352,6 +355,35 @@ private void UpdateAutoAnimate(EntityUid uid, bool autoAnimate)
{
Appearance.SetData(uid, VehicleVisuals.AutoAnimate, autoAnimate);
}

/// Horn-only functions
private void OnVehicleHornShutdown(EntityUid uid, VehicleHornComponent component, ComponentShutdown args)
{
// Perf: If the entity is deleting itself, no reason to change these back.
if (Terminating(uid))
return;

_actionsSystem.RemoveAction(uid, component.ActionEntity);
}

private void OnVehicleHornInit(EntityUid uid, VehicleHornComponent component, ComponentInit args)
{
_actionsSystem.AddAction(uid, ref component.ActionEntity, out var _, component.Action);
}

/// <summary>
/// This fires when the vehicle entity presses the honk action
/// </summary>
private void OnHornHonkAction(EntityUid uid, VehicleHornComponent vehicle, HonkActionEvent args)
{
if (args.Handled || vehicle.HornSound == null)
return;

// TODO: Need audio refactor maybe, just some way to null it when the stream is over.
// For now better to just not loop to keep the code much cleaner.
vehicle.HonkPlayingStream = _audioSystem.PlayPredicted(vehicle.HornSound, uid, args.Performer)?.Entity;
args.Handled = true;
}
}

/// <summary>
Expand Down
37 changes: 37 additions & 0 deletions Content.Shared/_NF/Vehicle/Components/VehicleHornComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Content.Shared.Vehicle;

namespace Content.Shared._NF.Vehicle.Components;

/// <summary>
///
/// </summary>
[RegisterComponent, NetworkedComponent]
[Access(typeof(SharedVehicleSystem))]
public sealed partial class VehicleHornComponent : Component
{
/// <summary>
/// The sound that the horn makes
/// </summary>
[DataField]
[ViewVariables(VVAccess.ReadWrite)]
public SoundSpecifier? HornSound = new SoundPathSpecifier("/Audio/Effects/Vehicle/carhorn.ogg")
{
Params = AudioParams.Default.WithVolume(-3f)
};

[ViewVariables]
public EntityUid? HonkPlayingStream;

[DataField]
public EntProtoId? Action = "ActionVehicleHorn";

/// <summary>
/// The action for the horn (if any)
/// </summary>
[DataField]
[ViewVariables(VVAccess.ReadWrite)]
public EntityUid? ActionEntity;
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@ ghost-role-information-mistake-description = Ymg' ph'nglui ah li.
ghost-role-information-ert-mailcarrier-name = ERT Mail Carrier
ghost-role-information-ert-mailcarrier-description = Assist with delivery efforts to resolve the station's issues.
ghost-role-information-jerma-name = Jerma
ghost-role-information-jerma-description = Pog moment
ghost-role-information-baby-dragon-name = Baby space dragon
ghost-role-information-baby-dragon-description = Hatch from your egg and go on incredible adventures with your mom and their crew!
ghost-role-information-baby-dragon-rules = You are a [color=#6495ed][bold]Familiar[/bold][/color]. Serve the interests of your new mom, whatever those may be.
You don't remember any of your previous life, and you don't remember anything you learned as a ghost.
You are allowed to remember knowledge about the game in general, such as how to cook, how to use objects, etc.
You are absolutely [color=red]NOT[/color] allowed to remember, say, the name, appearance, etc. of your previous character.
ghost-role-information-taxibot-name = Taxibot
ghost-role-information-taxibot-description = Drive passengers to where they need to go.
ghost-role-information-hovertaxibot-name = Hovertaxibot
ghost-role-information-hovertaxibot-description = Fly passengers to where they need to go, remember to check they can breathe!
6 changes: 6 additions & 0 deletions Resources/Prototypes/Entities/Mobs/NPCs/silicon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
- Robotics
- type: Speech
speechVerb: Robotic
speechSounds: Pai # Frontier: give robots beepy speech sounds
- type: TypingIndicator
proto: robot
- type: ZombieImmune
Expand Down Expand Up @@ -141,12 +142,15 @@
- type: GhostRole
name: ghost-role-information-taxibot-name
description: ghost-role-information-taxibot-description
rules: ghost-role-information-nonantagonist-rules # Frontier?
- type: Strap
buckleOffset: "0, 0"
unbuckleDistanceSquared: 0.09 # Frontier: (30 cm)^2 - seems unnecessary, but for consistency with vehicles
# maxBuckleDistance: 1 # Umbra - buckling fix
- type: Construction
graph: TaxiBot
node: bot
- type: VehicleHorn # Frontier: beep beep

- type: entity
parent: MobSiliconBase
Expand Down Expand Up @@ -365,6 +369,8 @@
interactFailureString: petting-failure-mimebot
- type: Inventory
templateId: head
- type: Speech # Frontier: robots have beepy speech sounds, but not the mimebot
speechSounds: null # Frontier: robots have beepy speech sounds, but not the mimebot

- type: entity
parent: MobSiliconBase
Expand Down
44 changes: 44 additions & 0 deletions Resources/Prototypes/_NF/Entities/Mobs/NPCs/silicon.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
- type: entity
parent: MobSiliconBaseVehicle
id: MobHoverTaxiBot
name: hovertaxibot
description: Give a ride? IN SPAAAAACE!
components:
- type: Sprite
sprite: _NF/Mobs/Silicons/Bots/hovertaxibot.rsi
layers:
- state: hull
- state: engines
map: ["enum.VehicleVisualLayers.AutoAnimate"]
shader: unshaded
- state: unshaded
shader: unshaded
- type: GhostRole
name: ghost-role-information-hovertaxibot-name
description: ghost-role-information-hovertaxibot-description
rules: ghost-role-information-nonantagonist-rules
- type: MovementIgnoreGravity
- type: MovementAlwaysTouching
- type: CanMoveInAir
- type: Strap
buckleOffset: "0, 0"
unbuckleDistanceSquared: 0.09 # (30 cm)^2 - seems unnecessary, but for consistency with vehicles
- type: MovementSpeedModifier # Matches a hoverbike
acceleration: 2
friction: 1.5
baseWalkSpeed: 4.5
baseSprintSpeed: 7
- type: Construction
graph: HoverTaxiBot
node: bot
- type: UserInterface
interfaces:
enum.RadarConsoleUiKey.Key:
type: RadarConsoleBoundUserInterface
- type: IntrinsicUI
uis:
enum.RadarConsoleUiKey.Key:
toggleAction: ActionObserverShowRadar
- type: RadarConsole
followEntity: true
- type: VehicleHorn
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@
Steel: 5
- type: StaticPrice
price: 12.5
- type: Tag # Frontier
tags: # Frontier
- SmallThrusterMachineCircuitboard # Frontier

# Gyroscope
- type: entity
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
- type: constructionGraph
id: HoverTaxiBot
start: start
graph:
- node: start
edges:
- to: bot
steps:
- tag: ProximitySensor
icon:
sprite: Objects/Misc/proximity_sensor.rsi
state: icon
name: proximity sensor
- tag: BorgHead
icon:
sprite: Objects/Specific/Robotics/cyborg_parts.rsi
state: borg_head
name: borg head
doAfter: 1
- tag: BorgArm
icon:
sprite: Mobs/Silicon/drone.rsi
state: l_hand
name: borg arm
doAfter: 2
- tag: SmallThrusterMachineCircuitboard
icon:
sprite: Objects/Misc/module.rsi
state: generic
name: small thruster machine board
doAfter: 2
- material: Steel
amount: 10
- node: bot
entity: MobHoverTaxiBot
12 changes: 12 additions & 0 deletions Resources/Prototypes/_NF/Recipes/Crafting/bots.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
- type: construction
name: hovertaxibot
id: hovertaxibot
graph: HoverTaxiBot
startNode: start
targetNode: bot
category: construction-category-utilities
objectType: Item
description: This spacefaring bot takes people to their destination.
icon:
sprite: _NF/Mobs/Silicons/Bots/hovertaxibot.rsi
state: hull
3 changes: 3 additions & 0 deletions Resources/Prototypes/_NF/tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,6 @@

- type: Tag
id: ClothingRobesGoblin

- type: Tag
id: SmallThrusterMachineCircuitboard
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"version": 1,
"size": {
"x": 32,
"y": 32
},
"license": "CC-BY-SA-3.0",
"copyright": "hull drawn by FillerVK, modified by Diebeck, modified by Whatstone (Discord), unshaded and engines by Whatstone (Discord)",
"states": [
{
"name": "engines",
"directions": 4,
"delays": [
[
0.2, 0.2, 0.2, 0.2
],
[
0.2, 0.2, 0.2, 0.2
],
[
0.2, 0.2, 0.2, 0.2
],
[
0.2, 0.2, 0.2, 0.2
]
]
},
{
"name": "hull",
"directions": 4
},
{
"name": "unshaded",
"directions": 4
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8102c6b

Please sign in to comment.