Empeld
Empeld plugin documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
essentials.blocks.structural.Doors.DoorBase< TOpened, TClosed > Class Template Reference

Class to be used for flip-floppable blocks with interacting with them Mainly focused on doors More...

Inheritance diagram for essentials.blocks.structural.Doors.DoorBase< TOpened, TClosed >:
essentials.blocks.structural.StructuralBase essentials.blocks.structural.Doors.IDoor pluginbase.Objects.World.Blocks.BlockBase pluginbase.Objects.World.Blocks.IBlockInteractable pluginbase.Objects.World.Blocks.IBlock pluginbase.Objects.World.Blocks.IBlock essentials.blocks.structural.Doors.MetalDoorClosed essentials.blocks.structural.Doors.MetalDoorOpen essentials.blocks.structural.Doors.SewerDoorClosed essentials.blocks.structural.Doors.SewerDoorOpen essentials.blocks.structural.Doors.WindowDoorClosed essentials.blocks.structural.Doors.WindowDoorOpen essentials.blocks.structural.Doors.WoodDoorClosed essentials.blocks.structural.Doors.WoodDoorOpen

Public Member Functions

override Matrix4 GetDynamicMeshTransform (IWorldReadonly world, Vector3i pos)
 Gets the dynamic mesh transform. More...
 
void ToggleDoor (IWorld world, Vector3i pt)
 Toggle the door at a given position More...
 
void OpenDoor (IWorld world, Vector3i pt)
 Open door at a given position More...
 
void CloseDoor (IWorld world, Vector3i pt)
 Close door at a given position More...
 
bool Interact (IWorld world, Vector3i pos)
 
- Public Member Functions inherited from pluginbase.Objects.World.Blocks.BlockBase
 BlockBase ()
 Initializes an instance of the block More...
 
bool Equals (IBlock block)
 Determines whether the specified pluginbase.Objects.World.Blocks.IBlock is equal to the current pluginbase.Objects.World.Blocks.BlockBase. More...
 
sealed override bool Equals (object obj)
 Determines whether the specified System.Object is equal to the current pluginbase.Objects.World.Blocks.BlockBase. More...
 
sealed override int GetHashCode ()
 The quick hash code for the block More...
 
sealed override string ToString ()
 Returns a string representing the block More...
 
virtual void GetDynamicMeshClones (IWorldReadonly world, Vector3i pos, Action< Matrix4 > render)
 Gets the dynamic mesh clone matricies More...
 
virtual bool PhysicsSimulate (IWorld world, IWorldBlock block)
 Simulates the physics. More...
 
Get< T > ()
 Get this instance extension type More...
 
void Set< T > (T extension)
 Set the specified extension. More...
 

Protected Member Functions

 DoorBase ()
 
- Protected Member Functions inherited from essentials.blocks.structural.StructuralBase
 StructuralBase ()
 

Properties

override MaterialType MaterialType [get]
 
override BlockVertexMode VertexMode [get]
 
override BlockRenderMode RenderMode [get]
 
override string MeshResource [get]
 
bool IsOpen [get]
 
override bool Solid [get]
 
override BlockMeshTransform MeshTransformMode [get]
 
virtual bool CanBeDoor [get]
 
virtual bool CanBeHatch [get]
 
virtual bool CanDoorBeInvisible [get]
 
- Properties inherited from pluginbase.Objects.World.Blocks.BlockBase
virtual ushort Id [get]
 Rotating hash algorithm for max permutation From: http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx More...
 
string InternalName [get]
 Internal name from the attribute More...
 
bool Renderable [get]
 Determines whether or not the block is visible More...
 
virtual BlockTextureMode TextureMode [get]
 
virtual BlockRenderMode RenderMode [get]
 
virtual BlockVertexMode VertexMode [get]
 
virtual BlockAnimationMode AnimationMode [get]
 
virtual float Transparency [get]
 
virtual int TextureStretch [get]
 
virtual string MeshResource [get]
 
virtual Matrix4 MeshTransform [get]
 
virtual BlockMeshTransform MeshTransformMode [get]
 
virtual BlockMeshLodMode MeshLodMode [get]
 
virtual int MeshLodDistance [get]
 
virtual int MeshLodSkipMultiplier [get]
 
virtual string IconResource [get]
 
virtual BlockIconMode IconMode [get]
 
virtual bool HasFog [get]
 
virtual Rgba FogColor [get]
 
virtual float FogDensity [get]
 
virtual bool EmitsLight [get]
 
virtual Rgba EmitColor [get]
 
virtual float EmitRadius [get]
 
virtual bool EmitIsDirectional [get]
 
virtual Vector3 EmitDirection [get]
 
virtual float EmitDirectionFocus [get]
 
virtual bool HasParticleSystem [get]
 
virtual int ParticleSystemViewDistance [get]
 
virtual string ParticleSystemScript [get]
 
virtual bool Destructable [get]
 
virtual bool Solid [get]
 
virtual double FrictionRatio [get]
 
virtual double FallDamageRatio [get]
 
virtual double SpeedLimit [get]
 
virtual double SpeedMultiplier [get]
 
virtual int DamageInfliction [get]
 
virtual double BounceRatio [get]
 
virtual bool Climbable [get]
 
virtual bool Sloped [get]
 
virtual bool IsLiquid [get]
 
virtual float FluidDensity [get]
 
virtual BlockPermeableMode FluidPermeableMode [get]
 
virtual Vector3d GravityMultiplier [get]
 
virtual Vector3d GravityConstant [get]
 
virtual bool HasPhysics [get]
 
virtual bool PhysicsAutoStart [get]
 
virtual TimeSpan PhysicsFrequency [get]
 
virtual SoundDescriptor SoundAmbient [get]
 
virtual SoundDescriptor SoundWalk [get]
 
virtual SoundDescriptor SoundFall [get]
 
virtual SoundDescriptor SoundBreak [get]
 
virtual SoundDescriptor SoundPlace [get]
 
virtual SoundDescriptor SoundInteract [get]
 
virtual float MaterialDensity [get]
 
abstract MaterialType MaterialType [get]
 
abstract string Name [get]
 
abstract string TextureResource [get]
 
- Properties inherited from pluginbase.Objects.World.Blocks.IBlock
string Name [get]
 Display name More...
 
string InternalName [get]
 Name of the block internally (Usually defined by the attribute) More...
 
ushort Id [get]
 Id that represent the block type (usually hash of InternalName) More...
 
bool Renderable [get]
 Renderable, aka visible More...
 
BlockTextureMode TextureMode [get]
 Render mode for the block (mostly relates to texturing) More...
 
BlockRenderMode RenderMode [get]
 Defines how the faces of the block get rendered, and by what rules More...
 
BlockVertexMode VertexMode [get]
 Vertex mode of the rendered block More...
 
BlockAnimationMode AnimationMode [get]
 Gets the animation mode. More...
 
float Transparency [get]
 Amount of transparency More...
 
string TextureResource [get]
 Texture file that represents the image starting at the "content/textures/" root More...
 
int TextureStretch [get]
 Number of blocks the texture stretches (default 1). Needs rendermode stretch More...
 
BlockMeshTransform MeshTransformMode [get]
 Gets the mesh render mode More...
 
BlockMeshLodMode MeshLodMode [get]
 Gets the LOD mode for the mesh More...
 
int MeshLodDistance [get]
 Distance, in lod-levels, until the lod mode is applied More...
 
int MeshLodSkipMultiplier [get]
 Multiplying factor for how many tris to skip per lod level More...
 
string MeshResource [get]
 Gets the mesh resource. More...
 
Matrix4 MeshTransform [get]
 Gets the mesh transform matrix More...
 
string IconResource [get]
 Resolved resource path to an icon representing the block More...
 
BlockIconMode IconMode [get]
 Gets the icon mode for how the resoruce is rendered More...
 
bool Destructable [get]
 Am I destructable More...
 
bool Solid [get]
 Is the block solid, that is, does it have collision More...
 
double FrictionRatio [get]
 The friction applied to walking on/through the block when slowing/stopping Normal is 1f More...
 
double FallDamageRatio [get]
 The amount of fall damage taken by falling on (normal is 1f) More...
 
double SpeedLimit [get]
 Speed limit going through the block. Normal is no limit More...
 
double SpeedMultiplier [get]
 Gets the speed multiplier. More...
 
int DamageInfliction [get]
 Amount of damage points inflicted by touching. A person is 100 damage Default 0 More...
 
double BounceRatio [get]
 When falling on this block, bounce this much. 1f is equal height as fallen Default 0 More...
 
bool Climbable [get]
 Can the block be climbed More...
 
bool Sloped [get]
 Should the block be considered to be sloped More...
 
bool IsLiquid [get]
 Gets a value indicating whether this instance is liquid. More...
 
float FluidDensity [get]
 Affects several aspects with fluids/gasses 1) Lighter density liquids will float to the top 2) Higher densities will retrict movement (i.e. sink into, or be solid) Default 0.0; More...
 
BlockPermeableMode FluidPermeableMode [get]
 Gets how this block reacts to fluids More...
 
Vector3d GravityMultiplier [get]
 Gets the gravity multiplier to affect existing gravity More...
 
Vector3d GravityConstant [get]
 Gets the gravity constant, to supply its own gravity More...
 
bool HasPhysics [get]
 Does the block have any physics (mostly for optimization) This is weather the block will actually fall/move, not whether physics is applied to entities More...
 
bool PhysicsAutoStart [get]
 Gets a value indicating whether this pluginbase.Objects.World.Blocks.IBlock physics auto starts, triggering on world-gen rather than interaction More...
 
TimeSpan PhysicsFrequency [get]
 Gets the physics delay, which is how often physics will be applied More...
 
bool HasFog [get]
 When viewport is inside block, do we alter fog (i.e. underwater) Default false More...
 
Rgba FogColor [get]
 Return a 4-tuple of fog color (RGBA) More...
 
float FogDensity [get]
 Density of the fog More...
 
bool EmitsLight [get]
 Does the block emit light More...
 
Rgba EmitColor [get]
 Emittance color More...
 
float EmitRadius [get]
 Gets the light radius of the light More...
 
bool EmitIsDirectional [get]
 Gets a value indicating whether this pluginbase.Objects.World.Blocks.IBlock emit is directional. More...
 
Vector3 EmitDirection [get]
 Gets the emit direction. More...
 
float EmitDirectionFocus [get]
 Gets the emit direction focus. More...
 
string ParticleSystemScript [get]
 Resolved path to a particle script More...
 
bool HasParticleSystem [get]
 Gets a value indicating whether this instance has particle system. More...
 
int ParticleSystemViewDistance [get]
 Gets the max distance we can view the particle system from More...
 
SoundDescriptor SoundAmbient [get]
 Ambient sound the block makes by existing More...
 
SoundDescriptor SoundWalk [get]
 Sound of walking on the block (or moving through, in case of water) More...
 
SoundDescriptor SoundFall [get]
 Sound for falling on block More...
 
SoundDescriptor SoundPlace [get]
 Sound when placing block More...
 
SoundDescriptor SoundBreak [get]
 Sound when breaking block More...
 
SoundDescriptor SoundInteract [get]
 Sound when interacting with block More...
 
float MaterialDensity [get]
 Gets the material density; aka its weight per cubic block More...
 
MaterialType MaterialType [get]
 Gets the type of the material. More...
 
- Properties inherited from essentials.blocks.structural.Doors.IDoor
bool IsOpen [get]
 True if the door is considered open More...
 

Additional Inherited Members

- Protected Attributes inherited from essentials.blocks.structural.StructuralBase
readonly IResourceResolver ResourceResolver
 

Detailed Description

Class to be used for flip-floppable blocks with interacting with them Mainly focused on doors

Type Constraints
TOpened :DoorBase 
TOpened :TOpened 
TOpened :TClosed 
TClosed :DoorBase 
TClosed :TOpened 
TClosed :TClosed 

Constructor & Destructor Documentation

essentials.blocks.structural.Doors.DoorBase< TOpened, TClosed >.DoorBase ( )
protected
17  {
18  }

Member Function Documentation

void essentials.blocks.structural.Doors.DoorBase< TOpened, TClosed >.CloseDoor ( IWorld  world,
Vector3i  pt 
)

Close door at a given position

Parameters
worldWorld.
ptPoint.

Implements essentials.blocks.structural.Doors.IDoor.

169  {
170  this.CascadeSwitch(world, pt, false);
171  }
override Matrix4 essentials.blocks.structural.Doors.DoorBase< TOpened, TClosed >.GetDynamicMeshTransform ( IWorldReadonly  world,
Vector3i  pos 
)
virtual

Gets the dynamic mesh transform.

Returns
The dynamic mesh transform.
Parameters
worldWorld.
posPosition.

Reimplemented from pluginbase.Objects.World.Blocks.BlockBase.

89  {
90  var left = world.GetIBlock(pos.X - 1, pos.Y, pos.Z);
91  var right = world.GetIBlock(pos.X + 1, pos.Y, pos.Z);
92  var bottom = world.GetIBlock(pos.X, pos.Y - 1, pos.Z);
93  var top = world.GetIBlock(pos.X, pos.Y + 1, pos.Z);
94 
95  if (!IsOpen)
96  {
97  if (CanBeHatch && right.Solid && left.Solid && bottom.Solid && top.Solid)
98  {
99  return DoorBaseTransforms.HATCH_UP;
100  }
101 
102  if (CanBeDoor)
103  {
104  if (right.Solid || left.Solid)
105  {
106  return DoorBaseTransforms.ALIGN_X;
107  }
108 
109  if (top.Solid || bottom.Solid)
110  {
111  return DoorBaseTransforms.ALIGN_Y;
112  }
113  }
114  }
115  else
116  {
117  if (CanBeHatch && left.Solid && right.Solid && bottom.Solid && top.Solid)
118  {
119  return DoorBaseTransforms.HATCH_OPEN;
120  }
121 
122  if (CanBeDoor)
123  {
124  if (left.Solid && !(left is IDoor))
125  {
126  return DoorBaseTransforms.FLATTEN_X_LEFT;
127  }
128 
129  if (right.Solid && !(right is IDoor))
130  {
131  return DoorBaseTransforms.FLATTEN_X_RIGHT;
132  }
133 
134  if (bottom.Solid && !(bottom is IDoor))
135  {
136  return DoorBaseTransforms.FLATTEN_Y_BOTTOM;
137  }
138 
139  if (top.Solid && !(top is IDoor))
140  {
141  return DoorBaseTransforms.FLATTEN_Y_TOP;
142  }
143 
144  if (CanDoorBeInvisible)
145  return Matrix4.CreateScale(0f, 0f, 0f); //magic :)
146  }
147  }
148 
149  return CanBeHatch ? DoorBaseTransforms.HATCH_DOWN : DoorBaseTransforms.ALIGN_X;
150  }
IBlock GetIBlock(int x, int y, int z)
Get the block properties at a position
virtual bool CanDoorBeInvisible
Definition: DoorBase.cs:84
int Y
The Y coordinate
Definition: Vector3i.cs:23
int X
The X coordinate
Definition: Vector3i.cs:18
int Z
The Z coordinate
Definition: Vector3i.cs:28
bool essentials.blocks.structural.Doors.DoorBase< TOpened, TClosed >.Interact ( IWorld  world,
Vector3i  pos 
)

Implements pluginbase.Objects.World.Blocks.IBlockInteractable.

201  {
202  this.ToggleDoor(world, pos);
203  return true;
204  }
void ToggleDoor(IWorld world, Vector3i pt)
Toggle the door at a given position
Definition: DoorBase.cs:154
void essentials.blocks.structural.Doors.DoorBase< TOpened, TClosed >.OpenDoor ( IWorld  world,
Vector3i  pt 
)

Open door at a given position

Parameters
worldWorld.
ptPoint.

Implements essentials.blocks.structural.Doors.IDoor.

164  {
165  this.CascadeSwitch(world, pt, true);
166  }
void essentials.blocks.structural.Doors.DoorBase< TOpened, TClosed >.ToggleDoor ( IWorld  world,
Vector3i  pt 
)

Toggle the door at a given position

Parameters
worldWorld.
ptPoint.

Implements essentials.blocks.structural.Doors.IDoor.

155  {
156  var block = world.GetIBlock(pt);
157  if (block is TOpened)
158  this.CloseDoor(world, pt);
159  else if (block is TClosed)
160  this.OpenDoor(world, pt);
161  }
IBlock GetIBlock(int x, int y, int z)
Get the block properties at a position
void CloseDoor(IWorld world, Vector3i pt)
Close door at a given position
Definition: DoorBase.cs:168
void OpenDoor(IWorld world, Vector3i pt)
Open door at a given position
Definition: DoorBase.cs:163

Property Documentation

virtual bool essentials.blocks.structural.Doors.DoorBase< TOpened, TClosed >.CanBeDoor
getprotected
virtual bool essentials.blocks.structural.Doors.DoorBase< TOpened, TClosed >.CanBeHatch
getprotected
virtual bool essentials.blocks.structural.Doors.DoorBase< TOpened, TClosed >.CanDoorBeInvisible
getprotected
bool essentials.blocks.structural.Doors.DoorBase< TOpened, TClosed >.IsOpen
get
override MaterialType essentials.blocks.structural.Doors.DoorBase< TOpened, TClosed >.MaterialType
get
override string essentials.blocks.structural.Doors.DoorBase< TOpened, TClosed >.MeshResource
get
override BlockMeshTransform essentials.blocks.structural.Doors.DoorBase< TOpened, TClosed >.MeshTransformMode
get
override BlockRenderMode essentials.blocks.structural.Doors.DoorBase< TOpened, TClosed >.RenderMode
get
override bool essentials.blocks.structural.Doors.DoorBase< TOpened, TClosed >.Solid
get
override BlockVertexMode essentials.blocks.structural.Doors.DoorBase< TOpened, TClosed >.VertexMode
get

The documentation for this class was generated from the following file: