blob: ae57bbea8ea5c1af9ac54ecfe89b233e4f7b81c7 [file] [log] [blame]
#pragma strict_types, save_types, pedantic, range_check
#pragma no_clone
#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 wave_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 wave_s msgs,
string action, int commontypes)
{
int** res = ({int**})all_inventory()->ReceiveMultisense(msgs, action, commontypes);
return _minarr(res);
}