123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- event.load("block_break");
- event.load("human_hurt");
- herobrines = list.new();
- msg("dev", "§bHerobrine §rloaded.");
- @wait
- wait();
- if(event == "human_hurt") {
- entity_name = entity.getName(human);
- if(list.contains(herobrines, human)) {
- living.damage(entity, 4, damage.get("thorns", human));
- }
- goto("wait");
- }
- if(event == "block_break") {
- player_loc = entity.getLocation(player);
- world_name = world.getName(loc.getWorld(player_loc));
- if(!word.isSurvName(world_name)) {
- goto("wait");
- }
- r = math.random(1, 500);
- if(r == 1) {
- spawnHerobrine(player);
- }
- goto("wait");
- }
- goto("wait");
- function spawnHerobrine(player) {
- player_loc = entity.getLocation(player);
- dist = math.random(4, 20);
- alpha = math.random(0, 360);
- alpha *= math.pi() / 180;
- x = math.round(math.sin(alpha) * dist) + 0.5;
- z = math.round(math.cos(alpha) * dist) + 0.5;
- y = 255;
- hero_loc = loc.mod(player_loc, x, y, z);
- while(block.isAir(hero_loc)) {
- loc.setY(hero_loc, y);
- y--;
- }
- loc.addY(hero_loc, 1);
- ent = human.spawn(hero_loc);
- list.add($herobrines, ent);
- human.setSkin(ent, "herobrine");
- entity.setName(ent, "Herobrine");
- sgoto(400, "deleteHerobrine");
- }
- @deleteHerobrine
- ent = list.getIndex(herobrines, 0);
- list.removeIndex(herobrines, 0);
- entity.remove(ent);
- goto("wait");
|