UltimateZoneBuilder/Source/Plugins/BuilderModes/VisualModes/EffectCopySlope.cs
MaxED 3a35b7603a Fixed, Map Analysis mode, "Check stuck things" check: rewritten parts of the flags checking logic to allow more accurate flag checks.
Fixed, Map Analysis mode: fixed a crash when trying to dissolve an invalid sector when one of it's linedefs referenced it on the both sides.
Fixed, Sectors mode: fixed incorrect undo description when deleting sectors.
Internal: joined declaration and assignment of some more variables.
2015-12-28 15:01:53 +00:00

62 lines
1.5 KiB
C#

#region === Copyright (c) 2010 Pascal van der Heiden ===
using CodeImp.DoomBuilder.Map;
#endregion
namespace CodeImp.DoomBuilder.BuilderModes
{
internal class EffectCopySlope : SectorEffect
{
// Thing used to create this effect
// The thing is in the sector that must receive the slope and the
// Thing's arg 0 indicates the sector to copy the slope from.
private Thing thing;
// Constructor
public EffectCopySlope(SectorData data, Thing sourcething) : base(data)
{
thing = sourcething;
// New effect added: This sector needs an update!
if(data.Mode.VisualSectorExists(data.Sector))
{
BaseVisualSector vs = (BaseVisualSector)data.Mode.GetVisualSector(data.Sector);
vs.UpdateSectorGeometry(true);
}
}
// This makes sure we are updated with the source linedef information
public override void Update()
{
// Find tagged sector
Sector sourcesector = null;
foreach(Sector s in General.Map.Map.Sectors)
{
if(s.Tags.Contains(thing.Args[0]))
{
sourcesector = s;
break;
}
}
if(sourcesector != null)
{
SectorData sourcesectordata = data.Mode.GetSectorData(sourcesector);
if(!sourcesectordata.Updated) sourcesectordata.Update();
switch(thing.Type)
{
case 9510:
data.Floor.plane = sourcesectordata.Floor.plane;
break;
case 9511:
data.Ceiling.plane = sourcesectordata.Ceiling.plane;
break;
}
sourcesectordata.AddUpdateSector(data.Sector, true);
}
}
}
}