init: add workspace files

This commit is contained in:
2026-05-26 16:41:20 +08:00
commit f4f2393f72
1041 changed files with 67405 additions and 0 deletions

26
world/cmd/obj/open.js Normal file
View File

@@ -0,0 +1,26 @@
this.inherits(COMMAND);
this.command = "open";
this.enter = function (player, objid) {
var obj = player.find_obj(objid);
if (!obj) return player.notify("你要打开什么?");
if (!obj.on_open) return player.notify("这个东西打不开。");
var items = obj.on_open(player);
if (items == false) return;
if (!items || !items.length) {
player.send_room("$N打开了" + obj.color_name + ",但是里面什么都没有。");
} else {
// if (player.is_full()) return player.notify("你身上东西太多了,放不下" + obj.color_name + "里的东西。");
for (var i = 0; i < items.length; i++) {
var item = player.add_obj(items[i]);
if (item) {
//if (item.is_equipment && item.grade > 5) {
// COMMAND.DO("rumor", "听说有人得到了一" + item.unit + item.name + "。");
//}
player.notify("你从" + obj.color_name + "里面拿出来" + UTIL.to_c(items[i].count) + item.unit + item.color_name + "。");
}
}
}
player.remove_obj(obj,1);
}