ID:1042836
 
Keywords: flick, maptext
Resolved
BYOND Version:497
Operating System:Windows 7 Pro 64-bit
Web Browser:Chrome 22.0.1229.94
Applies to:DM Language
Status: Resolved

This issue has been resolved.
Descriptive Problem Summary:
calling flick(icon_state, atom) on an atom will cause that atom's maptext to disappear for the duration of the flick call.

Numbered Steps to Reproduce Problem:
Try the codes below:
Code Snippet (if applicable) to Reproduce Problem:
Example 1:
mob
gotHit()
maptext = "Dying"
flick("die", src)
spawn(16) del(src)

In the above example, you will not see the map text at all if your flick animation is 16 frames long.

Example 2:
mob
gotHit()
var/atom/movable/a = new
a.maptext = "Dying"
src.overlays += a
flick("die", src)
spawn(16) del(src)

In the above example, you will also not see the map text at all, I suspect this may be because the overlays list is also being replaced by flick().

Expected Results:
The documentation for maptext describes it as being, "text that displays in front of an icon if an atom has an icon at all". So I would expect the behavior to be in that flick calls are affecting the icon and not the atom's maptext.

Actual Results:
maptext is removed during flick() calls when I feel the intended design was that it should not.

Workarounds:
In order for the overlays to update before the flick, you must call sleep(world.tick_lag). Maybe not the best option for people with low FPS settings in world, though.
I have no problem with the bottom code in general, given that src is the user playing the game, and he is the one that got hit...I have tested overlays that include maptext with flick() & there are no problems, however if there is something visually linked it may be why it's disappearing, as it seems to want anything visual to disappear with flick()

Try setting a.icon=null & a.icon_state=null on the new atom/movable/a & see if that makes a difference.
In response to Superbike32
Superbike32 wrote:
I have no problem with the bottom code in general, given that src is the user playing the game, and he is the one that got hit...I have tested overlays that include maptext with flick() & there are no problems, however if there is something visually linked it may be why it's disappearing, as it seems to want anything visual to disappear with flick()

Try setting a.icon=null & a.icon_state=null on the new atom/movable/a & see if that makes a difference.

I'll try your suggestion. Try this on another mob, not a mob with a connected client.

Edit: Tried setting a.icon and a.icon_state to null on the new atom/movable/a and it made no difference. This might have something to do with the caller being an atom and not a client. This is being called by a missile atom which is created by a turf.
FIREking, please answer these questions.

1.What BYOND version are you using?
2.For the maptext set does it appear before or after the flick() call starts/finishes?

---Anyways a few things to note...

1.Don't set the maptext on the object itself, use an overlay.

2.When creating maptext to use, only add the overlay after you are done modifying all the settings for the overlay you will be adding, as anything changed after adding the overlay will not be reflected visually by that overlay.

3.Make sure that icon & icon_state are null, this shouldn't stop maptext from showing up but can get un-desired results usually by adding the icon & icon_state that is defined for a certain type(in your case atom/movable.)

4.Make sure that the layer of the overlay is above everything else, setting to something incredibly high like 1000, maybe higher, would be good, to make sure nothing will be displayed above it.

---The 4th is incredibly important because maptext through overlays don't appear above everything else, they respect layer.

The 4th may indeed be your problem if the maptext doesn't seem to ever show up using overlays.
In response to Superbike32
Superbike32 wrote:
FIREking, please answer these questions.

1.What BYOND version are you using?
2.For the maptext set does it appear before or after the flick() call starts/finishes?

---Anyways a few things to note...

1.Don't set the maptext on the object itself, use an overlay.

2.When creating maptext to use, only add the overlay after you are done modifying all the settings for the overlay you will be adding, as anything changed after adding the overlay will not be reflected visually by that overlay.

3.Make sure that icon & icon_state are null, this shouldn't stop maptext from showing up but can get un-desired results usually by adding the icon & icon_state that is defined for a certain type(in your case atom/movable.)

4.Make sure that the layer of the overlay is above everything else, setting to something incredibly high like 1000, maybe higher, would be good, to make sure nothing will be displayed above it.

---The 4th is incredibly important because maptext through overlays don't appear above everything else, they respect layer.

The 4th may indeed be your problem if the maptext doesn't seem to ever show up using overlays.

1. Latest beta, "497.1147"
2. Appears shortly after the flick call for 1 tick
--
1. Look at code, made an additional atom with maptext and added that as an overlay, doesn't work.
2. I realize that overlays are "static" snapshots. I'm not stupid.
3. I made sure icon and icon_state was set to null
4. Did overlay_atom.layer = atom.layer + 1

I'll do a demo project later tonight to prove the results.
In response to FIREking
Nothing I said is to make you feel stupid but as to try & learn myself why it's not working, it's working for me using an overlay but not with maptext set directly on the object, as for the deletion of files & everything that was to make sure that it's doing everything correctly & actually overwriting the files correctly, so that it's not using the original maptext & that is what's disappearing.

At this stage i'd say offset the overlay for the maptext & see what happens, if it moves without your character or moves at all, and try flick() again...

If you already have a pixel offset, then I have no idea, just create the demo & I will look, but me myself I don't appear to have any troubles when using overlays, and i'm using the same byond version as you.
Here's the demo project. Walk up to the missile launcher and bump it, it will fire a missile at the monster and the monster will begin to flash before maptext is displayed. The maptext was added before the flashing but you only see the flashing. Bump the button on the wall to create another monster.

The code to look at is in the gotHit() proc.

http://www.joeysturgis.com/maptext_bug_src.zip
Looks like putting a sleep(world.tick_lag) before the flick call and after the overlay change actually makes it work.

So maybe something internally isn't quite scheduling that properly.

Edit: Here's the project with the workaround http://www.joeysturgis.com/maptext_bug_workaround_src.zip
BUMP.
This is a bug I'm having with V.508.1290
I've added this to my short list and will look into it when I can. It won't be for 1291.
Good lord, Bump.

overlays and underlays also disappear when a turf is flick()ed.
Hrm. There was an issue just like this that was reported and fixed for flicks, so maptext should be fine now. Flicks should be copying the overlays/underlays at the time they're applied and using the copies, though.
Flicks should be copying the overlays/underlays at the time they're applied and using the copies, though.

Should be in 1350?
Flicks have copied underlays/overlays since forever, so if they're not doing that then something is wrong. But I fixed the maptext thing in 511.1348.
Starting new thread. Wanna resolve this one as duplicate of:

http://www.byond.com/forum/?post=2115476
Actually I think maybe I should just close this one outright. Marking it as a duplicate of the other issue seems wrong, since this one came first (by a lot), but the other is already closed.
maptext and flick Confirmed working in 1350 on all atomic objects.

This one is safe to close.
Lummox JR resolved issue