mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-29 19:06:41 +00:00
added special case implementation for GetHealth (max weapon and armor health)
This commit is contained in:
parent
913d55a44e
commit
6e3fdc5816
1 changed files with 48 additions and 1 deletions
|
@ -170,9 +170,29 @@ namespace MWScript
|
||||||
|
|
||||||
if (mIndex==0)
|
if (mIndex==0)
|
||||||
{
|
{
|
||||||
// TODO health is a special case
|
// health is a special case
|
||||||
|
if (context.getReference().getType()==
|
||||||
|
typeid (ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *))
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
||||||
|
context.getReference().get<ESM::Weapon>();
|
||||||
|
|
||||||
|
Interpreter::Type_Integer value = ref->base->data.health;
|
||||||
|
runtime.push (value);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (context.getReference().getType()==
|
||||||
|
typeid (ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *))
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
|
||||||
|
context.getReference().get<ESM::Armor>();
|
||||||
|
|
||||||
|
Interpreter::Type_Integer value = ref->base->data.health;
|
||||||
|
runtime.push (value);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Interpreter::Type_Integer value =
|
Interpreter::Type_Integer value =
|
||||||
|
@ -199,6 +219,33 @@ namespace MWScript
|
||||||
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
|
if (mIndex==0)
|
||||||
|
{
|
||||||
|
// health is a special case
|
||||||
|
if (context.getWorld().getPtr (id, false).getType()==
|
||||||
|
typeid (ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *))
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
||||||
|
context.getWorld().getPtr (id, false).get<ESM::Weapon>();
|
||||||
|
|
||||||
|
Interpreter::Type_Integer value = ref->base->data.health;
|
||||||
|
runtime.push (value);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (context.getWorld().getPtr (id, false).getType()==
|
||||||
|
typeid (ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *))
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
|
||||||
|
context.getWorld().getPtr (id, false).get<ESM::Armor>();
|
||||||
|
|
||||||
|
Interpreter::Type_Integer value = ref->base->data.health;
|
||||||
|
runtime.push (value);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Interpreter::Type_Integer value =
|
Interpreter::Type_Integer value =
|
||||||
context.getWorld().getPtr (id, false).getCreatureStats().mDynamic[mIndex].
|
context.getWorld().getPtr (id, false).getCreatureStats().mDynamic[mIndex].
|
||||||
getCurrent();
|
getCurrent();
|
||||||
|
|
Loading…
Reference in a new issue