Commit graph

29 commits

Author SHA1 Message Date
Toom
2056be55a3
Support [harm_unit]experience values kill/attack/defend/fight/yes/no (#8231) 2024-01-18 11:32:18 +01:00
Gunter Labes
8b111a2a76 Avoid accessing data of potentially killed unit
Fixes #8019.
2023-11-12 22:12:17 +01:00
Severin Glöckner
a748126b75 Lua: don't trigger unit placed events by WML tags
If the last argument to the C++ function ( game_lua_kernel::intf_put_unit )
is false, event's won't be fired.

closes #5158
2022-10-26 23:32:10 -05:00
Pentarctagon
a5e7986b3e Updates for newer luacheck. 2022-08-06 03:03:17 -05:00
larry_the_cow
8d91bc69a2 [harm_unit] fix secondary_attack animation 2022-06-27 23:17:31 -04:00
Elvish_Hunter
608a2bf85e Improved variable setting in [heal_unit] and [harm_unit] 2022-01-16 13:13:52 +01:00
Celtic Minstrel
4ec60b99d9 Lua: Update all mainline references to the helper module 2021-07-07 01:32:05 -04:00
Celtic Minstrel
a03d59d7eb Lua: Add a new schedule module
The primary components of this are:
- wesnoth.current.schedule
- wesnoth.map.get_time_area()
- wesnoth.schedule module
2021-06-19 11:07:53 -04:00
Celtic Minstrel
6e9826cfcd Update mainline content to use the wesnoth.audio module 2021-05-11 14:52:18 -04:00
Steve Cotton
24e2f8f767 Whitespace fixes for no newline at end of file
The new CI script whitespace-checking script changes these, but not on Linux.
2021-05-03 11:52:40 +02:00
Celtic Minstrel
c7b2dcca3f Oh look, a deprecated thing that was missed sometime in the past 2021-02-28 18:16:33 -05:00
Celtic Minstrel
a0ee38a49a
Use to-be-closed variables to scope WML variables in tag definitions (#5536) 2021-02-15 21:11:56 -05:00
Elvish_Hunter
bfcbe279a2 [harm_unit]: replaced .__cfg.level with .level in unit objects 2020-10-12 20:57:21 +02:00
Elvish_Hunter
61f7fe4749 [harm_unit]: fixed damage calculation for 1.15.x liminal alignment 2020-10-12 20:53:22 +02:00
Celtic Minstrel
732b7942bb Replace all references to deprecated functions in the helper module
(and remove the require if this meant it was no longer used)
2019-12-02 01:10:34 -05:00
Celtic Minstrel
3734bce276 Lua: Replace uses of deprecated (moved) sides functions 2019-11-23 14:41:03 -05:00
Celtic Minstrel
0ee05637d9 Lua: Replace uses of deprecated (moved) interface functions 2019-11-16 12:35:20 -05:00
Celtic Minstrel
aaa2dc4ece Rollback possibility of wesnoth.get_units matching recall list units
Now it's renamed to wesnoth.units.find_on_map.

wesnoth.units.find implements the case of finding units on either the map or a recall list.
2019-11-15 22:39:09 -05:00
Celtic Minstrel
977f05d77f Lua: Replace uses of deprecated (moved) unit functions
Also backtracked the removal of wesnoth.get_recall_units, which is now available as wesnoth.units.find_on_recall - it's just more convenient than passing x=recall to wesnoth.units.find
2019-11-15 22:39:08 -05:00
gfgtdf
bc89512a5c add game_config.combat experience
and make [harm_unit] use these values instead of hardcoded 8*level for
killing and level for combat.

(cherry-picked from commit 3591e82586)
2018-10-07 03:25:00 +00:00
mattsc
0e017d9f7c Lua code: replace deprecated wesnoth.set_variable() calls
(cherry-picked from commit ce7faae4f4)
2018-10-07 03:21:07 +00:00
Charles Dang
0103959c36 Cleaned up deprecated API usage in core Lua
[ci skip]
2018-03-13 16:55:36 +11:00
vgaming
728204665c fix code problems found by luacheck (#2388)
fix code problems found by luacheck

Second iteration of the process, now handling data/lua/wml/*.lua

luacheck command used to find bugs:
  luacheck ./*.lua --globals wesnoth wml --codes --ignore 542 213
Additionally, error code 211 (unused variables) could be ignored,
as using underscore convention `_` is controversial in
wesnoth ( see https://github.com/wesnoth/wesnoth/pull/2380#discussion_r162519341 )

Actual bugs found:
* items.lua, access of global `write_name` instead of local `cfg.write_name`
* kill.lua, typo `primary_unit` -> `primary`
* bad code style: global `i` instead of local `i`
  (would conflict with 3-rd party code if it would use global `i`, too)
2018-01-23 13:35:04 -06:00
Jyrki Vesterinen
e0e59ac463 Fix exception when [harm_unit] is used without an attacking unit
Regression from commit 38e31aa61f.
In particular, it broke WML unit tests.
2017-12-21 20:24:48 +02:00
Gregory A Lundberg
38e31aa61f Do not access non-existent unit
The [kill] tag can run animations. But it can also fire the `last breath` event, which can call [kill]. When we get back to the original [kill], the unit is gone, causing an error attempting to run the animations.

Added a check to ensure the unit is still on the map before we attempt to run the animations.

The Issue also requested that [harm_unit] pass the unit causing the harm into the [kill] tag so that `last breath` could use the secondary (killing) unit available like it does elsewhere.

Closes #2298
2017-12-19 15:05:24 -06:00
Celtic Minstrel
8d4cf3cf62 Shorten requires where possible 2017-05-03 02:42:25 -04:00
Gregory A Lundberg
3809a69a42 Fix bug: Lua harm_unit
Missing local T.

cf https://forums.wesnoth.org/viewtopic.php?f=21&t=44567
2016-09-19 17:40:41 -05:00
Celtic Minstrel
d3374d3670 WML tags fixup 2016-04-04 20:10:52 -04:00
Celtic Minstrel
a791909544 Split the more complicated WML tags into separate Lua files 2016-04-04 17:03:38 -04:00