mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-06-18 06:34:28 +02:00
proper drowning implementation
This commit is contained in:
parent
4a87cd754c
commit
6fff6a868a
@ -24447,27 +24447,27 @@ Attributes = {Waypoints=500}
|
||||
|
||||
TypeID = 5405
|
||||
Name = "ocean floor"
|
||||
Flags = {Bank,Unmove}
|
||||
Flags = {Bank,Unmove,CollisionEvent}
|
||||
Attributes = {Waypoints=500}
|
||||
|
||||
TypeID = 5406
|
||||
Name = "ocean floor"
|
||||
Flags = {Bank,Unmove}
|
||||
Flags = {Bank,Unmove,CollisionEvent}
|
||||
Attributes = {Waypoints=500}
|
||||
|
||||
TypeID = 5407
|
||||
Name = "ocean floor"
|
||||
Flags = {Bank,Unmove}
|
||||
Flags = {Bank,Unmove,CollisionEvent}
|
||||
Attributes = {Waypoints=500}
|
||||
|
||||
TypeID = 5408
|
||||
Name = "ocean floor"
|
||||
Flags = {Bank,Unmove}
|
||||
Flags = {Bank,Unmove,CollisionEvent}
|
||||
Attributes = {Waypoints=500}
|
||||
|
||||
TypeID = 5409
|
||||
Name = "ocean floor"
|
||||
Flags = {Bank,Unmove}
|
||||
Flags = {Bank,Unmove,CollisionEvent}
|
||||
Attributes = {Waypoints=500}
|
||||
|
||||
TypeID = 5410
|
||||
@ -25925,12 +25925,12 @@ Name = "" # this is nothing in client
|
||||
|
||||
TypeID = 5743
|
||||
Name = "wooden floor"
|
||||
Flags = {Bank,Unmove}
|
||||
Flags = {Bank,Unmove,CollisionEvent}
|
||||
Attributes = {Waypoints=500}
|
||||
|
||||
TypeID = 5744
|
||||
Name = "wooden floor"
|
||||
Flags = {Bank,Unmove}
|
||||
Flags = {Bank,Unmove,CollisionEvent}
|
||||
Attributes = {Waypoints=500}
|
||||
|
||||
TypeID = 5745
|
||||
@ -26017,7 +26017,7 @@ Attributes = {Waypoints=110}
|
||||
|
||||
TypeID = 5764
|
||||
Name = "a ventilation grille"
|
||||
Flags = {Bank,Unmove}
|
||||
Flags = {Bank,Unmove,CollisionEvent}
|
||||
Attributes = {Waypoints=500}
|
||||
|
||||
TypeID = 5765
|
||||
|
@ -388,8 +388,12 @@
|
||||
<movevent event="StepIn" movementid="237" script="nostalrius/237.lua" />
|
||||
|
||||
<!-- Nostalrius Default Movements -->
|
||||
<movevent event="StepIn" itemid="5404" script="misc/drowning.lua" />
|
||||
<movevent event="StepOut" itemid="5404" script="misc/drowning.lua"/>
|
||||
<movevent event="StepIn" fromid="5404" toid="5409" script="misc/drowning.lua" />
|
||||
<movevent event="StepOut" fromid="5404" toid="5409" script="misc/drowning.lua"/>
|
||||
<movevent event="StepIn" fromid="5743" toid="5744" script="misc/drowning.lua" />
|
||||
<movevent event="StepOut" fromid="5743" toid="5744" script="misc/drowning.lua"/>
|
||||
<movevent event="StepIn" itemid="5764" script="misc/drowning.lua" />
|
||||
<movevent event="StepOut" itemid="5764" script="misc/drowning.lua"/>
|
||||
|
||||
<!-- Floorchange -->
|
||||
<movevent event="StepIn" itemid="293" script="misc/floorchange.lua" />
|
||||
@ -666,6 +670,10 @@
|
||||
<movevent event="StepIn" itemid="2151" function="onStepInField" />
|
||||
<movevent event="AddItem" itemid="2151" function="onAddField" />
|
||||
|
||||
<!-- Helmets -->
|
||||
<movevent event="Equip" itemid="5460" slot="head" function="onEquipItem" script="misc/helmet_of_the_deep.lua" />
|
||||
<movevent event="DeEquip" itemid="5460" slot="head" function="onDeEquipItem" />
|
||||
|
||||
<!-- Boots -->
|
||||
<movevent event="Equip" itemid="3079" slot="feet" function="onEquipItem" />
|
||||
<movevent event="DeEquip" itemid="3079" slot="feet" function="onDeEquipItem" />
|
||||
|
@ -1,6 +1,5 @@
|
||||
local condition = Condition(CONDITION_DROWN)
|
||||
condition:setParameter(CONDITION_PARAM_HIT_DAMAGE, 20)
|
||||
condition:setTiming(9999)
|
||||
condition:setTiming(5)
|
||||
|
||||
|
||||
function onStepIn(creature, item, position, fromPosition)
|
||||
@ -9,6 +8,11 @@ function onStepIn(creature, item, position, fromPosition)
|
||||
return true
|
||||
end
|
||||
|
||||
local helmet = player:getSlotItem(CONST_SLOT_HEAD)
|
||||
if helmet ~= nil and helmet:getId() == 5460 then
|
||||
return true
|
||||
end
|
||||
|
||||
if math.random(1, 10) == 1 then
|
||||
position:sendMagicEffect(CONST_ME_BUBBLES)
|
||||
end
|
||||
|
4
data/movements/scripts/misc/helmet_of_the_deep.lua
Normal file
4
data/movements/scripts/misc/helmet_of_the_deep.lua
Normal file
@ -0,0 +1,4 @@
|
||||
function onEquip(player, item, slot)
|
||||
player:removeCondition(CONDITION_DROWN)
|
||||
return true
|
||||
end
|
@ -917,6 +917,13 @@ bool ConditionDamage::executeCondition(Creature* creature, int32_t)
|
||||
return false;
|
||||
}
|
||||
} else if (conditionType == CONDITION_DROWN) {
|
||||
if (isFirstCycle && count - max_count == -2) {
|
||||
doDamage(creature, -20);
|
||||
isFirstCycle = false;
|
||||
count = max_count;
|
||||
return true;
|
||||
}
|
||||
|
||||
const int32_t r_cycle = cycle;
|
||||
if (r_cycle) {
|
||||
if (count <= 0) {
|
||||
|
@ -283,7 +283,7 @@ class ConditionDamage final : public Condition
|
||||
int32_t max_count = 0;
|
||||
int32_t factor_percent = -1;
|
||||
int32_t hit_damage = 0;
|
||||
|
||||
bool isFirstCycle = true;
|
||||
uint32_t owner = 0;
|
||||
|
||||
bool doDamage(Creature* creature, int32_t healthChange);
|
||||
|
@ -1164,6 +1164,7 @@ void Player::onThink(uint32_t interval)
|
||||
addMessageBuffer();
|
||||
}
|
||||
|
||||
lastWalkingTime += interval;
|
||||
if (!getTile()->hasFlag(TILESTATE_NOLOGOUT) && !isAccessPlayer()) {
|
||||
idleTime += interval;
|
||||
const int32_t kickAfterMinutes = g_config.getNumber(ConfigManager::KICK_AFTER_MINUTES);
|
||||
|
14
src/player.h
14
src/player.h
@ -286,6 +286,19 @@ class Player final : public Creature, public Cylinder
|
||||
|
||||
void resetIdleTime() {
|
||||
idleTime = 0;
|
||||
resetLastWalkingTime();
|
||||
}
|
||||
|
||||
int32_t getIdleTime() const {
|
||||
return idleTime;
|
||||
}
|
||||
|
||||
void resetLastWalkingTime() {
|
||||
lastWalkingTime = 0;
|
||||
}
|
||||
|
||||
int32_t getLastWalkingTime() const {
|
||||
return lastWalkingTime;
|
||||
}
|
||||
|
||||
bool isInGhostMode() const {
|
||||
@ -1045,6 +1058,7 @@ class Player final : public Creature, public Cylinder
|
||||
int32_t bloodHitCount = 0;
|
||||
int32_t shieldBlockCount = 0;
|
||||
int32_t idleTime = 0;
|
||||
int32_t lastWalkingTime = 0;
|
||||
|
||||
uint16_t staminaMinutes = 3360;
|
||||
uint16_t maxWriteLen = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user