2010-09-11 20:14:36 +00:00
|
|
|
|
#region === Copyright (c) 2010 Pascal van der Heiden ===
|
|
|
|
|
|
|
|
|
|
using CodeImp.DoomBuilder.Map;
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
2012-11-27 21:12:20 +00:00
|
|
|
|
namespace CodeImp.DoomBuilder.BuilderModes
|
2010-09-11 20:14:36 +00:00
|
|
|
|
{
|
|
|
|
|
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;
|
2010-09-13 06:07:11 +00:00
|
|
|
|
|
|
|
|
|
// 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);
|
|
|
|
|
}
|
2010-09-11 20:14:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 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)
|
|
|
|
|
{
|
2015-07-28 15:04:21 +00:00
|
|
|
|
if(s.Tags.Contains(thing.Args[0]))
|
2010-09-11 20:14:36 +00:00
|
|
|
|
{
|
|
|
|
|
sourcesector = s;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(sourcesector != null)
|
|
|
|
|
{
|
|
|
|
|
SectorData sourcesectordata = data.Mode.GetSectorData(sourcesector);
|
|
|
|
|
if(!sourcesectordata.Updated) sourcesectordata.Update();
|
|
|
|
|
|
2015-12-28 15:01:53 +00:00
|
|
|
|
switch(thing.Type)
|
2010-09-11 20:14:36 +00:00
|
|
|
|
{
|
2015-07-15 09:09:47 +00:00
|
|
|
|
case 9510:
|
|
|
|
|
data.Floor.plane = sourcesectordata.Floor.plane;
|
|
|
|
|
break;
|
|
|
|
|
case 9511:
|
|
|
|
|
data.Ceiling.plane = sourcesectordata.Ceiling.plane;
|
|
|
|
|
break;
|
2010-09-11 20:14:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sourcesectordata.AddUpdateSector(data.Sector, true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|