Cleanup of new gate code. Added messages when a gate fails due to location disabled. Modified the call to home lua to work as expected.

This commit is contained in:
devn00b 2022-06-18 12:31:13 -07:00
parent c095bd9b2d
commit d7caa38cd3
3 changed files with 15 additions and 4 deletions

View file

@ -4479,8 +4479,10 @@ int EQ2Emu_lua_IsGateAllowed(lua_State* state) {
if (spawn) {
if (spawn->IsPlayer()) {
Client* client = spawn->GetZone()->GetClientBySpawn(spawn);
if (client)
ret = client->GateAllowed();
ZoneServer* zone = lua_interface->GetZone(state);
if (client && zone){
ret = zone->GetCanGate();
}
}
}
lua_interface->SetBooleanValue(state, ret);

View file

@ -8352,8 +8352,8 @@ void Client::ResetSendMail(bool cancel, bool needslock) {
bool Client::GateAllowed() {
ZoneServer* zone = GetCurrentZone();
bool cangate = zone->GetCanGate();
if (zone){
bool cangate = zone->GetCanGate();
return cangate;
}

View file

@ -9,10 +9,19 @@
-- Teleports you to your recall point.
function precast(Caster, Target)
if GetBoundZoneID(Caster) == 0 then
SendMessage(Caster, "You are a failure", "red")
return false
end
return true
if(IsGateAllowed(Caster))
then
return true
else
SendMessage(Caster, "You cannot use Call to Home from this location.", "red")
return false
end
return true
end
function cast(Caster, Target)