800 |
} |
} |
801 |
|
|
802 |
//---------------------------------------- |
//---------------------------------------- |
|
// Sensor. |
|
|
//---------------------------------------- |
|
|
namespace |
|
|
{ |
|
|
class Sensor : public Item { |
|
|
CLONEOBJ(Sensor); |
|
|
|
|
|
void actor_enter(Actor *) { |
|
|
PerformAction (this, true); |
|
|
} |
|
|
void actor_leave(Actor *) { |
|
|
PerformAction (this, false); |
|
|
} |
|
|
|
|
|
public: |
|
|
Sensor() : Item ("it-sensor") { |
|
|
set_attrib ("delay", 0.0); |
|
|
set_attrib ("action", "signal"); |
|
|
} |
|
|
}; |
|
|
} |
|
|
|
|
|
//---------------------------------------- |
|
803 |
// Trigger. |
// Trigger. |
804 |
//---------------------------------------- |
//---------------------------------------- |
805 |
namespace |
namespace |
1546 |
} |
} |
1547 |
|
|
1548 |
//---------------------------------------- |
//---------------------------------------- |
1549 |
|
// Bridge item (for Oxyd compatibility) |
1550 |
|
// |
1551 |
|
// Floor tiles seem to be static in Oxyd and cannot change dynamically |
1552 |
|
// or be animated. For this reason, every bridge floor in Oxyd has to |
1553 |
|
// be combined with a bridge "item" that receives the signals, shows |
1554 |
|
// the animation and sets or removes the floor. |
1555 |
|
//---------------------------------------- |
1556 |
|
namespace |
1557 |
|
{ |
1558 |
|
class OxydBridge : public Item { |
1559 |
|
CLONEOBJ(OxydBridge); |
1560 |
|
public: |
1561 |
|
OxydBridge() : Item ("it-bridge-oxyd") {} |
1562 |
|
|
1563 |
|
void message(const string& msg, const Value &val) { |
1564 |
|
if (msg == "signal") { |
1565 |
|
int ival = to_int (val); |
1566 |
|
printf ("value %d\n", ival); |
1567 |
|
Floor *floor = GetFloor (get_pos()); |
1568 |
|
if (ival > 0) |
1569 |
|
SendMessage (floor, "close"); |
1570 |
|
else |
1571 |
|
SendMessage (floor, "open"); |
1572 |
|
} |
1573 |
|
} |
1574 |
|
bool actor_hit(Actor */*a*/) { return false; } |
1575 |
|
}; |
1576 |
|
} |
1577 |
|
|
1578 |
|
//---------------------------------------- |
1579 |
|
// Sensors |
1580 |
|
//---------------------------------------- |
1581 |
|
namespace |
1582 |
|
{ |
1583 |
|
class Sensor : public Item { |
1584 |
|
CLONEOBJ(Sensor); |
1585 |
|
public: |
1586 |
|
Sensor() : Item ("it-sensor") {} |
1587 |
|
|
1588 |
|
bool actor_hit (Actor *) { |
1589 |
|
PerformAction (this, true); |
1590 |
|
return false; |
1591 |
|
} |
1592 |
|
}; |
1593 |
|
|
1594 |
|
class InverseSensor : public Item { |
1595 |
|
CLONEOBJ(InverseSensor); |
1596 |
|
public: |
1597 |
|
InverseSensor() : Item ("it-inversesensor") {} |
1598 |
|
|
1599 |
|
bool actor_hit (Actor *) { |
1600 |
|
PerformAction (this, false); |
1601 |
|
return false; |
1602 |
|
} |
1603 |
|
}; |
1604 |
|
} |
1605 |
|
|
1606 |
|
//---------------------------------------- |
1607 |
// Remaining items (still need to be implemented) |
// Remaining items (still need to be implemented) |
1608 |
//---------------------------------------- |
//---------------------------------------- |
1609 |
namespace |
namespace |
1687 |
Register(new Blocker(false)); |
Register(new Blocker(false)); |
1688 |
Register("it-blocker-new", new Blocker(true)); |
Register("it-blocker-new", new Blocker(true)); |
1689 |
Register(new Dummyitem); |
Register(new Dummyitem); |
1690 |
|
Register (new OxydBridge); |
1691 |
|
Register (new Sensor); |
1692 |
|
Register (new InverseSensor); |
1693 |
} |
} |