diff --git a/ThermalDynamics/Data/Extinguisher/AmmoMagazines.sbc b/ThermalDynamics/Data/Extinguisher/AmmoMagazines.sbc
index 36c1e2d..d8e7ee1 100644
--- a/ThermalDynamics/Data/Extinguisher/AmmoMagazines.sbc
+++ b/ThermalDynamics/Data/Extinguisher/AmmoMagazines.sbc
@@ -18,7 +18,7 @@
30
Models\Bottle.mwm
Ammo
- 1
+ 1000
50
diff --git a/ThermalDynamics/Data/Extinguisher/Ammos.sbc b/ThermalDynamics/Data/Extinguisher/Ammos.sbc
index 96e5561..1a1afd7 100644
--- a/ThermalDynamics/Data/Extinguisher/Ammos.sbc
+++ b/ThermalDynamics/Data/Extinguisher/Ammos.sbc
@@ -2,34 +2,30 @@
-
-
+
AmmoDefinition
Bottle
- 200
+ 1
0
- 800
- true
+ 0
0
- Missile
+ RifleBullet
0
- CauseOfDeath_HeavyWeapons
+ CauseOfDeath_LightWeapons
-
- 1
- 4
- Models\Weapons\Projectile_Missile.mwm
- 600
- 100
- false
- 0
- Smoke_Missile
-
- AFFECT_VOXELS APPLY_FORCE_AND_DAMAGE CREATE_DECALS CREATE_SHRAPNELS APPLY_DEFORMATION FORCE_CUSTOM_END_OF_LIFE_EFFECT
+
+ 0
+ 0
+ 0
+ 0
+ false
+ 0
+
+
diff --git a/ThermalDynamics/Data/Extinguisher/Extinguisher.sbc b/ThermalDynamics/Data/Extinguisher/Extinguisher.sbc
new file mode 100644
index 0000000..cab0bde
--- /dev/null
+++ b/ThermalDynamics/Data/Extinguisher/Extinguisher.sbc
@@ -0,0 +1,24 @@
+
+
+
+
+
+ CubeBlock
+ Extinguisher
+
+ {LOC:DisplayName_Extinguisher}
+ {LOC:Description_Extinguisher}
+ Textures\GUI\Icons\AstronautBackpack.dds
+ Large
+ TriangleMesh
+
+
+ Models\Extinguisher.mwm
+
+
+
+
+ Extinguisher
+
+
+
\ No newline at end of file
diff --git a/ThermalDynamics/Data/Extinguisher/HandItems.sbc b/ThermalDynamics/Data/Extinguisher/HandItems.sbc
index 39d8d20..289c57a 100644
--- a/ThermalDynamics/Data/Extinguisher/HandItems.sbc
+++ b/ThermalDynamics/Data/Extinguisher/HandItems.sbc
@@ -4,7 +4,7 @@
- RocketLauncher
+ Rifle
0.324681967
diff --git a/ThermalDynamics/Data/Extinguisher/Weapons.sbc b/ThermalDynamics/Data/Extinguisher/Weapons.sbc
index bc43f89..bcb8349 100644
--- a/ThermalDynamics/Data/Extinguisher/Weapons.sbc
+++ b/ThermalDynamics/Data/Extinguisher/Weapons.sbc
@@ -1,49 +1,29 @@
-
WeaponDefinition
ExtinguisherGun
-
- WepRocketLaunchNoAmmo
- WepRocketLaunchReload
- 3
- 1
+
+ WepPlayRifleNoAmmo
+ WepRifleReloadShort
+ 0
+ 0
+ 0
+ 0
+
+
- 4000
- 0
- 0
- 0
- 0
-
- Standing
- Walking
- Running
- Crouching
- Aiming
-
-
- 1
- 1
- 1.5
- .75
- .75
-
-
- 1
- 1
- 1.5
- .75
- .75
-
- 200
- 0.5
- true
+
+ 2000
+
+ 0
+ 1
+ false
false
false
diff --git a/ThermalDynamics/Data/Scripts/Thermodynamics/Session.cs b/ThermalDynamics/Data/Scripts/Thermodynamics/Session.cs
index 034aeab..de43fa8 100644
--- a/ThermalDynamics/Data/Scripts/Thermodynamics/Session.cs
+++ b/ThermalDynamics/Data/Scripts/Thermodynamics/Session.cs
@@ -49,7 +49,7 @@ public override void Simulate()
{
if (MyAPIGateway.Utilities.IsDedicated) return;
- if (Settings.Instance.Debug)
+ if (Settings.Instance.DebugTextOnScreen)
{
//MyAPIGateway.Utilities.ShowNotification($"[Grid] Frequency: {Settings.Instance.Frequency}", 1, "White");
MatrixD matrix = MyAPIGateway.Session.Camera.WorldMatrix;
@@ -75,7 +75,7 @@ public override void Simulate()
return;
MyAPIGateway.Utilities.ShowNotification(
- //$"[Cell] {c.Block.Position} " +
+ $"[Cell] {c.Block.Position} " +
$"T: {c.Temperature.ToString("n3")} " +
$"Gain: {(c.DeltaTemperature + c.HeatGeneration).ToString("n3")} " +
$"dT: {c.DeltaTemperature.ToString("n3")} " +
@@ -95,11 +95,11 @@ public override void Simulate()
$"prod: {c.EnergyProduction} " +
$"cons: {(c.EnergyConsumption + c.ThrustEnergyConsumption)} ", 1, "White");
- MyAPIGateway.Utilities.ShowNotification($"[Solar] {g.FrameAmbientTemprature.ToString("n3")}", 1, "White");
+ MyAPIGateway.Utilities.ShowNotification($"[Solar] Intensity: {c.IntensityDebug.ToString("n4")} Direction: {g.FrameSolarDirection.ToString("n3")}", 1, "White");
+
+ MyAPIGateway.Utilities.ShowNotification($"[Env] Ambiant: {g.FrameAmbientTemprature.ToString("n3")}", 1, "White");
- MyAPIGateway.Utilities.ShowNotification($"[Grid] {g.DebugSurfaceStateText(g.Surfaces[position])} ", 1, "White");
-
- MyAPIGateway.Utilities.ShowNotification($"[Grid] {string.Join(" ", c.TouchingSerfacesByNeighbor)}", 1, "White");
+ MyAPIGateway.Utilities.ShowNotification($"[Surface] {g.DebugSurfaceStateText(g.Surfaces[position])} ", 1, "White");
StringBuilder sb = new StringBuilder();
foreach (var loop in g.ThermalLoops)
diff --git a/ThermalDynamics/Data/Scripts/Thermodynamics/Settings.cs b/ThermalDynamics/Data/Scripts/Thermodynamics/Settings.cs
index 49442c8..862841b 100644
--- a/ThermalDynamics/Data/Scripts/Thermodynamics/Settings.cs
+++ b/ThermalDynamics/Data/Scripts/Thermodynamics/Settings.cs
@@ -28,10 +28,16 @@ public class Settings
public int Version;
[ProtoMember(2)]
- public bool Debug;
+ public bool DebugTextOnScreen;
[ProtoMember(3)]
- public bool DebugBlockColors;
+ public bool DebugTemperatureBlockColors;
+
+ [ProtoMember(4)]
+ public bool DebugSolarRadiationBlockColors;
+
+ [ProtoMember(5)]
+ public bool DebugSolarRaycast;
[ProtoMember(8)]
public bool EnableEnvironment;
@@ -88,13 +94,15 @@ public static Settings GetDefaults()
{
Settings s = new Settings {
Version = 1,
- Debug = true,
- DebugBlockColors = true,
+ DebugTextOnScreen = true,
+ DebugTemperatureBlockColors = true,
+ DebugSolarRadiationBlockColors = false,
+ DebugSolarRaycast = false,
EnableEnvironment = true,
EnableSolarHeat = true,
EnablePlanets = true,
EnableDamage = true,
- Frequency = 60,
+ Frequency = 3,
SimulationSpeed = 1,
VacuumTemperature = 2.7f,
SolarEnergy = 1000f,
diff --git a/ThermalDynamics/Data/Scripts/Thermodynamics/ThermalCell.cs b/ThermalDynamics/Data/Scripts/Thermodynamics/ThermalCell.cs
index 894c278..af68807 100644
--- a/ThermalDynamics/Data/Scripts/Thermodynamics/ThermalCell.cs
+++ b/ThermalDynamics/Data/Scripts/Thermodynamics/ThermalCell.cs
@@ -37,6 +37,10 @@ public class ThermalCell
public float Boltzmann;
public float[] kA;
+
+ public float IntensityDebug;
+
+
public ThermalGrid Grid;
public IMySlimBlock Block;
public ThermalCellDefinition Definition;
@@ -450,12 +454,8 @@ internal void Update()
HeatGeneration = ((EnergyProduction * Definition.ProducerWasteEnergy) + ((EnergyConsumption + ThrustEnergyConsumption) * Definition.ConsumerWasteEnergy)) * ThermalMassInv;
Temperature += HeatGeneration;
-
- //TODO: this is only used for debug and can be removed later on
- //Radiation = C * totalRadiation * ThermalMassInv;
-
HandleCriticalTemperature();
- DebugDrawColors();
+ DebugDrawColorsTemperature();
}
private float CalculateTotalRadiation()
@@ -472,6 +472,8 @@ private float CalculateTotalRadiation()
if (Settings.Instance.EnableSolarHeat && !Grid.FrameSolarOccluded)
{
float intensity = DirectionalRadiationIntensity(ref Grid.FrameSolarDirection, ref Grid.SolarRadiationNode);
+ IntensityDebug = intensity;
+ DebugDrawColorsSolar(intensity);
totalRadiation += Settings.Instance.SolarEnergy * Definition.Emissivity * (intensity * ExposedSurfaceArea);
}
@@ -505,41 +507,50 @@ private void UpdateExposedSurfaceArea()
internal float DirectionalRadiationIntensity(ref Vector3 targetDirection, ref ThermalRadiationNode node)
{
float intensity = 0;
- bool isCube = (Block.Max - Block.Min).Volume() <= 1;
for (int i = 0; i < 6; i++)
{
- intensity += CalculateDirectionIntensity(i, ExposedSurfacesByDirection[i], ref targetDirection, ref node, isCube);
- }
+ int surfaceCount = ExposedSurfacesByDirection[i];
+ if (surfaceCount == 0) continue;
+
+ Vector3D startDirection = Vector3D.Rotate(ThermalGrid.Directions[i], Grid.FrameMatrix);
+ float dot = Vector3.Dot(startDirection, targetDirection);
+ dot = Math.Max(0, dot);
+
+ if (surfaceCount > 1)
+ {
+ node.Sides[i] += dot * surfaceCount;
+ node.SideSurfaces[i] += surfaceCount;
+ intensity += dot;
+ }
+ else
+ {
+ intensity += Math.Min(dot, node.SideAverages[i]);
+ }
+ }
return intensity;
}
- private float CalculateDirectionIntensity(int directionIndex, int surfaceCount, ref Vector3 targetDirection, ref ThermalRadiationNode node, bool isCube)
- {
- Vector3I direction = ThermalGrid.Directions[directionIndex];
- Vector3D startDirection = Vector3D.Rotate(direction, Grid.FrameMatrix);
- float dot = Vector3.Dot(startDirection, targetDirection);
-
- dot = Math.Max(0, dot);
- if (isCube)
- {
- node.Sides[directionIndex] += dot * surfaceCount;
- node.SideSurfaces[directionIndex] += surfaceCount;
- return dot;
- }
- else
+ private void DebugDrawColorsTemperature()
+ {
+ if (Settings.Instance.DebugTemperatureBlockColors && MyAPIGateway.Session.IsServer)
{
- return Math.Min(dot, node.SideAverages[directionIndex]);
+ Vector3 color = Tools.GetTemperatureColor(Temperature);
+ if (Block.ColorMaskHSV != color)
+ {
+ Block.CubeGrid.ColorBlocks(Block.Min, Block.Max, color);
+ }
}
}
- private void DebugDrawColors()
+ private void DebugDrawColorsSolar(float intensity)
{
- if (Settings.Instance.DebugBlockColors && MyAPIGateway.Session.IsServer)
+
+ if (Settings.Instance.DebugSolarRadiationBlockColors && MyAPIGateway.Session.IsServer)
{
- Vector3 color = Tools.GetTemperatureColor(Temperature);
+ Vector3 color = Tools.GetTemperatureColor(Math.Abs(intensity), 3, 0.5f, 1.5f);
if (Block.ColorMaskHSV != color)
{
Block.CubeGrid.ColorBlocks(Block.Min, Block.Max, color);
diff --git a/ThermalDynamics/Data/Scripts/Thermodynamics/ThermalGrid.cs b/ThermalDynamics/Data/Scripts/Thermodynamics/ThermalGrid.cs
index 9adae96..5a00324 100644
--- a/ThermalDynamics/Data/Scripts/Thermodynamics/ThermalGrid.cs
+++ b/ThermalDynamics/Data/Scripts/Thermodynamics/ThermalGrid.cs
@@ -509,11 +509,9 @@ private void SetFrameAmbiantTemperature(float temperature)
private void PrepareSolarEnvironment(ref Vector3D position)
{
-
- FrameSolarDirection = MyVisualScriptLogicProvider.GetSunDirection();
-
if (!Settings.Instance.EnableSolarHeat) return;
+ FrameSolarDirection = MyVisualScriptLogicProvider.GetSunDirection();
SolarRadiationNode.Update();
FrameSolarOccluded = false;
@@ -553,10 +551,10 @@ private void PrepareSolarEnvironment(ref Vector3D position)
voxel.PositionComp.WorldAABB.Intersect(ref line, out subLine);
//Vector3D start = Vector3D.Transform((Vector3D)(Vector3)ExposedSurface[i] * gridSize, matrix);
- var green = Color.Green.ToVector4();
- if (Settings.Instance.Debug && !MyAPIGateway.Utilities.IsDedicated)
+ if (Settings.Instance.DebugSolarRaycast && !MyAPIGateway.Utilities.IsDedicated)
{
+ var green = Color.Green.ToVector4();
MySimpleObjectDraw.DrawLine(subLine.From, subLine.To, MyStringId.GetOrCompute("Square"), ref green, 0.2f);
}
@@ -585,7 +583,7 @@ private void PrepareSolarEnvironment(ref Vector3D position)
var blue = Color.Blue.ToVector4();
- if (Settings.Instance.Debug && !MyAPIGateway.Utilities.IsDedicated)
+ if (Settings.Instance.DebugSolarRaycast && !MyAPIGateway.Utilities.IsDedicated)
{
MySimpleObjectDraw.DrawLine(subLine.From, subLine.To, MyStringId.GetOrCompute("Square"), ref blue, 0.2f);
@@ -601,10 +599,9 @@ private void PrepareSolarEnvironment(ref Vector3D position)
}
}
- if (Settings.Instance.Debug && !MyAPIGateway.Utilities.IsDedicated)
+ if (Settings.Instance.DebugSolarRaycast && !MyAPIGateway.Utilities.IsDedicated)
{
var color = (FrameSolarOccluded) ? Color.Red.ToVector4() : Color.White.ToVector4();
- var color2 = Color.LightGoldenrodYellow.ToVector4();
MySimpleObjectDraw.DrawLine(position, position + (FrameSolarDirection * 15000000), MyStringId.GetOrCompute("Square"), ref color, 0.1f);
}
}
diff --git a/ThermalDynamics/Data/Scripts/Thermodynamics/ThermalGridMapperV4.cs b/ThermalDynamics/Data/Scripts/Thermodynamics/ThermalGridMapperV4.cs
index 621ae30..c721168 100644
--- a/ThermalDynamics/Data/Scripts/Thermodynamics/ThermalGridMapperV4.cs
+++ b/ThermalDynamics/Data/Scripts/Thermodynamics/ThermalGridMapperV4.cs
@@ -121,14 +121,14 @@ public void OnBlockAddOrUpdate(IMySlimBlock block)
Queue processQueue = new Queue();
- //List mounts = new List();
+ List mounts = new List();
MyCubeBlockDefinition def = block.BlockDefinition as MyCubeBlockDefinition;
bool isAirtight = def?.IsAirTight == true;
Matrix matrix;
MyBlockOrientation orientation = block.Orientation;
orientation.GetMatrix(out matrix);
matrix.TransposeRotationInPlace();
- //MyCubeGrid.TransformMountPoints(mounts, def, def.MountPoints, ref orientation);
+ MyCubeGrid.TransformMountPoints(mounts, def, def.MountPoints, ref orientation);
// look at all cells within the block
for (int x = min.X; x < max.X; x++)
@@ -204,24 +204,24 @@ public void OnBlockAddOrUpdate(IMySlimBlock block)
}
//perform mount point check
- //for (int b = 0; b < mounts.Count; b++)
- //{
- // MyCubeBlockDefinition.MountPoint m = mounts[b];
- // if (!m.Enabled || m.Normal != dir)
- // {
- // continue;
- // }
-
- // Vector3 mmin = Vector3.Min(m.Start, m.End) - local;
- // Vector3 mmax = Vector3.Max(m.Start, m.End) - local;
- // BoundingBox mountBox = new BoundingBox(mmin, mmax);
- // BoundingBox cellbox = mountBounds[a];
-
- // if (cellbox.Intersects(mountBox))
- // {
- // state |= 1 << a + (int)SurfaceFlags.SelfMountPointOffset;
- // }
- //}
+ for (int b = 0; b < mounts.Count; b++)
+ {
+ MyCubeBlockDefinition.MountPoint m = mounts[b];
+ if (!m.Enabled || m.Normal != dir)
+ {
+ continue;
+ }
+
+ Vector3 mmin = Vector3.Min(m.Start, m.End) - local;
+ Vector3 mmax = Vector3.Max(m.Start, m.End) - local;
+ BoundingBox mountBox = new BoundingBox(mmin, mmax);
+ BoundingBox cellbox = mountBounds[a];
+
+ if (cellbox.Intersects(mountBox))
+ {
+ state |= 1 << a + (int)SurfaceFlags.SelfMountPointOffset;
+ }
+ }
int ns;
if (Surfaces.TryGetValue(ncell, out ns))
@@ -234,8 +234,8 @@ public void OnBlockAddOrUpdate(IMySlimBlock block)
int bitp = 5 - a;
state |= (ns & 1 << bitp) >> bitp << a + (int)SurfaceFlags.NeighborAirtightOffset;
- //bitp = 5 - a + (int)SurfaceFlags.SelfMountPointOffset;
- //state |= (ns & 1 << bitp) >> bitp << a + (int)SurfaceFlags.SelfMountPointOffset;
+ bitp = 5 - a + (int)SurfaceFlags.SelfMountPointOffset;
+ state |= (ns & 1 << bitp) >> bitp << a + (int)SurfaceFlags.NeighborMountPointOffset;
processQueue.Enqueue(ncell);
}
@@ -295,7 +295,7 @@ private void OnBlockRemoved(IMySlimBlock block)
{
int surface = Surfaces[n];
surface &= ~(1 << 5 - i + (int)SurfaceFlags.NeighborAirtightOffset);
- //surface &= ~(1 << 5 - i + (int)SurfaceFlags.NeighborMountPointOffset);
+ surface &= ~(1 << 5 - i + (int)SurfaceFlags.NeighborMountPointOffset);
Surfaces[n] = surface;
//MyLog.Default.Info(DebugSurfaceStateText(surface));
@@ -329,7 +329,7 @@ private void UpdateCell(Vector3I cell)
state |= (ns & 1 << bitp) >> bitp << i + (int)SurfaceFlags.NeighborAirtightOffset;
bitp = 5 - i + (int)SurfaceFlags.SelfMountPointOffset;
- state |= (ns & 1 << bitp) >> bitp << i + (int)SurfaceFlags.SelfMountPointOffset;
+ state |= (ns & 1 << bitp) >> bitp << i + (int)SurfaceFlags.NeighborMountPointOffset;
}
Surfaces[cell] = state;
@@ -586,7 +586,12 @@ public int[] GetExposedSurfacesByDirection(Vector3I min, Vector3I max)
// and the neighbor cell is exposed
if ((cellState & 1 << i + (int)SurfaceFlags.NeighborAirtightOffset) == 0 && Rooms[0].Contains(n))
{
- exposedSurfaces[i]++;
+
+ //MyLog.Default.Info($"mountpointself: {(cellState & 1 << i + (int)SurfaceFlags.NeighborMountPointOffset) ! 1}")
+ if (!((cellState & 1 << i + (int)SurfaceFlags.NeighborMountPointOffset) != 0 && (cellState & 1 << i + (int)SurfaceFlags.SelfMountPointOffset) != 0))
+ {
+ exposedSurfaces[i]++;
+ }
}
}
}
diff --git a/ThermalDynamics/Models/Bottle.mwm b/ThermalDynamics/Models/Bottle.mwm
index d699c3c..118e0f5 100644
Binary files a/ThermalDynamics/Models/Bottle.mwm and b/ThermalDynamics/Models/Bottle.mwm differ
diff --git a/ThermalDynamics/Models/Extinguisher.mwm b/ThermalDynamics/Models/Extinguisher.mwm
index ea4d849..8b586dd 100644
Binary files a/ThermalDynamics/Models/Extinguisher.mwm and b/ThermalDynamics/Models/Extinguisher.mwm differ