• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-c誰得cocoaqtpythonrubywindowsphpgameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwitterdombtronvb.nettestarduinodirectxpreviewerゲームエンジン

First Machine Age's Mods (Combined repo.)


Commit MetaInfo

Revisãobfd828f5f35bb8eba24a3c90de3b320385a7e5d6 (tree)
Hora2021-05-08 07:55:47
Autormelchior <melchior@user...>
Commitermelchior

Mensagem de Log

Start of Machinations...

Mudança Sumário

Diff

--- /dev/null
+++ b/Machinations/Abstracts/LocalClientCommand.cs
@@ -0,0 +1,28 @@
1+using System;
2+
3+using Vintagestory.API.Client;
4+using Vintagestory.API.Common;
5+
6+namespace Machinations
7+{
8+ public class LocalClientCommand : ClientChatCommand
9+ {
10+ protected ICoreClientAPI ClientAPI;
11+ protected ILogger Logger;
12+
13+
14+ public LocalClientCommand(ICoreClientAPI _clientAPI)
15+ {
16+ ClientAPI = _clientAPI;
17+ Logger = _clientAPI.World.Logger;
18+ }
19+
20+ private LocalClientCommand( )
21+ {
22+ throw new NotSupportedException( );
23+ }
24+
25+
26+ }
27+}
28+
--- /dev/null
+++ b/Machinations/Commands/MechNetAnalyser.cs
@@ -0,0 +1,67 @@
1+using System;
2+using System.Text;
3+
4+using Vintagestory.API.Client;
5+using Vintagestory.API.Common;
6+using Vintagestory.API.MathTools;
7+using Vintagestory.GameContent.Mechanics;
8+
9+namespace Machinations
10+{
11+ public class MechNetAnalyser : LocalClientCommand
12+ {
13+ public MechNetAnalyser(ICoreClientAPI _clientAPI) : base(_clientAPI)
14+ {
15+ this.Command = @"mprobe";
16+ this.Description = "Probes local information about Mechanical-Network block(s).";
17+ this.handler += ProbeMechnet;
18+ this.Syntax = " {facing} | blockPos";
19+ }
20+
21+ internal void ProbeMechnet(int groupId, CmdArgs args)
22+ {
23+ var pos = ClientAPI.World.Player.CurrentBlockSelection.Position.Copy( );
24+ if (args.Length > 1) {
25+ pos = args.PopVec3i( ).AsBlockPos;
26+ }
27+
28+ var someBlock = ClientAPI.World.BlockAccessor.GetBlock(pos);
29+
30+ if (someBlock != null && !someBlock.IsMissing && someBlock.MatterState == EnumMatterState.Solid)
31+ {
32+ if (someBlock is IMechanicalPowerBlock)
33+ {
34+ var mechNetInterface = someBlock as IMechanicalPowerBlock;
35+ var mpNetwork = mechNetInterface.GetNetwork(ClientAPI.World, pos);
36+
37+ if (mpNetwork == null)
38+ {
39+ ClientAPI.ShowChatMessage("No valid network present.");
40+ return;
41+ }
42+
43+ var report = ReportOnMechnetwork(mpNetwork);
44+ ClientAPI.ShowChatMessage(report.ToString( ));
45+ }
46+ else
47+ {
48+ ClientAPI.ShowChatMessage(string.Format("Block: '{0}' not Mechanical...", someBlock.GetPlacedBlockName(ClientAPI.World, pos)));
49+ }
50+ }
51+
52+ }
53+ internal StringBuilder ReportOnMechnetwork(MechanicalNetwork mpNetwork)
54+ {
55+ var report = new StringBuilder(1000);
56+
57+ report.AppendLine($"Network #{mpNetwork.networkId} OK:{mpNetwork.Valid} Loaded:{mpNetwork.fullyLoaded} ");
58+ report.AppendLine($"DIR:{mpNetwork.TurnDir} REV:{mpNetwork.DirectionHasReversed} SPD:{mpNetwork.Speed:F1} LSPD:{mpNetwork.clientSpeed:F1} %TRQ:{mpNetwork.TotalAvailableTorque:F1} NTRQ:{mpNetwork.NetworkTorque:F1} NRST:{mpNetwork.NetworkResistance:F1} ");
59+ report.AppendLine($"TURNS:{mpNetwork.AngleRad:F2} Nodes: {mpNetwork.nodes.Count}");
60+
61+
62+ return report;
63+ }
64+
65+ }
66+
67+}
\ No newline at end of file
--- /dev/null
+++ b/Machinations/ML_Collection.cs
@@ -0,0 +1,16 @@
1+using System;
2+
3+using Vintagestory.API.Common;
4+
5+namespace Machinations
6+{
7+ public partial class MachinationsLoader : ModSystem
8+ {
9+
10+ private void AttachClientCommands( )
11+ {
12+ ClientAPI.RegisterCommand(new MechNetAnalyser(ClientAPI));
13+ }
14+ }
15+}
16+
--- /dev/null
+++ b/Machinations/Machinations.csproj
@@ -0,0 +1,87 @@
1+<?xml version="1.0" encoding="utf-8"?>
2+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+ <PropertyGroup>
4+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+ <ProjectGuid>{8FB150BD-DA28-4BCA-9EE0-05C463A5781C}</ProjectGuid>
7+ <OutputType>Library</OutputType>
8+ <RootNamespace>Machinations</RootNamespace>
9+ <AssemblyName>Machinations</AssemblyName>
10+ <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
11+ </PropertyGroup>
12+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
13+ <DebugSymbols>true</DebugSymbols>
14+ <DebugType>full</DebugType>
15+ <Optimize>false</Optimize>
16+ <OutputPath>bin\Debug</OutputPath>
17+ <DefineConstants>DEBUG;</DefineConstants>
18+ <ErrorReport>prompt</ErrorReport>
19+ <WarningLevel>4</WarningLevel>
20+ <ConsolePause>false</ConsolePause>
21+ <CustomCommands>
22+ <CustomCommands>
23+ <Command type="AfterBuild" command="7z a -tzip -x!*.zip -aoa Machinations_${ProjectConfig}.zip" workingdir="${TargetDir}" />
24+ <Command type="AfterClean" command="rm -f *.zip" workingdir="${TargetDir}" />
25+ </CustomCommands>
26+ </CustomCommands>
27+ </PropertyGroup>
28+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
29+ <Optimize>true</Optimize>
30+ <OutputPath>bin\Release</OutputPath>
31+ <ErrorReport>prompt</ErrorReport>
32+ <WarningLevel>4</WarningLevel>
33+ <ConsolePause>false</ConsolePause>
34+ </PropertyGroup>
35+ <ItemGroup>
36+ <Reference Include="System" />
37+ <Reference Include="0Harmony">
38+ <HintPath>VS_libs\0Harmony.dll</HintPath>
39+ <Private>False</Private>
40+ </Reference>
41+ <Reference Include="Newtonsoft.Json">
42+ <HintPath>VS_libs\Newtonsoft.Json.dll</HintPath>
43+ <Private>False</Private>
44+ </Reference>
45+ <Reference Include="protobuf-net">
46+ <HintPath>VS_libs\protobuf-net.dll</HintPath>
47+ <Private>False</Private>
48+ </Reference>
49+ <Reference Include="VintagestoryAPI">
50+ <HintPath>VS_libs\VintagestoryAPI.dll</HintPath>
51+ <Private>False</Private>
52+ </Reference>
53+ <Reference Include="VintagestoryLib">
54+ <HintPath>VS_libs\VintagestoryLib.dll</HintPath>
55+ <Private>False</Private>
56+ </Reference>
57+ <Reference Include="VSCreativeMod">
58+ <HintPath>VS_libs\VSCreativeMod.dll</HintPath>
59+ <Private>False</Private>
60+ </Reference>
61+ <Reference Include="VSEssentials">
62+ <HintPath>VS_libs\VSEssentials.dll</HintPath>
63+ <Private>False</Private>
64+ </Reference>
65+ <Reference Include="VSSurvivalMod">
66+ <HintPath>VS_libs\VSSurvivalMod.dll</HintPath>
67+ <Private>False</Private>
68+ </Reference>
69+ </ItemGroup>
70+ <ItemGroup>
71+ <Compile Include="MachinationsLoader.cs" />
72+ <Compile Include="Properties\AssemblyInfo.cs" />
73+ <Compile Include="Abstracts\LocalClientCommand.cs" />
74+ <Compile Include="ML_Collection.cs" />
75+ <Compile Include="Commands\MechNetAnalyser.cs" />
76+ </ItemGroup>
77+ <ItemGroup>
78+ <None Include="modinfo.json">
79+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
80+ </None>
81+ </ItemGroup>
82+ <ItemGroup>
83+ <Folder Include="Abstracts\" />
84+ <Folder Include="Commands\" />
85+ </ItemGroup>
86+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
87+</Project>
\ No newline at end of file
--- /dev/null
+++ b/Machinations/MachinationsLoader.cs
@@ -0,0 +1,51 @@
1+using System;
2+
3+using Vintagestory.API.Client;
4+using Vintagestory.API.Common;
5+using Vintagestory.API.Server;
6+using Vintagestory.Client.NoObf;
7+using Vintagestory.Server;
8+
9+namespace Machinations
10+{
11+ public partial class MachinationsLoader : ModSystem
12+ {
13+ private ICoreAPI CoreAPI;
14+ private ICoreServerAPI ServerAPI;
15+ private ICoreClientAPI ClientAPI;
16+ private ServerCoreAPI ServerCore { get { return ServerAPI as ServerCoreAPI; } }
17+ private ClientCoreAPI ClientCore { get { return ClientAPI as ClientCoreAPI; } }
18+
19+ public override bool AllowRuntimeReload {
20+ get { return false; }
21+ }
22+
23+ public override bool ShouldLoad(EnumAppSide forSide)
24+ {
25+ return true;
26+ }
27+
28+ public override double ExecuteOrder( )
29+ {
30+ return 0.10d;
31+ }
32+
33+ public override void Start(ICoreAPI api)
34+ {
35+ this.CoreAPI = api;
36+ }
37+
38+ public override void StartServerSide(ICoreServerAPI api)
39+ {
40+ this.ServerAPI = api;
41+ }
42+
43+ public override void StartClientSide(ICoreClientAPI api)
44+ {
45+ this.ClientAPI = api;
46+
47+ AttachClientCommands();
48+ }
49+ }
50+}
51+
--- /dev/null
+++ b/Machinations/Properties/AssemblyInfo.cs
@@ -0,0 +1,31 @@
1+using System.Reflection;
2+using System.Runtime.CompilerServices;
3+
4+// Information about this assembly is defined by the following attributes.
5+// Change them to the values specific to your project.
6+
7+[assembly: AssemblyTitle("Machinations")]
8+[assembly: AssemblyDescription("Vintage Story Plugin")]
9+
10+#if RELEASE
11+[assembly: AssemblyConfiguration("RELEASE")]
12+#else
13+[assembly: AssemblyConfiguration("DEBUG")]
14+#endif
15+
16+[assembly: AssemblyProduct("First-Macgine-Age (component)")]
17+[assembly: AssemblyCopyright("Melchior")]
18+
19+
20+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
21+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
22+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
23+
24+[assembly: AssemblyVersion("1.0.*")]
25+
26+// The following attributes are used to specify the signing key for the assembly,
27+// if desired. See the Mono documentation for more information about signing.
28+
29+//[assembly: AssemblyDelaySign(false)]
30+//[assembly: AssemblyKeyFile("")]
31+
--- /dev/null
+++ b/Machinations/modinfo.json
@@ -0,0 +1,13 @@
1+{
2+ "type": "code",
3+ "name": "Machinations",
4+ "description" : "The Machine AGE starts here.",
5+ "authors": ["Melchior"],
6+ "ModID":"machinations",
7+ "version": "0.1.0",
8+ "dependencies": {
9+ "game": "1.14.8",
10+ "survival": ""
11+ },
12+ "website": "http://nowebsite.nope"
13+}