Class GhostCollisionFootprintTileCheckRule
- Namespace
- MoonBark.GridPlacement.Godot.Placement.PlacementRules
- Assembly
- MoonBark.GridPlacement.Godot.dll
Rule that checks if a ghost collision footprint overlaps with existing tiles. Used to prevent overlapping placements during the ghost/preview phase.
[GlobalClass]
[ScriptPath("res://addons/grid_placement/placement/placement_rules/GhostCollisionFootprintTileCheckRule.cs")]
public class GhostCollisionFootprintTileCheckRule : TileCheckRule, IDisposable
- Inheritance
-
GodotObjectRefCountedResourceGhostCollisionFootprintTileCheckRule
- Implements
- Inherited Members
-
Resource._GetRid()Resource._ResetState()Resource._SetupLocalToScene()Resource.GetRid()Resource.GetLocalScene()Resource.SetupLocalToScene()Resource.ResetState()Resource.IsBuiltIn()Resource.GenerateSceneUniqueId()Resource.EmitChanged()Resource.EmitSignalChanged()Resource.EmitSignalSetupLocalToSceneRequested()Resource.InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)Resource.HasGodotClassMethod(in godot_string_name)Resource.HasGodotClassSignal(in godot_string_name)Resource.ResourceLocalToSceneResource.ResourcePathResource.ResourceNameResource.ResourceSceneUniqueIdResource.ChangedResource.SetupLocalToSceneRequestedRefCounted.InitRef()RefCounted.Reference()RefCounted.Unreference()RefCounted.GetReferenceCount()GodotObject.NotificationPostinitializeGodotObject.NotificationPredeleteGodotObject.NotificationExtensionReloadedGodotObject.IsInstanceValid(GodotObject)GodotObject.WeakRef(GodotObject)GodotObject.Dispose()GodotObject.ToString()GodotObject.ToSignal(GodotObject, StringName)GodotObject._Get(StringName)GodotObject._GetPropertyList()GodotObject._IterGet(Variant)GodotObject._IterInit(Array)GodotObject._IterNext(Array)GodotObject._PropertyCanRevert(StringName)GodotObject._PropertyGetRevert(StringName)GodotObject._Set(StringName, Variant)GodotObject._ValidateProperty(Dictionary)GodotObject.Free()GodotObject.GetClass()GodotObject.Set(StringName, Variant)GodotObject.Get(StringName)GodotObject.SetIndexed(NodePath, Variant)GodotObject.GetIndexed(NodePath)GodotObject.GetPropertyList()GodotObject.GetMethodList()GodotObject.PropertyCanRevert(StringName)GodotObject.PropertyGetRevert(StringName)GodotObject.GetInstanceId()GodotObject.SetScript(Variant)GodotObject.GetScript()GodotObject.SetMeta(StringName, Variant)GodotObject.RemoveMeta(StringName)GodotObject.GetMeta(StringName, Variant)GodotObject.HasMeta(StringName)GodotObject.GetMetaList()GodotObject.HasUserSignal(StringName)GodotObject.RemoveUserSignal(StringName)GodotObject.EmitSignal(StringName, params Variant[])GodotObject.Call(StringName, params Variant[])GodotObject.CallDeferred(StringName, params Variant[])GodotObject.SetDeferred(StringName, Variant)GodotObject.Callv(StringName, Array)GodotObject.HasMethod(StringName)GodotObject.GetMethodArgumentCount(StringName)GodotObject.HasSignal(StringName)GodotObject.GetSignalList()GodotObject.GetSignalConnectionList(StringName)GodotObject.GetIncomingConnections()GodotObject.Disconnect(StringName, Callable)GodotObject.IsConnected(StringName, Callable)GodotObject.HasConnections(StringName)GodotObject.IsBlockingSignals()GodotObject.NotifyPropertyListChanged()GodotObject.CanTranslateMessages()GodotObject.Tr(StringName, StringName)GodotObject.GetTranslationDomain()GodotObject.SetTranslationDomain(StringName)GodotObject.IsQueuedForDeletion()GodotObject.CancelFree()GodotObject.EmitSignalScriptChanged()GodotObject.EmitSignalPropertyListChanged()GodotObject.NativeInstanceGodotObject.ScriptChangedGodotObject.PropertyListChanged
Constructors
GhostCollisionFootprintTileCheckRule()
Creates a new GhostCollisionFootprintTileCheckRule with default values.
public GhostCollisionFootprintTileCheckRule()
Properties
FootprintLayers
Collision layer mask for the ghost footprint query.
[Export(PropertyHint.None, "")]
public uint FootprintLayers { get; set; }
Property Value
ValidationLayer
Collision layer mask for validation - determines what the rule considers "solid".
[Export(PropertyHint.None, "")]
public uint ValidationLayer { get; set; }
Property Value
Methods
CacheGhostFootprint(int, List<CoreVector2I>)
Caches a ghost footprint for a given ghost entity ID.
public void CacheGhostFootprint(int ghostId, List<CoreVector2I> tiles)
Parameters
ghostIdintThe ghost entity ID.
tilesList<CoreVector2I>The list of grid positions occupied by the ghost footprint.
CheckPosition(Vector2, PhysicsDirectSpaceState2D)
Checks if the given world position passes this tile check rule. For GhostCollisionFootprintTileCheckRule, this uses IntersectShape to check if the ghost footprint overlaps with any existing geometry.
public override bool CheckPosition(Vector2 worldPosition, PhysicsDirectSpaceState2D spaceState)
Parameters
worldPositionVector2The world position to check.
spaceStatePhysicsDirectSpaceState2DThe physics direct space state to query against.
Returns
- bool
True if no overlap is detected (placement is valid); false if overlap exists.
ClearCachedFootprints()
Clears all cached ghost footprints.
public void ClearCachedFootprints()
GetGhostFootprintTiles(int)
Gets the cached ghost footprint tiles for a given ghost entity ID.
public List<CoreVector2I>? GetGhostFootprintTiles(int ghostId)
Parameters
ghostIdintThe ghost entity ID.
Returns
- List<CoreVector2I>
The list of grid positions, or null if not cached.