Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
illuna-minetest
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Illuna-Minetest
illuna-minetest
Commits
bb5f830d
Commit
bb5f830d
authored
10 years ago
by
SmallJoker
Committed by
est31
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Ignore punches with no damage in the actionstream
parent
ecdfbfc8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/content_sao.cpp
+18
-23
18 additions, 23 deletions
src/content_sao.cpp
with
18 additions
and
23 deletions
src/content_sao.cpp
+
18
−
23
View file @
bb5f830d
...
...
@@ -419,19 +419,19 @@ int LuaEntitySAO::punch(v3f dir,
ServerActiveObject
*
puncher
,
float
time_from_last_punch
)
{
if
(
!
m_registered
){
if
(
!
m_registered
){
// Delete unknown LuaEntities when punched
m_removed
=
true
;
return
0
;
}
// It's best that attachments cannot be punched
if
(
isAttached
())
if
(
isAttached
())
return
0
;
ItemStack
*
punchitem
=
NULL
;
ItemStack
punchitem_static
;
if
(
puncher
){
if
(
puncher
)
{
punchitem_static
=
puncher
->
getWieldedItem
();
punchitem
=
&
punchitem_static
;
}
...
...
@@ -442,31 +442,26 @@ int LuaEntitySAO::punch(v3f dir,
punchitem
,
time_from_last_punch
);
if
(
result
.
did_punch
)
{
if
(
result
.
did_punch
)
{
setHP
(
getHP
()
-
result
.
damage
);
if
(
result
.
damage
>
0
)
{
std
::
string
punchername
=
puncher
?
puncher
->
getDescription
()
:
"nil"
;
std
::
string
punchername
=
"nil"
;
if
(
puncher
!=
0
)
punchername
=
puncher
->
getDescription
();
actionstream
<<
getDescription
()
<<
" punched by "
<<
punchername
<<
", damage "
<<
result
.
damage
<<
" hp, health now "
<<
getHP
()
<<
" hp"
<<
std
::
endl
;
{
std
::
string
str
=
gob_cmd_punched
(
result
.
damage
,
getHP
());
// create message and add to list
ActiveObjectMessage
aom
(
getId
(),
true
,
str
);
m_messages_out
.
push
(
aom
);
actionstream
<<
getDescription
()
<<
" punched by "
<<
punchername
<<
", damage "
<<
result
.
damage
<<
" hp, health now "
<<
getHP
()
<<
" hp"
<<
std
::
endl
;
}
if
(
getHP
()
==
0
)
m_removed
=
true
;
std
::
string
str
=
gob_cmd_punched
(
result
.
damage
,
getHP
());
// create message and add to list
ActiveObjectMessage
aom
(
getId
(),
true
,
str
);
m_messages_out
.
push
(
aom
);
}
if
(
getHP
()
==
0
)
m_removed
=
true
;
m_env
->
getScriptIface
()
->
luaentity_Punch
(
m_id
,
puncher
,
time_from_last_punch
,
toolcap
,
dir
);
...
...
@@ -475,10 +470,10 @@ int LuaEntitySAO::punch(v3f dir,
void
LuaEntitySAO
::
rightClick
(
ServerActiveObject
*
clicker
)
{
if
(
!
m_registered
)
if
(
!
m_registered
)
return
;
// It's best that attachments cannot be clicked
if
(
isAttached
())
if
(
isAttached
())
return
;
m_env
->
getScriptIface
()
->
luaentity_Rightclick
(
m_id
,
clicker
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment