Skip to content

Commit

Permalink
make meteors duds on glacier (#1872)
Browse files Browse the repository at this point in the history
* make meteors duds on glacier

* remove unused explosive from copy paste

---------

Co-authored-by: deltanedas <@deltanedas:kde.org>
  • Loading branch information
deltanedas authored Sep 20, 2024
1 parent 4923bfc commit 55e6e3b
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 1 deletion.
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

0 comments on commit 55e6e3b

Please sign in to comment.