|
156 | 156 | owner_has_control = is_syndicate(M) |
157 | 157 | return ..() |
158 | 158 |
|
159 | | -/datum/action/cooldown/chameleon_copy/Trigger(trigger_flags, atom/target) |
| 159 | +/datum/action/cooldown/chameleon_copy/Trigger(trigger_flags, mob/living/copy_target) |
160 | 160 | if(active) |
161 | 161 | active = FALSE |
| 162 | + background_icon_state = "bg_default" |
162 | 163 | build_all_button_icons() |
| 164 | + unset_click_ability(owner) |
163 | 165 | return FALSE |
164 | 166 | to_chat(owner, span_announce("Whom shall your chameleon kit copy?")) //Bad wording, need to improve it |
165 | 167 | active = TRUE |
| 168 | + background_icon_state = "bg_default_on" |
166 | 169 | build_all_button_icons() |
167 | | - if(target) |
168 | | - return InterceptClickOn(owner, null, target) |
| 170 | + if(copy_target) |
| 171 | + return InterceptClickOn(owner, null, copy_target) |
| 172 | + return set_click_ability(owner) |
169 | 173 |
|
170 | | -/datum/action/cooldown/chameleon_copy/proc/CheckValidTarget(atom/target_atom) |
171 | | - if(target_atom == owner) |
| 174 | +/datum/action/cooldown/chameleon_copy/proc/CheckValidTarget(mob/living/copy_target) |
| 175 | + if(copy_target == owner) |
172 | 176 | return FALSE |
173 | 177 | return TRUE |
174 | 178 |
|
175 | | -/datum/action/cooldown/chameleon_copy/proc/CheckCanTarget(atom/target_atom) |
| 179 | +/datum/action/cooldown/chameleon_copy/proc/CheckCanTarget(mob/living/copy_target) |
| 180 | + var/mob/living/carbon/human/user = owner |
176 | 181 | if(target_range) |
177 | | - if(!(target_atom in view(target_range, owner))) |
| 182 | + if(!(get_dist(user, copy_target) <= target_range)) //get_dist really hates datums for some reason |
178 | 183 | return FALSE |
179 | | - return istype(target_atom) |
| 184 | + return istype(target) |
180 | 185 |
|
181 | | -/datum/action/cooldown/chameleon_copy/proc/click_with_power(atom/target_atom) |
182 | | - if(in_use || !CheckValidTarget(target_atom)) |
| 186 | +/datum/action/cooldown/chameleon_copy/proc/click_with_power(mob/living/copy_target) |
| 187 | + if(in_use || !CheckValidTarget(copy_target)) |
183 | 188 | return FALSE |
184 | | - if(!CheckCanTarget(target_atom)) |
| 189 | + if(!CheckCanTarget(copy_target)) |
185 | 190 | return TRUE |
186 | 191 | in_use = TRUE |
187 | | - FireTargetedPower(target_atom) |
| 192 | + FireTargetedPower(copy_target) |
188 | 193 | in_use = FALSE |
189 | 194 | return TRUE |
190 | 195 |
|
191 | | -/datum/action/cooldown/chameleon_copy/proc/FireTargetedPower(atom/target_atom) |
192 | | - var/mob/living/target = target_atom |
193 | | - var/mob/living/user = owner |
194 | | - var/datum/outfit/O = new() |
195 | | - to_chat(owner, span_notice("Attempting to copy [target]...")) |
196 | | - if(!do_after(user, 5 SECONDS, target)) |
| 196 | +/datum/action/cooldown/chameleon_copy/proc/FireTargetedPower(mob/living/copy_target) |
| 197 | + //var/datum/outfit/O = new() |
| 198 | + to_chat(owner, span_notice("Attempting to copy [copy_target]...")) |
| 199 | + if(!do_after(owner, 5 SECONDS, copy_target)) |
197 | 200 | return |
198 | | - for(var/item in target.contents) |
| 201 | + for(var/item in copy_target.contents) |
199 | 202 | message_admins(item) |
200 | | - to_chat(owner, span_notice("Successfully copied [target]!")) |
| 203 | + to_chat(owner, span_notice("Successfully copied [copy_target]!")) |
201 | 204 | active = FALSE |
202 | 205 |
|
203 | 206 |
|
204 | 207 | /datum/action/cooldown/chameleon_copy/InterceptClickOn(/mob/living/caller, params, atom/target) |
205 | | - click_with_power() |
| 208 | + var/mob/living/copy_target = target |
| 209 | + click_with_power(copy_target) |
206 | 210 |
|
207 | 211 | /datum/action/item_action/chameleon/change |
208 | 212 | name = "Chameleon Change" |
|
0 commit comments