Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make meteors duds on glacier #1872

Merged
merged 2 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Numerics;
using Content.Server.Atmos.Components;
using Content.Server.GameTicking.Rules.Components;
using Content.Server.StationEvents.Components;
using Content.Shared.GameTicking.Components;
Expand All @@ -12,6 +13,7 @@ namespace Content.Server.StationEvents.Events
{
public sealed class MeteorSwarmRule : StationEventSystem<MeteorSwarmRuleComponent>
{
[Dependency] private readonly SharedMapSystem _map = default!;
[Dependency] private readonly SharedPhysicsSystem _physics = default!;

protected override void Started(EntityUid uid, MeteorSwarmRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args)
Expand Down Expand Up @@ -40,6 +42,10 @@ protected override void ActiveTick(EntityUid uid, MeteorSwarmRuleComponent compo

Box2? playableArea = null;
var mapId = GameTicker.DefaultMap;
// use a dud meteor if there's an atmosphere to "simulate" burning up
var proto = "MeteorLargeDeltaV";
if (_map.TryGetMap(mapId, out var mapUid) && TryComp<MapAtmosphereComponent>(mapUid, out var atmos) && !atmos.Space)
proto = "MeteorGlacierDeltaV";

var query = AllEntityQuery<MapGridComponent, TransformComponent>();
while (query.MoveNext(out var gridId, out _, out var xform))
Expand Down Expand Up @@ -67,7 +73,7 @@ protected override void ActiveTick(EntityUid uid, MeteorSwarmRuleComponent compo
var angle = new Angle(RobustRandom.NextFloat() * MathF.Tau);
var offset = angle.RotateVec(new Vector2((maximumDistance - minimumDistance) * RobustRandom.NextFloat() + minimumDistance, 0));
var spawnPosition = new MapCoordinates(center + offset, mapId);
var meteor = Spawn("MeteorLargeDeltaV", spawnPosition);
var meteor = Spawn(proto, spawnPosition);
var physics = EntityManager.GetComponent<PhysicsComponent>(meteor);
_physics.SetBodyStatus(meteor, physics, BodyStatus.InAir);
_physics.SetLinearDamping(meteor, physics, 0f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,56 @@
mask:
- Impassable
- BulletImpassable

# this gets spawned by the meteor swarm rule if the target map has an atmosphere
# since meteors dont make much sense
- type: entity
categories: [ HideSpawnMenu ]
id: MeteorGlacierDeltaV
name: meteor
description: This meteor is burning up like a in the atmosphere, like a... meteor.
components:
- type: Sprite
noRot: false
sprite: Objects/Weapons/Guns/Projectiles/meteor.rsi
scale: 0.5,0.5
layers:
- state: large
shader: unshaded
- type: PointLight
radius: 3
energy: 5
color: "#ff6622"
- type: AmbientSound
enabled: true
volume: 2
range: 14
sound:
path: /Audio/Items/Flare/flare_burn.ogg
params:
loop: true
- type: IgnitionSource
ignited: true
temperature: 500
- type: DeleteOnTrigger
- type: TriggerOnCollide
fixtureID: projectile
- type: Projectile
damage: {}
deleteOnCollide: false
- type: Physics
bodyType: Dynamic
- type: Fixtures
fixtures:
projectile:
shape:
!type:PhysShapeCircle
radius: 0.8
density: 100
hard: true
# Didn't use MapGridComponent for now as the bounds are stuffed.
layer:
- LargeMobLayer
mask:
- Impassable
- BulletImpassable
Loading