Skip to content
This repository was archived by the owner on Jul 12, 2024. It is now read-only.

Commit 5ab0eee

Browse files
committed
Добавьте файлы проекта.
1 parent bfb2d2f commit 5ab0eee

12 files changed

+386
-0
lines changed

MoreCommands-Plugin.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.3.32922.545
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MoreCommands-Plugin", "MoreCommands-Plugin\MoreCommands-Plugin.csproj", "{333B6DF2-DA52-4632-8E0B-79A55D2637C2}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{333B6DF2-DA52-4632-8E0B-79A55D2637C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{333B6DF2-DA52-4632-8E0B-79A55D2637C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{333B6DF2-DA52-4632-8E0B-79A55D2637C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{333B6DF2-DA52-4632-8E0B-79A55D2637C2}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {2770684B-D484-4C64-A55C-D04B34156726}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using FacilityManager.Behaviours;
2+
using FacilityManager.Server;
3+
4+
namespace MoreCommands_Plugin.Commands
5+
{
6+
public class AddJumpHeightCommand : Command
7+
{
8+
public override string Description => "Adds jump to a player (addjump <member> <add_value>).";
9+
10+
public override void Execute(CommandContext commandContext, CommandReader reader)
11+
{
12+
Member targetMember = reader.ReadMember(commandContext.Sender);
13+
int addValue = reader.ReadInt();
14+
15+
Player player = Context.PlayerSpawner.GetPlayer(targetMember);
16+
player.Movement.AddModifier(new PlayerMovement.Modifier()
17+
{
18+
RelativeJumpHeight = addValue
19+
});
20+
}
21+
}
22+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using FacilityManager.Behaviours;
2+
using FacilityManager.Server;
3+
4+
namespace MoreCommands_Plugin.Commands
5+
{
6+
public class AddSpeedCommand : Command
7+
{
8+
public override string Description => "Adds speed to a player (addspeed <member> <add_value>).";
9+
10+
public override void Execute(CommandContext commandContext, CommandReader reader)
11+
{
12+
Member targetMember = reader.ReadMember(commandContext.Sender);
13+
int addValue = reader.ReadInt();
14+
15+
Player player = Context.PlayerSpawner.GetPlayer(targetMember);
16+
player.Movement.AddModifier(new PlayerMovement.Modifier()
17+
{
18+
RelativeSpeed = addValue
19+
});
20+
}
21+
}
22+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using FacilityManager.Server;
2+
using FacilityManager.World;
3+
4+
namespace MoreCommands_Plugin.Commands
5+
{
6+
public class CloseDoorsCommand : Command
7+
{
8+
public override string Description => "Closes all the doors in the facility.";
9+
10+
public override void Execute(CommandContext commandContext, CommandReader reader)
11+
{
12+
foreach (Door door in UnityEngine.Object.FindObjectsOfType<Door>())
13+
{
14+
door.Close();
15+
}
16+
}
17+
}
18+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using FacilityManager;
2+
using FacilityManager.Behaviours;
3+
using FacilityManager.Server;
4+
5+
namespace MoreCommands_Plugin.Commands
6+
{
7+
public class GiveItemSpawnerCommand : Command
8+
{
9+
public override string Description => "Gives an item spawner (itemspawner <item_id>).";
10+
11+
public override void Execute(CommandContext commandContext, CommandReader reader)
12+
{
13+
int itemId = reader.ReadInt();
14+
if (Context.ItemRegistry.GetItemInfo(itemId) == null)
15+
{
16+
commandContext.ResponseError("Item id not found.\n");
17+
}
18+
19+
Player player = Context.PlayerSpawner.GetPlayer(commandContext.Sender);
20+
if (player.TryGetComponent(out HumanPlayer humanPlayer))
21+
{
22+
if (humanPlayer.Inventory.HasFreeSpace == false)
23+
commandContext.ResponseError("You don't have free space in inventory.\n");
24+
25+
ItemData itemData = new ItemData();
26+
itemData.SetInt("item_to_spawn", itemId);
27+
28+
humanPlayer.Inventory.AddItem(Context.ItemRegistry.GetItemInfo(2), itemData);
29+
commandContext.Response("Item spawner was added to your inventory.\n");
30+
31+
return;
32+
}
33+
34+
commandContext.ResponseError("Your player object doesn't have inventory.\n");
35+
}
36+
}
37+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using FacilityManager.Server;
2+
using FacilityManager.World;
3+
4+
namespace MoreCommands_Plugin.Commands
5+
{
6+
public class OpenDoorsCommand : Command
7+
{
8+
public override string Description => "Opens all the doors in the facility.";
9+
10+
public override void Execute(CommandContext commandContext, CommandReader reader)
11+
{
12+
foreach (Door door in UnityEngine.Object.FindObjectsOfType<Door>())
13+
{
14+
door.Open();
15+
}
16+
}
17+
}
18+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using FacilityManager.Server;
2+
using FacilityManager.World;
3+
using System;
4+
using UnityEngine;
5+
6+
namespace MoreCommands_Plugin.Commands
7+
{
8+
public class SetLightColorCommand : Command
9+
{
10+
public override string Description => "Sets light color in the facility (lightcolor <color_hex>).";
11+
12+
public override void Execute(CommandContext commandContext, CommandReader reader)
13+
{
14+
string colorHex = reader.ReadText();
15+
16+
Color color = ConvertHexStringToColor(commandContext, colorHex);
17+
Context.GetController<FacilityPower>().RpcSetColor(color);
18+
}
19+
20+
private Color ConvertHexStringToColor(CommandContext commandContext, string colorHex)
21+
{
22+
if (colorHex.Length != 6)
23+
{
24+
commandContext.ResponseError("Hex number must consist from 6 characters 0-9 A-F, without '#' character.\n");
25+
}
26+
27+
return new Color(
28+
Convert.ToInt32(colorHex.Substring(0, 2), 16) / 255f,
29+
Convert.ToInt32(colorHex.Substring(2, 2), 16) / 255f,
30+
Convert.ToInt32(colorHex.Substring(4, 2), 16) / 255f);
31+
}
32+
}
33+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
using FacilityManager;
2+
using FacilityManager.Behaviours;
3+
using FacilityManager.Server;
4+
using Mirror;
5+
using System.Collections;
6+
using UnityEngine;
7+
8+
namespace MoreCommands_Plugin.Commands
9+
{
10+
public class SpawnItemCommand : Command
11+
{
12+
public override string Description => "Spawns an item at player position (spawnitem <member> <item_id> <amount>).";
13+
14+
public override void Execute(CommandContext commandContext, CommandReader reader)
15+
{
16+
Member member = reader.ReadMember(commandContext.Sender);
17+
int itemId = reader.ReadInt();
18+
int amount = reader.ReadInt();
19+
20+
ItemInfo itemInfo = Context.ItemRegistry.GetItemInfo(itemId);
21+
if (itemInfo == null)
22+
{
23+
commandContext.ResponseError("Item id not found.\n");
24+
}
25+
26+
Player player = Context.PlayerSpawner.GetPlayer(member);
27+
if (player == null)
28+
{
29+
commandContext.ResponseError("Specified member is not spawned (waiting as spectator or waiting for server start).\n");
30+
}
31+
32+
player.StartCoroutine(SpawnItem(itemInfo, player.transform.position + Vector3.up, amount));
33+
}
34+
35+
private IEnumerator SpawnItem(ItemInfo itemInfo, Vector3 position, int amount)
36+
{
37+
for (int i = 0; i < amount; i++)
38+
{
39+
GameObject spawnedObject = Object.Instantiate(itemInfo.Prefab, position, Quaternion.identity);
40+
NetworkServer.Spawn(spawnedObject);
41+
42+
yield return null;
43+
}
44+
}
45+
}
46+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using FacilityManager;
2+
using FacilityManager.Behaviours;
3+
using FacilityManager.Server;
4+
using Mirror;
5+
using UnityEngine;
6+
7+
namespace MoreCommands_Plugin.Items
8+
{
9+
public class ModifiedKeycard : Keycard
10+
{
11+
public ModifiedKeycard(short varaintId) : base(varaintId)
12+
{
13+
}
14+
15+
public override void OnUse(HumanPlayer player, ItemUseType useType)
16+
{
17+
base.OnUse(player, useType);
18+
ItemData itemData = GetItemData(player);
19+
20+
if (itemData.GetInt("item_to_spawn", -1) == -1) return;
21+
GameObject prefab = Context.ItemRegistry.GetItemInfo(itemData.GetInt("item_to_spawn")).Prefab;
22+
23+
GameObject spawnedObject = Object.Instantiate(prefab, player.transform.position + Vector3.up, Quaternion.identity);
24+
NetworkServer.Spawn(spawnedObject);
25+
}
26+
}
27+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{333B6DF2-DA52-4632-8E0B-79A55D2637C2}</ProjectGuid>
8+
<OutputType>Library</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>MoreCommands_Plugin</RootNamespace>
11+
<AssemblyName>MoreCommands-Plugin</AssemblyName>
12+
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
<Deterministic>true</Deterministic>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>bin\Debug\</OutputPath>
21+
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26+
<DebugType>pdbonly</DebugType>
27+
<Optimize>true</Optimize>
28+
<OutputPath>bin\Release\</OutputPath>
29+
<DefineConstants>TRACE</DefineConstants>
30+
<ErrorReport>prompt</ErrorReport>
31+
<WarningLevel>4</WarningLevel>
32+
</PropertyGroup>
33+
<ItemGroup>
34+
<Reference Include="Assembly-CSharp">
35+
<HintPath>..\..\..\..\..\..\Program Files (x86)\Facility Manager\Facility Manager_Data\Managed\Assembly-CSharp.dll</HintPath>
36+
</Reference>
37+
<Reference Include="Mirror">
38+
<HintPath>..\..\..\..\..\..\Program Files (x86)\Facility Manager\Facility Manager_Data\Managed\Mirror.dll</HintPath>
39+
</Reference>
40+
<Reference Include="System" />
41+
<Reference Include="System.Core" />
42+
<Reference Include="System.Xml.Linq" />
43+
<Reference Include="System.Data.DataSetExtensions" />
44+
<Reference Include="Microsoft.CSharp" />
45+
<Reference Include="System.Data" />
46+
<Reference Include="System.Net.Http" />
47+
<Reference Include="System.Xml" />
48+
<Reference Include="UnityEngine.CoreModule">
49+
<HintPath>..\..\..\..\..\..\Program Files (x86)\Facility Manager\Facility Manager_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
50+
</Reference>
51+
</ItemGroup>
52+
<ItemGroup>
53+
<Compile Include="Commands\AddSpeedCommand.cs" />
54+
<Compile Include="Commands\AddJumpHeightCommand.cs" />
55+
<Compile Include="Commands\CloseDoorsCommand.cs" />
56+
<Compile Include="Commands\GiveItemSpawnerCommand.cs" />
57+
<Compile Include="Commands\OpenDoorsCommand.cs" />
58+
<Compile Include="Commands\SetLightColorCommand.cs" />
59+
<Compile Include="Commands\SpawnItemCommand.cs" />
60+
<Compile Include="Items\ModifiedKeycard.cs" />
61+
<Compile Include="MoreCommandsPlugin.cs" />
62+
<Compile Include="Properties\AssemblyInfo.cs" />
63+
</ItemGroup>
64+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
65+
</Project>

0 commit comments

Comments
 (0)