Lib Discussion => Dead Souls Support => Topic started by: hells on June 05, 2012, 01:36:59 pm

Title: Default Gravity For lib/std/room.c
Post by: hells on June 05, 2012, 01:36:59 pm
By default the room picks up 1.0 for gravity in the private definition of gravity.

private float           Gravity       = 1.0;

Should be changed to:

private float           Gravity       = DEFAULT_GRAVITY;

Title: Re: Default Gravity For lib/std/room.c
Post by: hells on June 05, 2012, 07:09:50 pm
Extra changes to fix where GetCarriedMass is called when it should be calling GetCarriedWeight so it can handle gravity correctly.

Added GetCarriedWeight after GetCarriedMass.
Code: [Select]
int GetCarriedWeight(){
    return (currency::GetCurrencyWeight() + carry::GetCarriedWeight());

Added GetCurrencyWeight after GetCurrencyMass:
Code: [Select]
varargs int GetCurrencyWeight(string type){
return GetCurrencyMass(type) * environment(this_player())->GetGravity();

Added GetCarriedWeight dummy to race so things don't blow up in living:
Code: [Select]
int GetCarriedWeight(){ return 0; }

Also updated GetMobility:
Code: [Select]
int GetMobility(){
    int max = GetMaxCarry();
    int encum, mob;

    if( GetParalyzed() ){
        return 0;
    if( max < 1 ){
        max = 1;
    encum = (GetCarriedWeight() * 100)/max;
    encum -= (encum * this_object()->GetStatLevel("agility"))/200;
    mob = 100 - encum;
    if( mob > 100 ){
        mob = 100;
    else if( mob < 1 ){
        mob = 0;
    return mob;

Same added header for the GetCarriedWeight function:
Code: [Select]
int GetCarriedMass();
int GetCarriedWeight();
int GetMaxCarry();

There are a few places in vehicles and mounts that still use Mass rather than weight but I haven't made those changes yet. I will reply to this thread when I get around to it.

Changes as always are public domain, do whatever you like with this post.