From 6470743e5147da6f9a9323d210dd6be5172c2860 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sun, 16 Oct 2011 19:39:20 +0300 Subject: [PATCH] Make dungeon masters not shoot the walls with no reason --- src/content_sao.cpp | 38 ++++++++++++++++++++++---------------- src/environment.cpp | 3 ++- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/src/content_sao.cpp b/src/content_sao.cpp index 93073002b..1968b7b6a 100644 --- a/src/content_sao.cpp +++ b/src/content_sao.cpp @@ -84,7 +84,6 @@ void TestSAO::step(float dtime, bool send_recommended) if(m_timer1 < 0.0) { m_timer1 += 0.125; - //infostream<<"TestSAO: id="<getName()<getName(); m_disturb_timer = 0; @@ -1135,7 +1136,8 @@ void MobV2SAO::step(float dtime, bool send_recommended) dir.normalize(); v3f speed = dir * BS * 10.0; v3f pos = m_base_position + shoot_pos; - infostream<<__FUNCTION_NAME<<": Shooting fireball from "<addActiveObjectAsStatic(obj); m_env->addActiveObject(obj); } else { - infostream<<__FUNCTION_NAME<<": Unknown shoot_type="<= reload_time && - !m_next_pos_exists) + !m_next_pos_exists && + (m_disturb_timer <= 60.0 || shoot_without_player)) { m_shoot_y = 0; - if(m_disturb_timer < 30.0 && disturbing_player && + if(m_disturb_timer < 60.0 && disturbing_player && disturbing_player_distance < 16*BS && fabs(disturbing_player_norm.Y) < 0.8){ m_yaw = disturbing_player_dir; sendPosition(); m_shoot_y += disturbing_player_norm.Y; + } else { + m_shoot_y = 0.01 * myrand_range(-30,10); } m_shoot_reload_timer = 0.0; m_shooting = true; @@ -1229,7 +1239,8 @@ void MobV2SAO::step(float dtime, bool send_recommended) m_base_position = pos_f; if((pos_f - next_pos_f).getLength() < 0.1 || arrived){ - //infostream<<"id="<getMap(); - infostream<<"ACTION: "<setDefault("size", "(1,2)"); m_properties->setDefault("shoot_type", "fireball"); m_properties->setDefault("shoot_y", "0"); + m_properties->setDefault("mindless_rage", "false"); } void MobV2SAO::readProperties() { diff --git a/src/environment.cpp b/src/environment.cpp index 1d684129d..267dd66af 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -657,6 +657,7 @@ static void getMob_dungeon_master(Settings &properties) properties.set("player_hit_damage", "1"); properties.set("player_hit_distance", "1.0"); properties.set("player_hit_interval", "0.5"); + properties.setBool("mindless_rage", myrand_range(0,100)==0); } void ServerEnvironment::step(float dtime) @@ -866,7 +867,7 @@ void ServerEnvironment::step(float dtime) // TODO: Implement usage of ActiveBlockModifier // Find out how many objects the block contains - u32 active_object_count = block->m_static_objects.m_active.size(); + //u32 active_object_count = block->m_static_objects.m_active.size(); // Find out how many objects this and all the neighbors contain u32 active_object_count_wider = 0; for(s16 x=-1; x<=1; x++)