fix: Doors with KeyRequired=1 cannot be unlocked
This commit is contained in:
parent
351f342a8f
commit
62b3f73941
4 changed files with 15 additions and 5 deletions
|
@ -309,13 +309,16 @@ void ActionExecutor::executeOpenLock(const shared_ptr<Object> &actor, ObjectActi
|
||||||
creatureActor->face(*door);
|
creatureActor->face(*door);
|
||||||
creatureActor->playAnimation(AnimationType::LoopingUnlockDoor);
|
creatureActor->playAnimation(AnimationType::LoopingUnlockDoor);
|
||||||
|
|
||||||
door->setLocked(false);
|
if (!door->isKeyRequired()) {
|
||||||
door->open(actor);
|
door->setLocked(false);
|
||||||
|
door->open(actor);
|
||||||
|
|
||||||
string onOpen(door->getOnOpen());
|
string onOpen(door->getOnOpen());
|
||||||
if (!onOpen.empty()) {
|
if (!onOpen.empty()) {
|
||||||
_game->scriptRunner().run(onOpen, door->id(), actor->id());
|
_game->scriptRunner().run(onOpen, door->id(), actor->id());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
action.complete();
|
action.complete();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -56,6 +56,7 @@ void DoorBlueprint::load(Door &door) {
|
||||||
door._locked = _utd->getBool("Locked");
|
door._locked = _utd->getBool("Locked");
|
||||||
door._genericType = _utd->getInt("GenericType");
|
door._genericType = _utd->getInt("GenericType");
|
||||||
door._static = _utd->getBool("Static");
|
door._static = _utd->getBool("Static");
|
||||||
|
door._keyRequired = _utd->getBool("KeyRequired");
|
||||||
door._minOneHP = _utd->getBool("Min1HP");
|
door._minOneHP = _utd->getBool("Min1HP");
|
||||||
door._hitPoints = _utd->getInt("HP");
|
door._hitPoints = _utd->getInt("HP");
|
||||||
door._currentHitPoints = _utd->getInt("CurrentHP");
|
door._currentHitPoints = _utd->getInt("CurrentHP");
|
||||||
|
|
|
@ -113,6 +113,10 @@ bool Door::isStatic() const {
|
||||||
return _static;
|
return _static;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Door::isKeyRequired() const {
|
||||||
|
return _keyRequired;
|
||||||
|
}
|
||||||
|
|
||||||
const string &Door::getOnOpen() const {
|
const string &Door::getOnOpen() const {
|
||||||
return _onOpen;
|
return _onOpen;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@ public:
|
||||||
bool isLockable() const;
|
bool isLockable() const;
|
||||||
bool isLocked() const;
|
bool isLocked() const;
|
||||||
bool isStatic() const;
|
bool isStatic() const;
|
||||||
|
bool isKeyRequired() const;
|
||||||
|
|
||||||
const std::string &getOnOpen() const;
|
const std::string &getOnOpen() const;
|
||||||
const std::string &getOnFailToOpen() const;
|
const std::string &getOnFailToOpen() const;
|
||||||
|
@ -60,6 +61,7 @@ private:
|
||||||
bool _locked { false };
|
bool _locked { false };
|
||||||
int _genericType { 0 };
|
int _genericType { 0 };
|
||||||
bool _static { false };
|
bool _static { false };
|
||||||
|
bool _keyRequired { false };
|
||||||
std::string _linkedToModule;
|
std::string _linkedToModule;
|
||||||
std::string _linkedTo;
|
std::string _linkedTo;
|
||||||
std::string _transitionDestin;
|
std::string _transitionDestin;
|
||||||
|
|
Loading…
Reference in a new issue