blob: 3f2516b35bdf9cb1b18b411bbd136589cddb9f96 [file] [log] [blame]
#pragma strict_types, save_types, pedantic, range_check
#pragma no_clone
inherit "/std/living/comm_structs";
#include <thing/language.h>
// Per Default nur an alle Items im Inventar weiterleiten.
public varargs int ReceiveMsg(string msg, int msg_type, string msg_action,
string msg_prefix, object origin)
{
int *res = ({int*})all_inventory()->ReceiveMsg(msg, msg_type, msg_action,
msg_prefix,
origin || previous_object());
if (sizeof(res))
return min(res);
return 0;
}
// Sortierfunktion um das Array mit dem kleinsten Wert auszugeben
private int* _minarr(int** arr)
{
if(!sizeof(arr)) return 0;
return sort_array(&arr,
function int(int* a, int* b)
{
return a[0] > b[0];
})[0];
}
// Wrapper fuer ReceiveMsg()
public varargs int* ReceiveSay(string msg, string prefix,
struct msg_s sense_blocked)
{
// Das muss schon hier passieren, damit previous_object() stimmt
if(!prefix)
{
prefix = ({string})previous_object().Name(WER, 1) + " sagt: ";
}
int** res = ({int**})all_inventory()->ReceiveSay(msg, prefix, sense_blocked);
return _minarr(res);
}
public varargs int* ReceiveMultisense(struct msg_s msgs,
string action, int commontypes)
{
int** res = ({int**})all_inventory()->ReceiveMultisense(msgs, action, commontypes);
return _minarr(res);
}