Aetheria/Assets/Scripts/ServerShared/OrbitalEntity.cs
Reinier Vens 2f98904614 Hostility Fix + Story Work
Fixed various bugs caused by triggering wormhole animation multiple times
Sector -> Galaxy
Fixed bug in hostility system; deserialized entities' PresencePermitted was silently throwing an exception (due to Faction being null during initialization) and thus never updating in response to security level changes
Worked a bit on story processing
2021-05-14 03:03:28 +01:00

43 lines
1.2 KiB
C#

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
using System;
using System.Collections;
using System.Collections.Generic;
using Unity.Mathematics;
using static Unity.Mathematics.math;
using float2 = Unity.Mathematics.float2;
public class OrbitalEntity : Entity
{
public Guid OrbitData;
public SecurityLevel SecurityLevel;
public float SecurityRadius;
public OrbitalEntity(ItemManager itemManager, Zone zone, EquippableItem hull, Guid orbit, EntitySettings settings) : base(itemManager, zone, hull, settings)
{
OrbitData = orbit;
}
public override void Update(float delta)
{
if (OrbitData != Guid.Empty)
{
Position.xz = Zone.GetOrbitPosition(OrbitData);
Velocity = Zone.GetOrbitVelocity(OrbitData);
}
base.Update(delta);
}
public bool IsSecureArea
{
get
{
if (SecurityRadius < 1) return false;
if (Faction == null) return false;
return !IsPresencePermitted(Zone.Galaxy.FactionRelationships[Faction], SecurityLevel);
}
}
}