parent
fab436938a
commit
3c675daef6
@ -1,6 +1,6 @@
|
|||||||
MHG.SettingsMenu.Pages.Controls.Headings.DLatchPoke: "Mod: DLatch Poke"
|
MHG.SettingsMenu.Pages.Controls.Headings.DLatchPoke: "Mod: DLatch Poke"
|
||||||
|
|
||||||
FancyInput.Trigger.DLatchPoke.Poke: "Poke a DLatch"
|
FancyInput.Trigger.DLatchPoke.Poke: "Toggle DLatch State"
|
||||||
FancyInput.Trigger.DLatchPoke.Poke.Description: """
|
FancyInput.Trigger.DLatchPoke.Poke.Description: """
|
||||||
Toggles the internal state of the DLatch the player is looking at.
|
Toggles the internal state of the DLatch (or multiple) the player is looking at or has selected.
|
||||||
"""
|
"""
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
ID: D4VID_DLatchPoke
|
ID: D4VID_DLatchPoke
|
||||||
Name: DLatch Poke
|
Name: DLatch Poke
|
||||||
Author: D4VID
|
Author: D4VID
|
||||||
Version: 1.0.1
|
Version: 2.0.0
|
||||||
Priority: 0
|
Priority: 0
|
||||||
Dependencies:
|
Dependencies:
|
||||||
- EccsLogicWorldAPI
|
- EccsLogicWorldAPI
|
||||||
|
@ -0,0 +1,36 @@
|
|||||||
|
using DLatchPoke.Client.Keybindings;
|
||||||
|
using DLatchPoke.Shared.Packets.C2S;
|
||||||
|
using FancyInput;
|
||||||
|
using LogicAPI.Data;
|
||||||
|
using LogicWorld.Building.Overhaul;
|
||||||
|
using LogicWorld.GameStates;
|
||||||
|
using LogicWorld.Interfaces;
|
||||||
|
|
||||||
|
namespace DLatchPoke.Client {
|
||||||
|
public class DLatchPokeOperation : BuildingOperation {
|
||||||
|
public override string IconHexCode => "f363";
|
||||||
|
|
||||||
|
public override bool CanOperateOn(ComponentSelection selection) {
|
||||||
|
if (!DLatchPokeClient.ServerSupportsMod) {
|
||||||
|
DLatchPokeClient.Logger.Error("Server does not support this mod");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ComponentType dLatchType = Instances.MainWorld.ComponentTypes.GetComponentType("MHG.DLatch");
|
||||||
|
foreach (ComponentAddress componentAddress in selection) {
|
||||||
|
if (Instances.MainWorld.Data.Lookup(componentAddress).Data.Type != dLatchType) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void BeginOperationOn(ComponentSelection selection) {
|
||||||
|
Instances.SendData.Send(new DLatchPokeRequest() {
|
||||||
|
ComponentAddresses = selection.ComponentsInSelection,
|
||||||
|
});
|
||||||
|
GameStateManager.TransitionBackToBuildingState();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override InputTrigger OperationStarter => DLatchPokeTrigger.Poke;
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
namespace DLatchPoke.Client.Keybindings {
|
namespace DLatchPoke.Client.Keybindings {
|
||||||
public enum DLatchPokeContext {
|
public enum DLatchPokeContext {
|
||||||
None,
|
None = 0,
|
||||||
DLatchPoke,
|
DLatchPoke,
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,7 +1,7 @@
|
|||||||
namespace DLatchPoke.Client.Keybindings {
|
namespace DLatchPoke.Client.Keybindings {
|
||||||
// Define all available keybindings of the mod
|
// Define all available keybindings of the mod
|
||||||
public enum DLatchPokeTrigger {
|
public enum DLatchPokeTrigger {
|
||||||
None,
|
None = 0,
|
||||||
Poke,
|
Poke,
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,15 +1,19 @@
|
|||||||
using DLatchPoke.Shared.Packets.C2S;
|
using DLatchPoke.Shared.Packets.C2S;
|
||||||
|
using LogicAPI.Data;
|
||||||
using LogicWorld.SharedCode.Networking;
|
using LogicWorld.SharedCode.Networking;
|
||||||
|
|
||||||
namespace DLatchPoke.Server.Network {
|
namespace DLatchPoke.Server.Network {
|
||||||
public class DLatchPokeRequestHandler : PacketHandler<DLatchPokeRequest> {
|
public class DLatchPokeRequestHandler : PacketHandler<DLatchPokeRequest> {
|
||||||
private readonly DLatchPokeServer _dLatchPokeServer;
|
private readonly DLatchPokeServer _dLatchPokeServer;
|
||||||
|
|
||||||
public DLatchPokeRequestHandler(DLatchPokeServer dLatchPokeServer) {
|
public DLatchPokeRequestHandler(DLatchPokeServer dLatchPokeServer) {
|
||||||
_dLatchPokeServer = dLatchPokeServer;
|
_dLatchPokeServer = dLatchPokeServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Handle(DLatchPokeRequest packet, HandlerContext context) {
|
public override void Handle(DLatchPokeRequest packet, HandlerContext context) {
|
||||||
_dLatchPokeServer.PokeDLatch(packet.ComponentAddress);
|
foreach (ComponentAddress componentAddress in packet.ComponentAddresses) {
|
||||||
|
_dLatchPokeServer.PokeDLatch(componentAddress);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in new issue