Add new blocks and materials, make every type public in the game, fix entity publish
- Probably should've committed more - Added new block IDs and a material (also fixed material names) - Added missing player states - Added a class to make every type public in the game's code, so we don't need to worry about internal components - We don't need to worry about anticheat so it should be fine - will need to be made into its own exe though - Fixed delayed entity publishing and set the limits based on the consumers (just 30 almost everywhere)
This commit is contained in:
parent
5e90c5ee26
commit
23439abde3
10 changed files with 105 additions and 45 deletions
|
@ -20,6 +20,7 @@
|
|||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Lib.Harmony" Version="2.0.4" />
|
||||
<PackageReference Include="Mono.Cecil" Version="0.11.4" />
|
||||
<PackageReference Include="System.CodeDom" Version="7.0.0-preview.2.22152.2" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
36
CodeGenerator/MakeEverythingPublicInGame.cs
Normal file
36
CodeGenerator/MakeEverythingPublicInGame.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection.Metadata;
|
||||
using System.Text.RegularExpressions;
|
||||
using Mono.Cecil;
|
||||
using ModuleDefinition = Mono.Cecil.ModuleDefinition;
|
||||
|
||||
namespace CodeGenerator
|
||||
{
|
||||
public class MakeEverythingPublicInGame
|
||||
{
|
||||
public void Start()
|
||||
{
|
||||
Console.WriteLine("Starting assembly editing...");
|
||||
var fileRegex =
|
||||
new Regex(".*(Techblox|Gamecraft|RobocraftX|FullGame|RobocraftECS|DataLoader|RCX|GameState)[^/]*(\\.dll)");
|
||||
foreach (var file in Directory.EnumerateFiles(@"../../../../../ref/Techblox_Data/Managed"))
|
||||
{
|
||||
if (!fileRegex.IsMatch(file)) continue;
|
||||
Console.WriteLine(file);
|
||||
ProcessAssembly(file);
|
||||
}
|
||||
}
|
||||
|
||||
public void ProcessAssembly(string path)
|
||||
{
|
||||
var mod = ModuleDefinition.ReadModule(path, new(ReadingMode.Immediate) { ReadWrite = true });
|
||||
foreach (var typeDefinition in mod.Types)
|
||||
{
|
||||
typeDefinition.Attributes |= TypeAttributes.Public;
|
||||
}
|
||||
|
||||
mod.Write();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,6 +11,13 @@ namespace CodeGenerator
|
|||
internal class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
GenerateBlockClasses();
|
||||
var mepig = new MakeEverythingPublicInGame();
|
||||
mepig.Start();
|
||||
}
|
||||
|
||||
private static void GenerateBlockClasses()
|
||||
{
|
||||
var bcg = new BlockClassGenerator();
|
||||
bcg.Generate("Engine", null, new Dictionary<string, string>
|
||||
|
|
|
@ -302,6 +302,7 @@ namespace TechbloxModdingAPI.Blocks
|
|||
FloodLight,
|
||||
SoccerBall,
|
||||
CircularWallLight,
|
||||
BlueSkyAtmos,
|
||||
DirtToGrassTransitionTile = 393,
|
||||
DirtToGrassTransitionInnerTile,
|
||||
DirtToGrassTransitionOuterTile,
|
||||
|
@ -362,10 +363,21 @@ namespace TechbloxModdingAPI.Blocks
|
|||
SmallGridHill,
|
||||
SmallGridHillInnerCorner,
|
||||
SmallGridHillOuterCorner,
|
||||
Vector7SmallJet = 460,
|
||||
AimingAxleServo,
|
||||
AimingHingeServo,
|
||||
WeaponDisabler,
|
||||
Vector7SmallJet,
|
||||
Vector7MediumJet,
|
||||
Vector7LargeJet,
|
||||
Vector7XLJet,
|
||||
Vector7XXLJet
|
||||
Vector7XXLJet,
|
||||
APCWheelRigNoSteering,
|
||||
APCWheelRigWithSteering,
|
||||
APCWheel,
|
||||
APCSeat,
|
||||
APCEngine,
|
||||
DamageScoreBlock,
|
||||
KillScoreBlock,
|
||||
Autocannon = 480
|
||||
}
|
||||
}
|
|
@ -33,13 +33,14 @@ namespace TechbloxModdingAPI.Blocks
|
|||
WoodRoughGrungy,
|
||||
Boundary,
|
||||
Emissive,
|
||||
AircraftPaneling_Riveted_Painted,
|
||||
AircraftPaneling_Riveted_Metallic,
|
||||
Steel_Bodywork_Pearlescent,
|
||||
Steel_Bodywork_RadWrap,
|
||||
Steel_Bodywork_Glitter,
|
||||
AircraftPanelingRivetedPainted,
|
||||
AircraftPanelingRivetedMetallic,
|
||||
SteelBodyworkPearlescent,
|
||||
SteelBodyworkRadWrap,
|
||||
SteelBodyworkGlitter,
|
||||
BouncyRubber,
|
||||
BouncyRubber_TieDye,
|
||||
FuturisticPaneling_Riveted_Painted = 40
|
||||
BouncyRubberTieDye,
|
||||
BrickPainted,
|
||||
FuturisticPanelingRivetedPainted,
|
||||
}
|
||||
}
|
|
@ -80,7 +80,6 @@ namespace TechbloxModdingAPI.Blocks
|
|||
yield break;
|
||||
for (var index = 0; index < blocks.Length; index++)
|
||||
{
|
||||
if (index % 10 == 0) yield return new WaitForSecondsEnumerator(1f).Continue(); //The material or flipped status can only be changed 130 times per submission
|
||||
var block = blocks[index];
|
||||
if (!block.Exists) continue;
|
||||
foreach (var property in block.GetType().GetProperties())
|
||||
|
|
|
@ -30,11 +30,11 @@ namespace TechbloxModdingAPI.Blocks
|
|||
{
|
||||
get
|
||||
{
|
||||
return ((bool)(BlockEngine.GetBlockInfo(this, HarmonyLib.AccessTools.TypeByName("Techblox.EngineBlock.EngineBlockComponent"), "engineOn")));
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).engineOn;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.SetBlockInfo(this, HarmonyLib.AccessTools.TypeByName("Techblox.EngineBlock.EngineBlockComponent"), "engineOn", value);
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).engineOn = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,11 +45,11 @@ namespace TechbloxModdingAPI.Blocks
|
|||
{
|
||||
get
|
||||
{
|
||||
return ((int)(BlockEngine.GetBlockInfo(this, HarmonyLib.AccessTools.TypeByName("Techblox.EngineBlock.EngineBlockComponent"), "currentGear")));
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).currentGear;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.SetBlockInfo(this, HarmonyLib.AccessTools.TypeByName("Techblox.EngineBlock.EngineBlockComponent"), "currentGear", value);
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).currentGear = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,11 +60,11 @@ namespace TechbloxModdingAPI.Blocks
|
|||
{
|
||||
get
|
||||
{
|
||||
return ((float)(BlockEngine.GetBlockInfo(this, HarmonyLib.AccessTools.TypeByName("Techblox.EngineBlock.EngineBlockComponent"), "gearChangeCountdown")));
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).gearChangeCountdown;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.SetBlockInfo(this, HarmonyLib.AccessTools.TypeByName("Techblox.EngineBlock.EngineBlockComponent"), "gearChangeCountdown", value);
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).gearChangeCountdown = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,11 +75,11 @@ namespace TechbloxModdingAPI.Blocks
|
|||
{
|
||||
get
|
||||
{
|
||||
return ((float)(BlockEngine.GetBlockInfo(this, HarmonyLib.AccessTools.TypeByName("Techblox.EngineBlock.EngineBlockComponent"), "currentRpmAV")));
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).currentRpmAV;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.SetBlockInfo(this, HarmonyLib.AccessTools.TypeByName("Techblox.EngineBlock.EngineBlockComponent"), "currentRpmAV", value);
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).currentRpmAV = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,11 +90,11 @@ namespace TechbloxModdingAPI.Blocks
|
|||
{
|
||||
get
|
||||
{
|
||||
return ((float)(BlockEngine.GetBlockInfo(this, HarmonyLib.AccessTools.TypeByName("Techblox.EngineBlock.EngineBlockComponent"), "currentRpmLV")));
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).currentRpmLV;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.SetBlockInfo(this, HarmonyLib.AccessTools.TypeByName("Techblox.EngineBlock.EngineBlockComponent"), "currentRpmLV", value);
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).currentRpmLV = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,11 +105,11 @@ namespace TechbloxModdingAPI.Blocks
|
|||
{
|
||||
get
|
||||
{
|
||||
return ((float)(BlockEngine.GetBlockInfo(this, HarmonyLib.AccessTools.TypeByName("Techblox.EngineBlock.EngineBlockComponent"), "targetRpmAV")));
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).targetRpmAV;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.SetBlockInfo(this, HarmonyLib.AccessTools.TypeByName("Techblox.EngineBlock.EngineBlockComponent"), "targetRpmAV", value);
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).targetRpmAV = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,11 +120,11 @@ namespace TechbloxModdingAPI.Blocks
|
|||
{
|
||||
get
|
||||
{
|
||||
return ((float)(BlockEngine.GetBlockInfo(this, HarmonyLib.AccessTools.TypeByName("Techblox.EngineBlock.EngineBlockComponent"), "targetRpmLV")));
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).targetRpmLV;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.SetBlockInfo(this, HarmonyLib.AccessTools.TypeByName("Techblox.EngineBlock.EngineBlockComponent"), "targetRpmLV", value);
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).targetRpmLV = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,11 +135,11 @@ namespace TechbloxModdingAPI.Blocks
|
|||
{
|
||||
get
|
||||
{
|
||||
return ((float)(BlockEngine.GetBlockInfo(this, HarmonyLib.AccessTools.TypeByName("Techblox.EngineBlock.EngineBlockComponent"), "currentTorque")));
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).currentTorque;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.SetBlockInfo(this, HarmonyLib.AccessTools.TypeByName("Techblox.EngineBlock.EngineBlockComponent"), "currentTorque", value);
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).currentTorque = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -150,11 +150,11 @@ namespace TechbloxModdingAPI.Blocks
|
|||
{
|
||||
get
|
||||
{
|
||||
return ((float)(BlockEngine.GetBlockInfo(this, HarmonyLib.AccessTools.TypeByName("Techblox.EngineBlock.EngineBlockComponent"), "totalWheelVelocityAV")));
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).totalWheelVelocityAV;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.SetBlockInfo(this, HarmonyLib.AccessTools.TypeByName("Techblox.EngineBlock.EngineBlockComponent"), "totalWheelVelocityAV", value);
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).totalWheelVelocityAV = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -165,11 +165,11 @@ namespace TechbloxModdingAPI.Blocks
|
|||
{
|
||||
get
|
||||
{
|
||||
return ((float)(BlockEngine.GetBlockInfo(this, HarmonyLib.AccessTools.TypeByName("Techblox.EngineBlock.EngineBlockComponent"), "totalWheelVelocityLV")));
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).totalWheelVelocityLV;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.SetBlockInfo(this, HarmonyLib.AccessTools.TypeByName("Techblox.EngineBlock.EngineBlockComponent"), "totalWheelVelocityLV", value);
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).totalWheelVelocityLV = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -180,11 +180,11 @@ namespace TechbloxModdingAPI.Blocks
|
|||
{
|
||||
get
|
||||
{
|
||||
return ((int)(BlockEngine.GetBlockInfo(this, HarmonyLib.AccessTools.TypeByName("Techblox.EngineBlock.EngineBlockComponent"), "totalWheelCount")));
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).totalWheelCount;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.SetBlockInfo(this, HarmonyLib.AccessTools.TypeByName("Techblox.EngineBlock.EngineBlockComponent"), "totalWheelCount", value);
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).totalWheelCount = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -195,11 +195,11 @@ namespace TechbloxModdingAPI.Blocks
|
|||
{
|
||||
get
|
||||
{
|
||||
return ((bool)(BlockEngine.GetBlockInfo(this, HarmonyLib.AccessTools.TypeByName("Techblox.EngineBlock.EngineBlockComponent"), "lastGearUpInput")));
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).lastGearUpInput;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.SetBlockInfo(this, HarmonyLib.AccessTools.TypeByName("Techblox.EngineBlock.EngineBlockComponent"), "lastGearUpInput", value);
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).lastGearUpInput = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -210,11 +210,11 @@ namespace TechbloxModdingAPI.Blocks
|
|||
{
|
||||
get
|
||||
{
|
||||
return ((bool)(BlockEngine.GetBlockInfo(this, HarmonyLib.AccessTools.TypeByName("Techblox.EngineBlock.EngineBlockComponent"), "lastGearDownInput")));
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).lastGearDownInput;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.SetBlockInfo(this, HarmonyLib.AccessTools.TypeByName("Techblox.EngineBlock.EngineBlockComponent"), "lastGearDownInput", value);
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).lastGearDownInput = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -225,11 +225,11 @@ namespace TechbloxModdingAPI.Blocks
|
|||
{
|
||||
get
|
||||
{
|
||||
return ((float)(BlockEngine.GetBlockInfo(this, HarmonyLib.AccessTools.TypeByName("Techblox.EngineBlock.EngineBlockComponent"), "manualToAutoGearCoolOffCounter")));
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).manualToAutoGearCoolOffCounter;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.SetBlockInfo(this, HarmonyLib.AccessTools.TypeByName("Techblox.EngineBlock.EngineBlockComponent"), "manualToAutoGearCoolOffCounter", value);
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).manualToAutoGearCoolOffCounter = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -240,11 +240,11 @@ namespace TechbloxModdingAPI.Blocks
|
|||
{
|
||||
get
|
||||
{
|
||||
return ((float)(BlockEngine.GetBlockInfo(this, HarmonyLib.AccessTools.TypeByName("Techblox.EngineBlock.EngineBlockComponent"), "load")));
|
||||
return BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).load;
|
||||
}
|
||||
set
|
||||
{
|
||||
BlockEngine.SetBlockInfo(this, HarmonyLib.AccessTools.TypeByName("Techblox.EngineBlock.EngineBlockComponent"), "load", value);
|
||||
BlockEngine.GetBlockInfo<Techblox.EngineBlock.EngineBlockComponent>(this).load = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ using Unity.Mathematics;
|
|||
|
||||
using TechbloxModdingAPI.Engines;
|
||||
using TechbloxModdingAPI.Utility;
|
||||
using PrefabsID = RobocraftX.Common.PrefabsID;
|
||||
|
||||
namespace TechbloxModdingAPI.Blocks.Engines
|
||||
{
|
||||
|
@ -124,7 +125,7 @@ namespace TechbloxModdingAPI.Blocks.Engines
|
|||
var skew = entitiesDB.QueryEntity<SkewComponent>(id);
|
||||
entitiesDB.QueryEntity<RenderingDataStruct>(id).matrix =
|
||||
math.mul(float4x4.TRS(pos.position, rot.rotation, scale.scale), skew.skewMatrix);
|
||||
entitiesDB.PublishEntityChangeDelayed<GFXPrefabEntityStructGPUI>(id); // Signal a prefab change so it updates the render buffers
|
||||
entitiesDB.PublishEntityChangeDelayed<GFXPrefabEntityStructGPUI>(id, 30); // Signal a prefab change so it updates the render buffers
|
||||
}
|
||||
|
||||
internal void UpdatePrefab(Block block, byte material, bool flipped)
|
||||
|
@ -145,8 +146,8 @@ namespace TechbloxModdingAPI.Blocks.Engines
|
|||
entitiesDB.QueryEntityOrDefault<GFXPrefabEntityStructGPUI>(block).prefabID = prefabId;
|
||||
if (block.Exists)
|
||||
{
|
||||
entitiesDB.PublishEntityChangeDelayed<CubeMaterialStruct>(block.Id);
|
||||
entitiesDB.PublishEntityChangeDelayed<GFXPrefabEntityStructGPUI>(block.Id);
|
||||
entitiesDB.PublishEntityChangeDelayed<CubeMaterialStruct>(block.Id, 30);
|
||||
entitiesDB.PublishEntityChangeDelayed<GFXPrefabEntityStructGPUI>(block.Id, 30);
|
||||
|
||||
ref BuildingActionComponent local =
|
||||
ref entitiesDB.QueryEntity<BuildingActionComponent>(BuildingDroneUtility
|
||||
|
@ -160,7 +161,7 @@ namespace TechbloxModdingAPI.Blocks.Engines
|
|||
|
||||
public void UpdateBlockColor(EGID id)
|
||||
{
|
||||
entitiesDB.PublishEntityChange<ColourParameterEntityStruct>(id);
|
||||
entitiesDB.PublishEntityChangeDelayed<ColourParameterEntityStruct>(id, 30);
|
||||
}
|
||||
|
||||
public bool BlockExists(EGID blockID)
|
||||
|
|
|
@ -365,6 +365,9 @@ namespace TechbloxModdingAPI
|
|||
var group when group == CharacterExclusiveGroups.MachineSpawningGroup => PlayerState.HoldingMachine,
|
||||
var group when group == CharacterExclusiveGroups.OnFootGroup => PlayerState.OnFoot,
|
||||
var group when group == CharacterExclusiveGroups.InPilotSeatGroup => PlayerState.InSeat,
|
||||
var group when group == CharacterExclusiveGroups.DyingOnFootGroup => PlayerState.OnFoot,
|
||||
var group when group == CharacterExclusiveGroups.DyingInPilotSeatGroup => PlayerState.InSeat,
|
||||
var group when group == CharacterExclusiveGroups.DeadGroup => PlayerState.OnFoot,
|
||||
_ => throw new ArgumentOutOfRangeException("", "Unknown player state")
|
||||
};
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ namespace TechbloxModdingAPI.Utility
|
|||
changes.Remove(id);
|
||||
ChangesToPublish[typeof(T)] = (count + 1, changes);
|
||||
yield return Yield.It;
|
||||
ChangesToPublish[typeof(T)] = (0, changes);
|
||||
ChangesToPublish[typeof(T)] = (Math.Max(ChangesToPublish[typeof(T)].PublishedCount - 1, 0), changes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in a new issue