Author Topic: Puddles  (Read 3641 times)

Offline memrosh

  • Acquaintance
  • *
  • Posts: 20
    • View Profile
Puddles
« on: September 11, 2006, 01:56:47 AM »

I think I will get things started here in the vault by making a puddle...

Um... a code puddle that is.

I had heard a request on drinkable puddles that used the 'drink' verb from somewhere and that got my wheels to turning.

This is an object that will work in the normal ds2.1 that has not had its lib to heavilly modified I believe.

We could move it in when a bottle breaks, after a rain storm, etc.

I plan on working it up to being a lib object that could be configured on the fly.



Code Start-

/*    /domain/whatever/obj/puddle.c

 *    from the Dead Souls 2.1

 *    provides drinkable puddle for room inventory

 *    or -moves to room- to allow drink verb usage.

 *    Memrosh@Ascension

 *    September 10, 2006

 */



#include <lib.h>

#include <meal_types.h>



inherit LIB_ITEM;



int pud_size = 10;



int GetMealType(){ return MEAL_DRINK; }

int GetStrength(){ return 1;}



int eventDestruct() { return item::eventDestruct(); }



void Lesson_Me(){

pud_size --;

if(pud_size < 1){ Destruct();}

}



static void create() {

    item::create();

    SetKeyName("puddle");

    SetId("puddle","water");

    SetAdjectives("cool");

    SetShort("a puddle");

    SetLong("This is a puddle of water.");

}



mixed direct_drink_obj(){

    return (int)this_player()->CanDrink(this_object());

}



mixed direct_drink_from_obj(){

    return (int)this_player()->CanDrink(this_object());

}



mixed CanGet(object ob) {

    send_messages( "run","$agent_name $agent_verb $agent_possessive "+

        "fingers through $target_name.",this_player(),this_object(),

         environment());

    return "You can not physically take a puddle.";

}



mixed eventDrink(object who){

    send_messages("drink","$agent_name $agent_verb from a puddle.",

        who,0,environment(who));

    who->eventDrink(this_object());

    Lesson_Me();

    return 1;

}



void init(){

    ::init();

}

-Code End



Please feel free to discuss, rip, advance, etc.



I also have an invis 'dummy' stream that will do the same except wont dry up.



Memrosh



ps: seems the board does not like spaces or tabs at the left.


Offline alexander_tau

  • Acquaintance
  • *
  • Posts: 0
    • View Profile
Puddles
« Reply #1 on: September 11, 2006, 09:26:24 AM »

Welcome.



Still getting the hang of this new place so I have no advice to give on how to format things as you would like them to be. But great start for the Vault, puddles, very cool.





A.T

(-)


Offline cratylus

  • Your favorite and best
  • Administrator
  • ***
  • Posts: 1020
  • Cratylus@Dead Souls <ds> np
    • View Profile
    • About Cratylus
Puddles
« Reply #2 on: September 21, 2006, 08:35:21 AM »

Memrosh,



The a9 lib has refillable vessels and streams and such...but no

puddles yet. I'd like to use part of your puddle code in DS, if

that's ok with you.



Offline memrosh

  • Acquaintance
  • *
  • Posts: 20
    • View Profile
Puddles
« Reply #3 on: September 21, 2006, 11:09:07 AM »

That is fine with me.

You are quite welcome to take this bit of code and meld it into a useful part of DS :)

Always happy to contribute.



Memrosh