-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v1.0.1.1 - Implemented emitter removal for MP
* Added mod icon * Implemented emitter removal for MP
- Loading branch information
hamstar0
committed
Apr 30, 2020
1 parent
59e1195
commit fee3875
Showing
5 changed files
with
75 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using System; | ||
using Microsoft.Xna.Framework; | ||
using Terraria; | ||
using Terraria.ID; | ||
using Terraria.ModLoader; | ||
using HamstarHelpers.Classes.Errors; | ||
using HamstarHelpers.Classes.Protocols.Packet.Interfaces; | ||
|
||
|
||
namespace Emitters.NetProtocols { | ||
class EmitterRemoveProtocol : PacketProtocolBroadcast { | ||
public static void BroadcastFromClient( ushort tileX, ushort tileY ) { | ||
if( Main.netMode != 1 ) { throw new ModHelpersException("Not client."); } | ||
|
||
var protocol = new EmitterRemoveProtocol( tileX, tileY ); | ||
|
||
protocol.SendToServer( true ); | ||
} | ||
|
||
public static void BroadcastFromServer( ushort tileX, ushort tileY ) { | ||
if( Main.netMode != 2 ) { throw new ModHelpersException("Not server."); } | ||
|
||
var protocol = new EmitterRemoveProtocol( tileX, tileY ); | ||
|
||
protocol.SendToClient( -1, -1 ); | ||
} | ||
|
||
|
||
|
||
//////////////// | ||
|
||
public ushort TileX; | ||
public ushort TileY; | ||
|
||
|
||
|
||
//////////////// | ||
|
||
private EmitterRemoveProtocol() { } | ||
|
||
private EmitterRemoveProtocol( ushort tileX, ushort tileY ) { | ||
this.TileX = tileX; | ||
this.TileY = tileY; | ||
} | ||
|
||
|
||
//////////////// | ||
|
||
protected override void ReceiveOnClient() { | ||
var myworld = ModContent.GetInstance<EmittersWorld>(); | ||
|
||
Main.PlaySound( SoundID.Item108, new Vector2(this.TileX<<4, this.TileY<<4) ); | ||
|
||
myworld.RemoveEmitter( this.TileX, this.TileY ); | ||
} | ||
|
||
protected override void ReceiveOnServer( int fromWho ) { | ||
var myworld = ModContent.GetInstance<EmittersWorld>(); | ||
|
||
myworld.RemoveEmitter( this.TileX, this.TileY ); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
displayName = Emitters | ||
author = hamstar | ||
version = 1.0.1 | ||
version = 1.0.1.1 | ||
modReferences = [email protected] | ||
buildIgnore = *.csproj, *.user, *.bat, obj\*, bin\*, .vs\*, .git\* | ||
homepage = https://forums.terraria.org/index.php?threads/emitters.87584/ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.