2022-01-06 17:46:37 +00:00
|
|
|
`#version 4`;
|
|
|
|
|
2021-11-28 13:00:24 +00:00
|
|
|
`#name Make Door`;
|
|
|
|
|
|
|
|
`#description Creates a door from a selected sector. Functionality is the same as the built-in "make door" action.`;
|
|
|
|
|
|
|
|
`#scriptoptions
|
|
|
|
|
|
|
|
doortexture {
|
|
|
|
description = "Door texture";
|
|
|
|
default = "BIGDOOR2";
|
|
|
|
type = 6;
|
|
|
|
}
|
|
|
|
|
|
|
|
doortrack {
|
|
|
|
description = "Door track texture";
|
|
|
|
default = "DOORTRAK";
|
|
|
|
type = 6;
|
|
|
|
}
|
|
|
|
|
|
|
|
ceilingtexture {
|
|
|
|
description = "Door ceiling texture";
|
|
|
|
default = "FLAT20";
|
|
|
|
type = 7;
|
|
|
|
}
|
|
|
|
|
|
|
|
`;
|
|
|
|
|
2022-01-06 17:46:37 +00:00
|
|
|
let sectors = UDB.Map.getSelectedOrHighlightedSectors();
|
2021-11-28 13:00:24 +00:00
|
|
|
|
|
|
|
if(sectors.length == 0)
|
2022-01-06 17:46:37 +00:00
|
|
|
UDB.die('You need to select at least one sector!');
|
2021-11-28 13:00:24 +00:00
|
|
|
|
|
|
|
sectors.forEach(s => {
|
|
|
|
s.ceilingHeight = s.floorHeight;
|
2022-01-06 17:46:37 +00:00
|
|
|
s.ceilingTexture = UDB.ScriptOptions.ceilingtexture;
|
2021-11-28 13:00:24 +00:00
|
|
|
|
|
|
|
s.getSidedefs().forEach(sd => {
|
|
|
|
if(sd.other == null) // 1-sided lines
|
|
|
|
{
|
2022-01-06 17:46:37 +00:00
|
|
|
sd.middleTexture = UDB.ScriptOptions.doortrack;
|
2021-11-28 13:00:24 +00:00
|
|
|
|
2022-01-06 17:46:37 +00:00
|
|
|
if(UDB.Map.isUDMF)
|
2021-11-28 13:00:24 +00:00
|
|
|
sd.line.flags.dontpegbottom = true;
|
|
|
|
else
|
|
|
|
sd.line.flags['16'] = true;
|
|
|
|
}
|
|
|
|
else // 2-sided lines
|
|
|
|
{
|
|
|
|
// If the sidedef is on the front of the linedef we need to flip the linedef
|
|
|
|
// so that the line can be activated properly
|
|
|
|
if(sd.isFront)
|
|
|
|
sd.line.flip();
|
|
|
|
|
2022-01-06 17:46:37 +00:00
|
|
|
sd.other.upperTexture = UDB.ScriptOptions.doortexture;
|
2021-11-28 13:00:24 +00:00
|
|
|
|
|
|
|
// Set the action
|
2022-01-06 17:46:37 +00:00
|
|
|
if(UDB.Map.isDoom)
|
2021-11-28 13:00:24 +00:00
|
|
|
sd.line.action = 1;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sd.line.action = 12;
|
|
|
|
sd.line.args[0] = 0; // Tag
|
|
|
|
sd.line.args[1] = 16; // Speed
|
|
|
|
sd.line.args[2] = 150; // Close delay
|
|
|
|
sd.line.args[3] = 0; // Light tag
|
|
|
|
|
2022-01-06 17:46:37 +00:00
|
|
|
if(UDB.Map.isHexen)
|
2021-11-28 13:00:24 +00:00
|
|
|
{
|
|
|
|
sd.line.activate = 1024; // Player presses use
|
|
|
|
sd.line.flags['512'] = true; // Can be used repeatedly
|
|
|
|
sd.line.flags['8192'] = true; // Can be activated by monsters
|
|
|
|
}
|
|
|
|
else // UDMF
|
|
|
|
{
|
|
|
|
sd.line.flags.repeatspecial = true;
|
|
|
|
sd.line.flags.playeruse = true;
|
|
|
|
sd.line.flags.monsteruse = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|